v8/test/mjsunit/regress/regress-343609.js
Georg Neis 2257f6b145 [compiler][test] Remove --block-concurrent-recompilation
- Remove flag --block-concurrent-recompilation and its implementation,
  including %UnblockConcurrentCompilation.
- Rewrite tests that used it in terms of the primitives introduced in
  my previous CL:
  https://chromium-review.googlesource.com/c/v8/v8/+/3071400/
- Remove "sync"/"no sync" arguments from %GetOptimizationStatus,
  assertOptimized, etc. These are now always "no sync": they don't
  do any magic.
- Remove "if %IsConcurrentRecompilationSupported then quit" from some
  tests in favor of --concurrent-recompilation in their Flags line.

Bug: v8:12041, v8:7790
Change-Id: I966aae4fec85e6f9e7aeed2ba2c12e9198a3991f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3077149
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76298}
2021-08-16 10:15:53 +00:00

68 lines
1.3 KiB
JavaScript

// Copyright 2014 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 --expose-gc
function Ctor() {
this.a = 1;
}
function get_closure() {
return function add_field(obj) {
obj.c = 3;
obj.a = obj.a + obj.c;
return obj.a;
}
}
function get_closure2() {
return function cc(obj) {
obj.c = 3;
obj.a = obj.a + obj.c;
}
}
function dummy() {
(function () {
var o = {c: 10};
var f1 = get_closure2();
%PrepareFunctionForOptimization(f1);
f1(o);
f1(o);
%OptimizeFunctionOnNextCall(f1);
f1(o);
})();
}
var o = new Ctor();
function opt() {
(function () {
var f1 = get_closure();
%PrepareFunctionForOptimization(f1);
f1(new Ctor());
f1(new Ctor());
%OptimizeFunctionOnNextCall(f1);
f1(o);
})();
}
// Optimize add_field and install its code in optimized code cache.
opt();
opt();
opt();
// Optimize dummy function to remove the add_field from head of optimized
// function list in the context.
dummy();
dummy();
// Kill add_field in new space GC.
for(var i = 0; i < 3; i++) gc(true);
// Trigger deopt.
o.c = 2.2;
// Fetch optimized code of add_field from cache and crash.
var f2 = get_closure();
f2(new Ctor());