v8/test/mjsunit/regress/regress-crbug-700733.js
Ross McIlroy 2425885552 [cleanup] Add missing %PrepareFunctionForOptimize in mjsunit tests
Bug: v8:8801,v8:8394,v8:9183
Change-Id: I5ceaf731a1b2720f086e6791fe08caaaa55de030
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1662568
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Auto-Submit: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62224}
2019-06-17 16:48:50 +00:00

69 lines
1.4 KiB
JavaScript

// Copyright 2017 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.
// Flags: --allow-natives-syntax --verify-heap --expose-gc
(function test_keyed_load() {
var smi_arr = [0];
smi_arr.load = 42;
var double_arr = [0.5];
double_arr.load = 42;
var obj_arr = [{}];
obj_arr.load = 42;
var arrs = [smi_arr, double_arr, obj_arr];
var tmp;
function do_keyed_load(arrs) {
for (var i = 0; i < arrs.length; i++) {
var arr = arrs[i];
tmp = arr[0];
}
}
var obj = {};
obj.load_boom = smi_arr;
%PrepareFunctionForOptimization(do_keyed_load);
do_keyed_load(arrs);
do_keyed_load(arrs);
%OptimizeFunctionOnNextCall(do_keyed_load);
do_keyed_load(arrs);
gc();
})();
(function test_keyed_store() {
var smi_arr = [0];
smi_arr.store = 42;
var double_arr = [0.5];
double_arr.store = 42;
var obj_arr = [{}];
obj_arr.store = 42;
var arrs = [smi_arr, double_arr, obj_arr];
function do_keyed_store(arrs) {
for (var i = 0; i < arrs.length; i++) {
var arr = arrs[i];
arr[0] = 0;
}
}
var obj = {};
obj.store_boom = smi_arr;
%PrepareFunctionForOptimization(do_keyed_store);
do_keyed_store(arrs);
do_keyed_store(arrs);
%OptimizeFunctionOnNextCall(do_keyed_store);
do_keyed_store(arrs);
gc();
})();