2019-05-08 13:32:01 +00:00
|
|
|
// Copyright 2019 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-06-29 13:28:33 +00:00
|
|
|
// Flags: --log-ic --logfile='+' --allow-natives-syntax
|
2019-05-08 13:32:01 +00:00
|
|
|
|
|
|
|
// The idea behind this test is to make sure we do not crash when using the
|
2021-06-15 15:22:17 +00:00
|
|
|
// --log-ic flag.
|
2019-05-08 13:32:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
(function testLoadIC() {
|
|
|
|
function loadIC(obj) {
|
|
|
|
return obj.field;
|
|
|
|
}
|
|
|
|
|
|
|
|
%EnsureFeedbackVectorForFunction(loadIC);
|
|
|
|
|
|
|
|
var obj = {field: 'hello'};
|
|
|
|
loadIC(obj);
|
|
|
|
loadIC(obj);
|
|
|
|
loadIC(obj);
|
|
|
|
})();
|
|
|
|
|
|
|
|
(function testStoreIC() {
|
|
|
|
function storeIC(obj, value) {
|
|
|
|
return obj.field = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
%EnsureFeedbackVectorForFunction(storeIC);
|
|
|
|
|
|
|
|
var obj = {field: 'hello'};
|
|
|
|
storeIC(obj, 'world');
|
|
|
|
storeIC(obj, 'world');
|
|
|
|
storeIC(obj, 'world');
|
|
|
|
})();
|
|
|
|
|
|
|
|
(function testKeyedLoadIC() {
|
|
|
|
function keyedLoadIC(obj, field) {
|
|
|
|
return obj[field];
|
|
|
|
}
|
|
|
|
|
|
|
|
%EnsureFeedbackVectorForFunction(keyedLoadIC);
|
|
|
|
|
|
|
|
var obj = {field: 'hello'};
|
|
|
|
keyedLoadIC(obj, 'field');
|
|
|
|
keyedLoadIC(obj, 'field');
|
|
|
|
keyedLoadIC(obj, 'field');
|
|
|
|
})();
|
|
|
|
|
|
|
|
(function testKeyedStoreIC() {
|
|
|
|
function keyedStoreIC(obj, field, value) {
|
|
|
|
return obj[field] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
%EnsureFeedbackVectorForFunction(keyedStoreIC);
|
|
|
|
|
|
|
|
var obj = {field: 'hello'};
|
|
|
|
keyedStoreIC(obj, 'field', 'world');
|
|
|
|
keyedStoreIC(obj, 'field', 'world');
|
|
|
|
keyedStoreIC(obj, 'field', 'world');
|
|
|
|
})();
|