2019-03-11 11:36:34 +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.
|
|
|
|
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
|
|
|
|
const re = /abc/;
|
|
|
|
|
|
|
|
// Move the test method one prototype up.
|
|
|
|
re.__proto__.__proto__.test = re.__proto__.test;
|
|
|
|
delete re.__proto__.test;
|
|
|
|
|
|
|
|
function foo(s) {
|
|
|
|
return re.test(s);
|
2019-06-12 14:00:50 +00:00
|
|
|
};
|
|
|
|
%PrepareFunctionForOptimization(foo);
|
2019-03-11 11:36:34 +00:00
|
|
|
assertTrue(foo('abc'));
|
|
|
|
assertTrue(foo('abc'));
|
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
|
|
assertTrue(foo('abc'));
|
|
|
|
assertFalse(foo('ab'));
|