Commit 7a23f5ad authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Make WasmCompileLazy builtin Isolate independent.

R=jgruber@chromium.org
BUG=v8:7424

Change-Id: I15fa004b52229ab808401e45fb9d8885f99d8b5e
Reviewed-on: https://chromium-review.googlesource.com/1092735Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53626}
parent c8779397
...@@ -2350,6 +2350,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { ...@@ -2350,6 +2350,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{ {
DontEmitDebugCodeScope no_debug_code(masm); // Avoid calls to Abort.
FrameAndConstantPoolScope scope(masm, StackFrame::WASM_COMPILE_LAZY); FrameAndConstantPoolScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be // Save all parameter registers (see wasm-linkage.cc). They might be
...@@ -2364,10 +2365,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { ...@@ -2364,10 +2365,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// Pass the WASM instance as an explicit argument to WasmCompileLazy. // Pass the WASM instance as an explicit argument to WasmCompileLazy.
__ push(kWasmInstanceRegister); __ push(kWasmInstanceRegister);
// Load the correct CEntry builtin from the instance object.
__ ldr(r2, FieldMemOperand(kWasmInstanceRegister,
WasmInstanceObject::kCEntryStubOffset));
// Initialize the JavaScript context with 0. CEntry will use it to // Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate. // set the current context on the isolate.
__ Move(cp, Smi::kZero); __ Move(cp, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy); __ CallRuntimeWithCEntry(Runtime::kWasmCompileLazy, r2);
// The entrypoint address is the return value. // The entrypoint address is the return value.
__ mov(r8, kReturnRegister0); __ mov(r8, kReturnRegister0);
......
...@@ -2805,6 +2805,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { ...@@ -2805,6 +2805,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{ {
DontEmitDebugCodeScope no_debug_code(masm); // Avoid calls to Abort.
FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY); FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be // Save all parameter registers (see wasm-linkage.cc). They might be
...@@ -2819,10 +2820,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { ...@@ -2819,10 +2820,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// Pass the WASM instance as an explicit argument to WasmCompileLazy. // Pass the WASM instance as an explicit argument to WasmCompileLazy.
__ PushArgument(kWasmInstanceRegister); __ PushArgument(kWasmInstanceRegister);
// Load the correct CEntry builtin from the instance object.
__ Ldr(x2, FieldMemOperand(kWasmInstanceRegister,
WasmInstanceObject::kCEntryStubOffset));
// Initialize the JavaScript context with 0. CEntry will use it to // Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate. // set the current context on the isolate.
__ Move(cp, Smi::kZero); __ Move(cp, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy); __ CallRuntimeWithCEntry(Runtime::kWasmCompileLazy, x2);
// The entrypoint address is the return value. // The entrypoint address is the return value.
__ mov(x8, kReturnRegister0); __ mov(x8, kReturnRegister0);
......
...@@ -315,11 +315,6 @@ bool Builtins::IsIsolateIndependent(int index) { ...@@ -315,11 +315,6 @@ bool Builtins::IsIsolateIndependent(int index) {
// of the builtin itself (and not just the trampoline). // of the builtin itself (and not just the trampoline).
case kInterpreterEntryTrampoline: case kInterpreterEntryTrampoline:
return false; return false;
// TODO(jgruber): WasmCompileLazy is copied off the heap during module
// compilation, which breaks pc-relative calls. It can be marked
// isolate-independent once copies are no longer generated for wasm.
case kWasmCompileLazy:
return false;
default: default:
return true; return true;
} }
......
...@@ -2545,6 +2545,7 @@ void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { ...@@ -2545,6 +2545,7 @@ void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{ {
DontEmitDebugCodeScope no_debug_code(masm); // Avoid calls to Abort.
FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY); FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be // Save all parameter registers (see wasm-linkage.cc). They might be
...@@ -2568,10 +2569,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { ...@@ -2568,10 +2569,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// Pass the WASM instance as an explicit argument to WasmCompileLazy. // Pass the WASM instance as an explicit argument to WasmCompileLazy.
__ Push(kWasmInstanceRegister); __ Push(kWasmInstanceRegister);
// Load the correct CEntry builtin from the instance object.
__ mov(ecx, FieldOperand(kWasmInstanceRegister,
WasmInstanceObject::kCEntryStubOffset));
// Initialize the JavaScript context with 0. CEntry will use it to // Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate. // set the current context on the isolate.
__ Move(kContextRegister, Smi::kZero); __ Move(kContextRegister, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy); __ CallRuntimeWithCEntry(Runtime::kWasmCompileLazy, ecx);
// The entrypoint address is the return value. // The entrypoint address is the return value.
__ mov(edi, kReturnRegister0); __ mov(edi, kReturnRegister0);
......
...@@ -2411,6 +2411,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { ...@@ -2411,6 +2411,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{ {
DontEmitDebugCodeScope no_debug_code(masm); // Avoid calls to Abort.
FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY); FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be // Save all parameter registers (see wasm-linkage.cc). They might be
...@@ -2424,10 +2425,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { ...@@ -2424,10 +2425,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// Pass the WASM instance as an explicit argument to WasmCompileLazy. // Pass the WASM instance as an explicit argument to WasmCompileLazy.
__ push(kWasmInstanceRegister); __ push(kWasmInstanceRegister);
// Load the correct CEntry builtin from the instance object.
__ lw(a2, FieldMemOperand(kWasmInstanceRegister,
WasmInstanceObject::kCEntryStubOffset));
// Initialize the JavaScript context with 0. CEntry will use it to // Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate. // set the current context on the isolate.
__ Move(kContextRegister, Smi::kZero); __ Move(kContextRegister, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy); __ CallRuntimeWithCEntry(Runtime::kWasmCompileLazy, a2);
// Restore registers. // Restore registers.
__ MultiPopFPU(fp_regs); __ MultiPopFPU(fp_regs);
......
...@@ -2428,6 +2428,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { ...@@ -2428,6 +2428,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{ {
DontEmitDebugCodeScope no_debug_code(masm); // Avoid calls to Abort.
FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY); FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be // Save all parameter registers (see wasm-linkage.cc). They might be
...@@ -2442,10 +2443,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { ...@@ -2442,10 +2443,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// Pass the WASM instance as an explicit argument to WasmCompileLazy. // Pass the WASM instance as an explicit argument to WasmCompileLazy.
__ push(kWasmInstanceRegister); __ push(kWasmInstanceRegister);
// Load the correct CEntry builtin from the instance object.
__ Ld(a2, FieldMemOperand(kWasmInstanceRegister,
WasmInstanceObject::kCEntryStubOffset));
// Initialize the JavaScript context with 0. CEntry will use it to // Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate. // set the current context on the isolate.
__ Move(kContextRegister, Smi::kZero); __ Move(kContextRegister, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy); __ CallRuntimeWithCEntry(Runtime::kWasmCompileLazy, a2);
// Restore registers. // Restore registers.
__ MultiPopFPU(fp_regs); __ MultiPopFPU(fp_regs);
......
...@@ -2427,6 +2427,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { ...@@ -2427,6 +2427,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{ {
DontEmitDebugCodeScope no_debug_code(masm); // Avoid calls to Abort.
FrameAndConstantPoolScope scope(masm, StackFrame::WASM_COMPILE_LAZY); FrameAndConstantPoolScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be // Save all parameter registers (see wasm-linkage.cc). They might be
...@@ -2441,10 +2442,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { ...@@ -2441,10 +2442,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// Pass the WASM instance as an explicit argument to WasmCompileLazy. // Pass the WASM instance as an explicit argument to WasmCompileLazy.
__ Push(kWasmInstanceRegister); __ Push(kWasmInstanceRegister);
// Load the correct CEntry builtin from the instance object.
__ LoadP(r5, FieldMemOperand(kWasmInstanceRegister,
WasmInstanceObject::kCEntryStubOffset));
// Initialize the JavaScript context with 0. CEntry will use it to // Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate. // set the current context on the isolate.
__ LoadSmiLiteral(cp, Smi::kZero); __ LoadSmiLiteral(cp, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy); __ CallRuntimeWithCEntry(Runtime::kWasmCompileLazy, r5;
// The entrypoint address is the return value. // The entrypoint address is the return value.
__ mr(r11, kReturnRegister0); __ mr(r11, kReturnRegister0);
......
...@@ -2441,6 +2441,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { ...@@ -2441,6 +2441,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{ {
DontEmitDebugCodeScope no_debug_code(masm); // Avoid calls to Abort.
FrameAndConstantPoolScope scope(masm, StackFrame::WASM_COMPILE_LAZY); FrameAndConstantPoolScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be // Save all parameter registers (see wasm-linkage.cc). They might be
...@@ -2457,10 +2458,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { ...@@ -2457,10 +2458,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// Pass the WASM instance as an explicit argument to WasmCompileLazy. // Pass the WASM instance as an explicit argument to WasmCompileLazy.
__ Push(kWasmInstanceRegister); __ Push(kWasmInstanceRegister);
// Load the correct CEntry builtin from the instance object.
__ LoadP(r4, FieldMemOperand(kWasmInstanceRegister,
WasmInstanceObject::kCEntryStubOffset));
// Initialize the JavaScript context with 0. CEntry will use it to // Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate. // set the current context on the isolate.
__ LoadSmiLiteral(cp, Smi::kZero); __ LoadSmiLiteral(cp, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy); __ CallRuntimeWithCEntry(Runtime::kWasmCompileLazy, r4);
// The entrypoint address is the return value. // The entrypoint address is the return value.
__ LoadRR(ip, r2); __ LoadRR(ip, r2);
......
...@@ -2488,6 +2488,7 @@ void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { ...@@ -2488,6 +2488,7 @@ void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{ {
DontEmitDebugCodeScope no_debug_code(masm); // Avoid calls to Abort.
FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY); FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be // Save all parameter registers (see wasm-linkage.cc). They might be
...@@ -2511,10 +2512,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { ...@@ -2511,10 +2512,13 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// Pass the WASM instance as an explicit argument to WasmCompileLazy. // Pass the WASM instance as an explicit argument to WasmCompileLazy.
__ Push(kWasmInstanceRegister); __ Push(kWasmInstanceRegister);
// Load the correct CEntry builtin from the instance object.
__ movp(rcx, FieldOperand(kWasmInstanceRegister,
WasmInstanceObject::kCEntryStubOffset));
// Initialize the JavaScript context with 0. CEntry will use it to // Initialize the JavaScript context with 0. CEntry will use it to
// set the current context on the isolate. // set the current context on the isolate.
__ Move(kContextRegister, Smi::kZero); __ Move(kContextRegister, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy); __ CallRuntimeWithCEntry(Runtime::kWasmCompileLazy, rcx);
// The entrypoint address is the return value. // The entrypoint address is the return value.
__ movq(r11, kReturnRegister0); __ movq(r11, kReturnRegister0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment