v8/test/mjsunit/regress/regress-747825.js
jgruber d8e147752c [regexp] Teach deoptimizer to materialize JSRegExp objects
Now that literal allocation is inlined, it is possible to optimize out regexp
literal allocation completely. If a lazy deopt is triggered in that situation,
the deoptimizer needs to know how to materialize regexp objects.

Bug: v8:6605,v8:6556,chromium:747825
Change-Id: Id491053f8e64fec16540efbfdc6c7c524da3e080
Reviewed-on: https://chromium-review.googlesource.com/582609
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46837}
2017-07-24 10:36:25 +00:00

28 lines
658 B
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
var g = 0;
g = function() {}
function f() {
var r = /[abc]/i; // Optimized out.
g(r);
}
f(); f(); %OptimizeFunctionOnNextCall(f); // Warm-up.
var re;
g = function(r) { re = r; }
f(); // Lazy deopt is forced here.
assertNotEquals(undefined, re);
assertEquals("[abc]", re.source);
assertEquals("i", re.flags);
assertEquals(0, re.lastIndex);
assertArrayEquals(["a"], re.exec("a"));
assertArrayEquals(["A"], re.exec("A"));
assertNull(re.exec("d"));