289b25765a
This adds either %EnsureFeedbackVectorForFunction or %PrepareFunctionForOptimization to allocate feedback vectors when testing optimization, allocation sites, IC transitions etc., Bug: v8:8394 Change-Id: I6ad1b6d460e4abda693b326cddb87754e080a0a1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1593303 Commit-Queue: Mythri Alle <mythria@chromium.org> Auto-Submit: Mythri Alle <mythria@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Cr-Commit-Position: refs/heads/master@{#61212}
83 lines
1.9 KiB
JavaScript
83 lines
1.9 KiB
JavaScript
// Copyright 2018 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: --block-concurrent-recompilation
|
|
|
|
Debug = debug.Debug
|
|
|
|
// Test that the side-effect check is not bypassed in optimized code.
|
|
|
|
var exception = null;
|
|
var counter = 0;
|
|
|
|
function f1() {
|
|
counter++;
|
|
}
|
|
|
|
function wrapper1() {
|
|
for (var i = 0; i < 4; i++) {
|
|
// Get this function optimized before calling to increment.
|
|
// Check that that call performs the necessary side-effect checks.
|
|
%OptimizeOsr();
|
|
}
|
|
f1();
|
|
}
|
|
%PrepareFunctionForOptimization(wrapper1);
|
|
|
|
function f2() {
|
|
counter++;
|
|
}
|
|
|
|
function wrapper2(call) {
|
|
if (call) f2();
|
|
}
|
|
|
|
function listener(event, exec_state, event_data, data) {
|
|
if (event != Debug.DebugEvent.Break) return;
|
|
try {
|
|
function success(expectation, source) {
|
|
assertEquals(expectation,
|
|
exec_state.frame(0).evaluate(source, true).value());
|
|
}
|
|
function fail(source) {
|
|
assertThrows(() => exec_state.frame(0).evaluate(source, true),
|
|
EvalError);
|
|
}
|
|
wrapper1();
|
|
wrapper1();
|
|
fail("wrapper1()");
|
|
|
|
%PrepareFunctionForOptimization(wrapper2);
|
|
wrapper2(true);
|
|
wrapper2(false);
|
|
wrapper2(true);
|
|
%OptimizeFunctionOnNextCall(wrapper2);
|
|
wrapper2(false);
|
|
fail("wrapper2(true)");
|
|
fail("%PrepareFunctionForOptimization(wrapper2); "+
|
|
"%OptimizeFunctionOnNextCall(wrapper2); wrapper2(true)");
|
|
|
|
%PrepareFunctionForOptimization(wrapper2);
|
|
%OptimizeFunctionOnNextCall(wrapper2, "concurrent");
|
|
wrapper2(false);
|
|
fail("%UnblockConcurrentRecompilation();" +
|
|
"%GetOptimizationStatus(wrapper2, 'sync');" +
|
|
"wrapper2(true);");
|
|
} catch (e) {
|
|
exception = e;
|
|
print(e, e.stack);
|
|
}
|
|
};
|
|
|
|
// Add the debug event listener.
|
|
Debug.setListener(listener);
|
|
|
|
function f() {
|
|
debugger;
|
|
};
|
|
|
|
f();
|
|
|
|
assertNull(exception);
|