v8/test/mjsunit/baseline/test-baseline-module.mjs
Leszek Swirski d0136a5caa [sparkplug] CompileWithBaseline to Compiler::CompileBaseline
Move the CompileWithBaseline interface to the Compiler class, as
CompileBaseline, which will do the additional work of pre-compiling
to bytecode, ensuring there is a feedback vector, and setting the
code on the function closure.

As a drive-by, fix v8_enable_trace_unoptimized to have a blank default
value, so that v8_enable_trace_ignition/v8_enable_trace_baseline_exec
can set it.

Bug: v8:11420, v8:11429
Change-Id: If715161de71f7d9300f3fdcbb50cc678b1fcdfdf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2697352
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72819}
2021-02-17 16:01:45 +00:00

25 lines
705 B
JavaScript

// Copyright 2020 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 --super-ic --sparkplug
export let exported = 17;
import imported from 'test-baseline-module-helper.mjs';
function run(f, ...args) {
try { f(...args); } catch (e) {}
%CompileBaseline(f);
return f(...args);
}
function construct(f, ...args) {
try { new f(...args); } catch (e) {}
%CompileBaseline(f);
return new f(...args);
}
assertEquals(17, run((o)=>{ return exported; }));
assertEquals(12, run((o)=>{ return imported; }));
assertEquals(20, run((o)=>{ exported = 20; return exported; }));