Commit b2abe2cf authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Introduce specialized WasmCompileLazy frame type.

This makes the WasmCompileLazy builtin push a new WASM_COMPILE_LAZY
frame type. We can thereby remove the workaround to return a relocated
instance from the underlying runtime function. It also removes the last
remaining embedded code objects from {WasmCode} objects.

R=titzer@chromium.org

Change-Id: Ic9c3f59339e8d7bed53ea0ed70ef50dfe640f1c6
Reviewed-on: https://chromium-review.googlesource.com/1073455
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53405}
parent 661768cf
......@@ -30,6 +30,19 @@ class ExitFrameConstants : public TypedFrameConstants {
static constexpr int kCallerSPDisplacement = 2 * kPointerSize;
};
class WasmCompileLazyFrameConstants : public TypedFrameConstants {
public:
static constexpr int kNumberOfSavedGpParamRegs = 4;
static constexpr int kNumberOfSavedFpParamRegs = 8;
// FP-relative.
static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kFixedFrameSizeFromFp =
TypedFrameConstants::kFixedFrameSizeFromFp +
kNumberOfSavedGpParamRegs * kPointerSize +
kNumberOfSavedFpParamRegs * kDoubleSize;
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
......
......@@ -46,6 +46,19 @@ class ExitFrameConstants : public TypedFrameConstants {
static constexpr int kConstantPoolOffset = 0; // Not used
};
class WasmCompileLazyFrameConstants : public TypedFrameConstants {
public:
static constexpr int kNumberOfSavedGpParamRegs = 8;
static constexpr int kNumberOfSavedFpParamRegs = 8;
// FP-relative.
static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kFixedFrameSizeFromFp =
TypedFrameConstants::kFixedFrameSizeFromFp +
kNumberOfSavedGpParamRegs * kPointerSize +
kNumberOfSavedFpParamRegs * kDoubleSize;
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
......
......@@ -2502,11 +2502,12 @@ void TurboAssembler::EnterFrame(StackFrame::Type type) {
Mov(type_reg, StackFrame::TypeToMarker(type));
Push(lr, fp, type_reg, code_reg);
Add(fp, sp, InternalFrameConstants::kFixedFrameSizeFromFp);
// sp[4] : lr
// sp[3] : fp
// sp[3] : lr
// sp[2] : fp
// sp[1] : type
// sp[0] : [code object]
} else if (type == StackFrame::WASM_COMPILED) {
} else if (type == StackFrame::WASM_COMPILED ||
type == StackFrame::WASM_COMPILE_LAZY) {
Register type_reg = temps.AcquireX();
Mov(type_reg, StackFrame::TypeToMarker(type));
Push(lr, fp);
......@@ -2536,15 +2537,10 @@ void TurboAssembler::EnterFrame(StackFrame::Type type) {
}
void TurboAssembler::LeaveFrame(StackFrame::Type type) {
if (type == StackFrame::WASM_COMPILED) {
Mov(sp, fp);
Pop(fp, lr);
} else {
// Drop the execution stack down to the frame pointer and restore
// the caller frame pointer and return address.
Mov(sp, fp);
Pop(fp, lr);
}
// Drop the execution stack down to the frame pointer and restore
// the caller frame pointer and return address.
Mov(sp, fp);
Pop(fp, lr);
}
......
......@@ -2552,12 +2552,12 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
FrameAndConstantPoolScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be
// overwritten in the runtime call below. We don't have any callee-saved
// registers in wasm, so no need to store anything else.
constexpr RegList gp_regs = Register::ListOf<r0, r1, r2>();
constexpr RegList gp_regs = Register::ListOf<r0, r1, r2, r3>();
constexpr DwVfpRegister lowest_fp_reg = d0;
constexpr DwVfpRegister highest_fp_reg = d7;
......@@ -2570,10 +2570,8 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// set the current context on the isolate.
__ Move(cp, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy);
// The entrypoint address is the first return value.
// The entrypoint address is the return value.
__ mov(r8, kReturnRegister0);
// The WASM instance is the second return value.
__ mov(kWasmInstanceRegister, kReturnRegister1);
// Restore registers.
__ vldm(ia_w, sp, lowest_fp_reg, highest_fp_reg);
......
......@@ -3008,17 +3008,17 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be
// overwritten in the runtime call below. We don't have any callee-saved
// registers in wasm, so no need to store anything else.
constexpr RegList gp_regs = Register::ListOf<x0, x1, x2, x3, x4, x5>();
constexpr RegList gp_regs =
Register::ListOf<x0, x1, x2, x3, x4, x5, x6, x7>();
constexpr RegList fp_regs =
Register::ListOf<d0, d1, d2, d3, d4, d5, d6, d7>();
__ PushXRegList(gp_regs);
__ PushDRegList(fp_regs);
__ Push(x5, x6); // note: pushed twice because alignment required
// Pass the WASM instance as an explicit argument to WasmCompileLazy.
__ PushArgument(kWasmInstanceRegister);
......@@ -3026,13 +3026,10 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// set the current context on the isolate.
__ Move(cp, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy);
// The entrypoint address is the first return value.
// The entrypoint address is the return value.
__ mov(x8, kReturnRegister0);
// The WASM instance is the second return value.
__ mov(kWasmInstanceRegister, kReturnRegister1);
// Restore registers.
__ Pop(x6, x5); // note: pushed twice because alignment required
__ PopDRegList(fp_regs);
__ PopXRegList(gp_regs);
}
......
......@@ -2747,20 +2747,25 @@ void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be
// overwritten in the runtime call below. We don't have any callee-saved
// registers in wasm, so no need to store anything else.
static_assert(WasmCompileLazyFrameConstants::kNumberOfSavedGpParamRegs ==
arraysize(wasm::kGpParamRegisters),
"frame size mismatch");
for (Register reg : wasm::kGpParamRegisters) {
if (reg == kWasmInstanceRegister) continue;
__ Push(reg);
}
__ sub(esp, Immediate(16 * arraysize(wasm::kFpParamRegisters)));
static_assert(WasmCompileLazyFrameConstants::kNumberOfSavedFpParamRegs ==
arraysize(wasm::kFpParamRegisters),
"frame size mismatch");
__ sub(esp, Immediate(kSimd128Size * arraysize(wasm::kFpParamRegisters)));
int offset = 0;
for (DoubleRegister reg : wasm::kFpParamRegisters) {
__ movdqu(Operand(esp, offset), reg);
offset += 16;
offset += kSimd128Size;
}
// Pass the WASM instance as an explicit argument to WasmCompileLazy.
......@@ -2769,20 +2774,17 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// set the current context on the isolate.
__ Move(kContextRegister, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy);
// The entrypoint address is the first return value.
// The entrypoint address is the return value.
__ mov(edi, kReturnRegister0);
// The WASM instance is the second return value.
__ mov(kWasmInstanceRegister, kReturnRegister1);
// Restore registers.
for (DoubleRegister reg : base::Reversed(wasm::kFpParamRegisters)) {
offset -= 16;
offset -= kSimd128Size;
__ movdqu(reg, Operand(esp, offset));
}
DCHECK_EQ(0, offset);
__ add(esp, Immediate(16 * arraysize(wasm::kFpParamRegisters)));
__ add(esp, Immediate(kSimd128Size * arraysize(wasm::kFpParamRegisters)));
for (Register reg : base::Reversed(wasm::kGpParamRegisters)) {
if (reg == kWasmInstanceRegister) continue;
__ Pop(reg);
}
}
......
......@@ -2609,12 +2609,12 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be
// overwritten in the runtime call below. We don't have any callee-saved
// registers in wasm, so no need to store anything else.
constexpr RegList gp_regs = Register::ListOf<a1, a2, a3>();
constexpr RegList gp_regs = Register::ListOf<a0, a1, a2, a3>();
constexpr RegList fp_regs =
DoubleRegister::ListOf<f2, f4, f6, f8, f10, f12, f14>();
__ MultiPush(gp_regs);
......@@ -2626,8 +2626,6 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// set the current context on the isolate.
__ Move(kContextRegister, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy);
// The WASM instance is the second return value.
__ mov(kWasmInstanceRegister, kReturnRegister1);
// Restore registers.
__ MultiPopFPU(fp_regs);
......
......@@ -2626,12 +2626,13 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be
// overwritten in the runtime call below. We don't have any callee-saved
// registers in wasm, so no need to store anything else.
constexpr RegList gp_regs = Register::ListOf<a1, a2, a3, a4, a5, a6, a7>();
constexpr RegList gp_regs =
Register::ListOf<a0, a1, a2, a3, a4, a5, a6, a7>();
constexpr RegList fp_regs =
DoubleRegister::ListOf<f2, f4, f6, f8, f10, f12, f14>();
__ MultiPush(gp_regs);
......@@ -2643,8 +2644,6 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// set the current context on the isolate.
__ Move(kContextRegister, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy);
// The WASM instance is the second return value.
__ mov(kWasmInstanceRegister, kReturnRegister1);
// Restore registers.
__ MultiPopFPU(fp_regs);
......
......@@ -2689,20 +2689,25 @@ void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
FrameScope scope(masm, StackFrame::WASM_COMPILE_LAZY);
// Save all parameter registers (see wasm-linkage.cc). They might be
// overwritten in the runtime call below. We don't have any callee-saved
// registers in wasm, so no need to store anything else.
static_assert(WasmCompileLazyFrameConstants::kNumberOfSavedGpParamRegs ==
arraysize(wasm::kGpParamRegisters),
"frame size mismatch");
for (Register reg : wasm::kGpParamRegisters) {
if (reg == kWasmInstanceRegister) continue;
__ Push(reg);
}
__ subp(rsp, Immediate(16 * arraysize(wasm::kFpParamRegisters)));
static_assert(WasmCompileLazyFrameConstants::kNumberOfSavedFpParamRegs ==
arraysize(wasm::kFpParamRegisters),
"frame size mismatch");
__ subp(rsp, Immediate(kSimd128Size * arraysize(wasm::kFpParamRegisters)));
int offset = 0;
for (DoubleRegister reg : wasm::kFpParamRegisters) {
__ movdqu(Operand(rsp, offset), reg);
offset += 16;
offset += kSimd128Size;
}
// Pass the WASM instance as an explicit argument to WasmCompileLazy.
......@@ -2711,20 +2716,17 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// set the current context on the isolate.
__ Move(kContextRegister, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy);
// The entrypoint address is the first return value.
// The entrypoint address is the return value.
__ movq(r11, kReturnRegister0);
// The WASM instance is the second return value.
__ movq(kWasmInstanceRegister, kReturnRegister1);
// Restore registers.
for (DoubleRegister reg : base::Reversed(wasm::kFpParamRegisters)) {
offset -= 16;
offset -= kSimd128Size;
__ movdqu(reg, Operand(rsp, offset));
}
DCHECK_EQ(0, offset);
__ addp(rsp, Immediate(16 * arraysize(wasm::kFpParamRegisters)));
__ addp(rsp, Immediate(kSimd128Size * arraysize(wasm::kFpParamRegisters)));
for (Register reg : base::Reversed(wasm::kGpParamRegisters)) {
if (reg == kWasmInstanceRegister) continue;
__ Pop(reg);
}
}
......
......@@ -209,6 +209,10 @@ inline JsToWasmFrame::JsToWasmFrame(StackFrameIteratorBase* iterator)
inline CWasmEntryFrame::CWasmEntryFrame(StackFrameIteratorBase* iterator)
: StubFrame(iterator) {}
inline WasmCompileLazyFrame::WasmCompileLazyFrame(
StackFrameIteratorBase* iterator)
: StandardFrame(iterator) {}
inline InternalFrame::InternalFrame(StackFrameIteratorBase* iterator)
: StandardFrame(iterator) {
}
......
......@@ -465,8 +465,7 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
case wasm::WasmCode::kFunction:
return WASM_COMPILED;
case wasm::WasmCode::kLazyStub:
if (StackFrame::IsTypeMarker(marker)) break;
return BUILTIN;
return WASM_COMPILE_LAZY;
case wasm::WasmCode::kWasmToJsWrapper:
return WASM_TO_JS;
default:
......@@ -876,6 +875,7 @@ void StandardFrame::IterateCompiledFrame(RootVisitor* v) const {
case WASM_TO_JS:
case WASM_COMPILED:
case WASM_INTERPRETER_ENTRY:
case WASM_COMPILE_LAZY:
frame_header_size = WasmCompiledFrameConstants::kFixedFrameSizeFromFp;
break;
case OPTIMIZED:
......@@ -1920,6 +1920,27 @@ Address WasmInterpreterEntryFrame::GetCallerStackPointer() const {
return fp() + ExitFrameConstants::kCallerSPOffset;
}
WasmInstanceObject* WasmCompileLazyFrame::wasm_instance() const {
return WasmInstanceObject::cast(*wasm_instance_slot());
}
Object** WasmCompileLazyFrame::wasm_instance_slot() const {
const int offset = WasmCompileLazyFrameConstants::kWasmInstanceOffset;
return &Memory::Object_at(fp() + offset);
}
void WasmCompileLazyFrame::Iterate(RootVisitor* v) const {
const int header_size = WasmCompileLazyFrameConstants::kFixedFrameSizeFromFp;
Object** base = &Memory::Object_at(sp());
Object** limit = &Memory::Object_at(fp() - header_size);
v->VisitRootPointers(Root::kTop, nullptr, base, limit);
v->VisitRootPointer(Root::kTop, nullptr, wasm_instance_slot());
}
Address WasmCompileLazyFrame::GetCallerStackPointer() const {
return fp() + WasmCompileLazyFrameConstants::kCallerSPOffset;
}
namespace {
......@@ -2123,21 +2144,15 @@ void JavaScriptFrame::Iterate(RootVisitor* v) const {
}
void InternalFrame::Iterate(RootVisitor* v) const {
wasm::WasmCode* wasm_code =
isolate()->wasm_engine()->code_manager()->LookupCode(pc());
if (wasm_code != nullptr) {
DCHECK(wasm_code->kind() == wasm::WasmCode::kLazyStub);
} else {
Code* code = LookupCode();
IteratePc(v, pc_address(), constant_pool_address(), code);
// Internal frames typically do not receive any arguments, hence their stack
// only contains tagged pointers.
// We are misusing the has_tagged_params flag here to tell us whether
// the full stack frame contains only tagged pointers or only raw values.
// This is used for the WasmCompileLazy builtin, where we actually pass
// untagged arguments and also store untagged values on the stack.
if (code->has_tagged_params()) IterateExpressions(v);
}
Code* code = LookupCode();
IteratePc(v, pc_address(), constant_pool_address(), code);
// Internal frames typically do not receive any arguments, hence their stack
// only contains tagged pointers.
// We are misusing the has_tagged_params flag here to tell us whether
// the full stack frame contains only tagged pointers or only raw values.
// This is used for the WasmCompileLazy builtin, where we actually pass
// untagged arguments and also store untagged values on the stack.
if (code->has_tagged_params()) IterateExpressions(v);
}
// -------------------------------------------------------------------------
......
......@@ -96,6 +96,7 @@ class StackHandler BASE_EMBEDDED {
V(JS_TO_WASM, JsToWasmFrame) \
V(WASM_INTERPRETER_ENTRY, WasmInterpreterEntryFrame) \
V(C_WASM_ENTRY, CWasmEntryFrame) \
V(WASM_COMPILE_LAZY, WasmCompileLazyFrame) \
V(INTERPRETED, InterpretedFrame) \
V(STUB, StubFrame) \
V(BUILTIN_CONTINUATION, BuiltinContinuationFrame) \
......@@ -201,6 +202,7 @@ class StackFrame BASE_EMBEDDED {
bool is_optimized() const { return type() == OPTIMIZED; }
bool is_interpreted() const { return type() == INTERPRETED; }
bool is_wasm_compiled() const { return type() == WASM_COMPILED; }
bool is_wasm_compile_lazy() const { return type() == WASM_COMPILE_LAZY; }
bool is_wasm_to_js() const { return type() == WASM_TO_JS; }
bool is_js_to_wasm() const { return type() == JS_TO_WASM; }
bool is_wasm_interpreter_entry() const {
......@@ -786,10 +788,6 @@ class JavaScriptFrame : public StandardFrame {
virtual int GetNumberOfIncomingArguments() const;
// Garbage collection support. Iterates over incoming arguments,
// receiver, and any callee-saved registers.
void IterateArguments(RootVisitor* v) const;
virtual void PrintFrameKind(StringStream* accumulator) const {}
private:
......@@ -1077,6 +1075,31 @@ class CWasmEntryFrame : public StubFrame {
friend class StackFrameIteratorBase;
};
class WasmCompileLazyFrame : public StandardFrame {
public:
Type type() const override { return WASM_COMPILE_LAZY; }
Code* unchecked_code() const override { return nullptr; }
WasmInstanceObject* wasm_instance() const;
Object** wasm_instance_slot() const;
// Garbage collection support.
void Iterate(RootVisitor* v) const override;
static WasmCompileLazyFrame* cast(StackFrame* frame) {
DCHECK(frame->is_wasm_compile_lazy());
return static_cast<WasmCompileLazyFrame*>(frame);
}
protected:
inline explicit WasmCompileLazyFrame(StackFrameIteratorBase* iterator);
Address GetCallerStackPointer() const override;
private:
friend class StackFrameIteratorBase;
};
class InternalFrame: public StandardFrame {
public:
Type type() const override { return INTERNAL; }
......
......@@ -35,6 +35,19 @@ class ExitFrameConstants : public TypedFrameConstants {
static constexpr int kConstantPoolOffset = 0; // Not used
};
class WasmCompileLazyFrameConstants : public TypedFrameConstants {
public:
static constexpr int kNumberOfSavedGpParamRegs = 5;
static constexpr int kNumberOfSavedFpParamRegs = 6;
// FP-relative.
static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kFixedFrameSizeFromFp =
TypedFrameConstants::kFixedFrameSizeFromFp +
kNumberOfSavedGpParamRegs * kPointerSize +
kNumberOfSavedFpParamRegs * kSimd128Size;
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
......
......@@ -34,6 +34,19 @@ class ExitFrameConstants : public TypedFrameConstants {
static constexpr int kConstantPoolOffset = 0; // Not used.
};
class WasmCompileLazyFrameConstants : public TypedFrameConstants {
public:
static constexpr int kNumberOfSavedGpParamRegs = 4;
static constexpr int kNumberOfSavedFpParamRegs = 7;
// FP-relative.
static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(3);
static constexpr int kFixedFrameSizeFromFp =
TypedFrameConstants::kFixedFrameSizeFromFp +
kNumberOfSavedGpParamRegs * kPointerSize +
kNumberOfSavedFpParamRegs * kDoubleSize;
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
......
......@@ -34,6 +34,19 @@ class ExitFrameConstants : public TypedFrameConstants {
static constexpr int kConstantPoolOffset = 0; // Not used.
};
class WasmCompileLazyFrameConstants : public TypedFrameConstants {
public:
static constexpr int kNumberOfSavedGpParamRegs = 8;
static constexpr int kNumberOfSavedFpParamRegs = 7;
// FP-relative.
static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(7);
static constexpr int kFixedFrameSizeFromFp =
TypedFrameConstants::kFixedFrameSizeFromFp +
kNumberOfSavedGpParamRegs * kPointerSize +
kNumberOfSavedFpParamRegs * kDoubleSize;
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
......
......@@ -289,19 +289,25 @@ RUNTIME_FUNCTION(Runtime_WasmStackGuard) {
return isolate->stack_guard()->HandleInterrupts();
}
RUNTIME_FUNCTION_RETURN_PAIR(Runtime_WasmCompileLazy) {
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance_on_stack, 0);
// TODO(titzer): The location on the stack is not visited by the
// roots visitor because the type of the frame is a special
// WASM builtin. Reopen the handle in a handle scope as a workaround.
RUNTIME_FUNCTION(Runtime_WasmCompileLazy) {
HandleScope scope(isolate);
Handle<WasmInstanceObject> instance(*instance_on_stack, isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
ClearThreadInWasmScope wasm_flag(true);
#ifdef DEBUG
StackFrameIterator it(isolate, isolate->thread_local_top());
// On top: C entry stub.
DCHECK_EQ(StackFrame::EXIT, it.frame()->type());
it.Advance();
// Next: the wasm lazy compile frame.
DCHECK_EQ(StackFrame::WASM_COMPILE_LAZY, it.frame()->type());
DCHECK_EQ(*instance, WasmCompileLazyFrame::cast(it.frame())->wasm_instance());
#endif
Address entrypoint = wasm::CompileLazy(isolate, instance);
return MakePair(reinterpret_cast<Object*>(entrypoint), *instance);
return reinterpret_cast<Object*>(entrypoint);
}
} // namespace internal
......
......@@ -639,10 +639,10 @@ namespace internal {
F(WasmStackGuard, 0, 1) \
F(WasmThrow, 0, 1) \
F(WasmThrowCreate, 2, 1) \
F(WasmThrowTypeError, 0, 1)
F(WasmThrowTypeError, 0, 1) \
F(WasmCompileLazy, 1, 1)
#define FOR_EACH_INTRINSIC_RETURN_PAIR(F) \
F(WasmCompileLazy, 1, 2) \
F(DebugBreakOnBytecode, 1, 2) \
F(LoadLookupSlotForCall, 1, 2)
......
......@@ -279,7 +279,7 @@ void WasmCode::Validate() const {
break;
case RelocInfo::EMBEDDED_OBJECT: {
HeapObject* o = it.rinfo()->target_object();
DCHECK(o->IsUndefined(o->GetIsolate()) || o->IsCode());
DCHECK(o->IsUndefined(o->GetIsolate()));
break;
}
default:
......
......@@ -40,6 +40,19 @@ class ExitFrameConstants : public TypedFrameConstants {
static constexpr int kConstantPoolOffset = 0; // Not used
};
class WasmCompileLazyFrameConstants : public TypedFrameConstants {
public:
static constexpr int kNumberOfSavedGpParamRegs = 6;
static constexpr int kNumberOfSavedFpParamRegs = 6;
// FP-relative.
static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kFixedFrameSizeFromFp =
TypedFrameConstants::kFixedFrameSizeFromFp +
kNumberOfSavedGpParamRegs * kPointerSize +
kNumberOfSavedFpParamRegs * kSimd128Size;
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
......
......@@ -359,6 +359,7 @@ FRAME_MARKERS = (
"JS_TO_WASM",
"WASM_INTERPRETER_ENTRY",
"C_WASM_ENTRY",
"WASM_COMPILE_LAZY",
"INTERPRETED",
"STUB",
"BUILTIN_CONTINUATION",
......
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