v8/test/mjsunit/harmony/regexp-overriden-exec.js
Maya Lekova e89f590646 [turbofan] Brokerize reduction of RegExp.prototype.test
Bug: v8:7790
Change-Id: If2a8123e5657f0ea9a007b5f1a82e9d1a91c80f9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1679493
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62763}
2019-07-17 11:40:51 +00:00

27 lines
515 B
JavaScript

// 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.
// Flags: --allow-natives-syntax --no-always-opt --opt
const r = RegExp('bla');
function foo() {
r.test('string');
}
%PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
foo();
assertOptimized(foo);
r.__proto__.exec = function() {
return null;
}
Object.freeze(r.__proto__);
foo();
assertUnoptimized(foo);