v8/test/mjsunit/maglev/get-template-object.js
jameslahm d0f83a7c2a [maglev] Support GetTemplateObject
Bug: v8:7700
Change-Id: Ifa3c78017abf8f596a7d3c96877ca035d6126c90
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3815481
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82249}
2022-08-08 08:52:43 +00:00

21 lines
584 B
JavaScript

// Copyright 2022 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 --maglev --no-stress-opt --no-always-turbofan
function bar(x, y){
return [...x, y]
}
function foo(x) {
return bar`123${x}`
}
%PrepareFunctionForOptimization(foo);
assertEquals(["123", "", 1], foo(1));
assertEquals(["123", "", 2], foo(2));
%OptimizeMaglevOnNextCall(foo);
assertEquals(["123", "", 1], foo(1));
assertEquals(["123", "", 2], foo(2));
assertTrue(isMaglevved(foo));