Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Unified Diff: src/frames.cc

Issue 2623773004: [wasm] Introduce WasmToInterpreterFrame (Closed)
Patch Set: Renaming Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index 9e7cbc80541cda9fb8a468df4d3b61268feed35f..755882ae8389f05806a06e1cfb2e6df2b745b962 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -468,11 +468,13 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
case Code::OPTIMIZED_FUNCTION:
return OPTIMIZED;
case Code::WASM_FUNCTION:
- return WASM;
+ return WASM_COMPILED;
case Code::WASM_TO_JS_FUNCTION:
return WASM_TO_JS;
case Code::JS_TO_WASM_FUNCTION:
return JS_TO_WASM;
+ case Code::WASM_INTERPRETER_ENTRY:
+ return WASM_INTERPRETER_ENTRY;
default:
// All other types should have an explicit marker
break;
@@ -496,7 +498,7 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
case CONSTRUCT:
case ARGUMENTS_ADAPTOR:
case WASM_TO_JS:
- case WASM:
+ case WASM_COMPILED:
return candidate;
case JS_TO_WASM:
case JAVA_SCRIPT:
@@ -760,6 +762,12 @@ void StandardFrame::SetCallerFp(Address caller_fp) {
bool StandardFrame::IsConstructor() const { return false; }
+void StandardFrame::Summarize(List<FrameSummary>* functions,
+ FrameSummary::Mode mode) const {
+ // This should only be called on frames which override this method.
+ UNREACHABLE();
+}
+
void StandardFrame::IterateCompiledFrame(ObjectVisitor* v) const {
// Make sure that we're not doing "safe" stack frame iteration. We cannot
// possibly find pointers in optimized frames in that state.
@@ -791,7 +799,8 @@ void StandardFrame::IterateCompiledFrame(ObjectVisitor* v) const {
case CONSTRUCT:
case JS_TO_WASM:
case WASM_TO_JS:
- case WASM:
+ case WASM_COMPILED:
+ case WASM_INTERPRETER_ENTRY:
frame_header_size = TypedFrameConstants::kFixedFrameSizeFromFp;
break;
case JAVA_SCRIPT:
@@ -973,10 +982,6 @@ JSFunction* JavaScriptFrame::function() const {
Object* JavaScriptFrame::receiver() const { return GetParameter(-1); }
-Script* JavaScriptFrame::script() const {
- return Script::cast(function()->shared()->script());
-}
-
Object* JavaScriptFrame::context() const {
const int offset = StandardFrameConstants::kContextOffset;
Object* maybe_result = Memory::Object_at(fp() + offset);
@@ -984,6 +989,10 @@ Object* JavaScriptFrame::context() const {
return maybe_result;
}
+Script* JavaScriptFrame::script() const {
+ return Script::cast(function()->shared()->script());
+}
+
int JavaScriptFrame::LookupExceptionHandlerInTable(
int* stack_depth, HandlerTable::CatchPrediction* prediction) {
DCHECK_EQ(0, LookupCode()->handler_table()->length());
@@ -1134,7 +1143,7 @@ FrameSummary::FrameSummary(Object* receiver, JSFunction* function,
mode == kApproximateSummary);
}
-FrameSummary FrameSummary::GetFirst(JavaScriptFrame* frame) {
+FrameSummary FrameSummary::GetFirst(StandardFrame* frame) {
List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
frame->Summarize(&frames);
return frames.first();
@@ -1522,8 +1531,8 @@ void StackFrame::PrintIndex(StringStream* accumulator,
accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index);
}
-void WasmFrame::Print(StringStream* accumulator, PrintMode mode,
- int index) const {
+void WasmCompiledFrame::Print(StringStream* accumulator, PrintMode mode,
+ int index) const {
PrintIndex(accumulator, mode, index);
accumulator->Add("WASM [");
Script* script = this->script();
@@ -1543,35 +1552,36 @@ void WasmFrame::Print(StringStream* accumulator, PrintMode mode,
if (mode != OVERVIEW) accumulator->Add("\n");
}
-Code* WasmFrame::unchecked_code() const {
- return static_cast<Code*>(isolate()->FindCodeObject(pc()));
+Code* WasmCompiledFrame::unchecked_code() const {
+ return isolate()->FindCodeObject(pc());
}
-void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); }
+void WasmCompiledFrame::Iterate(ObjectVisitor* v) const {
+ IterateCompiledFrame(v);
+}
-Address WasmFrame::GetCallerStackPointer() const {
+Address WasmCompiledFrame::GetCallerStackPointer() const {
return fp() + ExitFrameConstants::kCallerSPOffset;
}
-WasmInstanceObject* WasmFrame::wasm_instance() const {
+WasmInstanceObject* WasmCompiledFrame::wasm_instance() const {
WasmInstanceObject* obj = wasm::GetOwningWasmInstance(LookupCode());
// This is a live stack frame; it must have a live instance.
DCHECK_NOT_NULL(obj);
return obj;
}
-uint32_t WasmFrame::function_index() const {
+uint32_t WasmCompiledFrame::function_index() const {
FixedArray* deopt_data = LookupCode()->deoptimization_data();
DCHECK(deopt_data->length() == 2);
return Smi::cast(deopt_data->get(1))->value();
}
-Script* WasmFrame::script() const {
- Handle<JSObject> instance(JSObject::cast(wasm_instance()), isolate());
- return *wasm::GetScript(instance);
+Script* WasmCompiledFrame::script() const {
+ return wasm_instance()->compiled_module()->script();
}
-int WasmFrame::position() const {
+int WasmCompiledFrame::position() const {
int position = StandardFrame::position();
if (wasm_instance()->compiled_module()->is_asm_js()) {
Handle<WasmCompiledModule> compiled_module(
@@ -1585,7 +1595,12 @@ int WasmFrame::position() const {
return position;
}
-bool WasmFrame::at_to_number_conversion() const {
+void WasmCompiledFrame::Summarize(List<FrameSummary>* functions,
+ FrameSummary::Mode mode) const {
+ // TODO(clemensh): Implement.
+}
+
+bool WasmCompiledFrame::at_to_number_conversion() const {
// Check whether our callee is a WASM_TO_JS frame, and this frame is at the
// ToNumber conversion call.
Address callee_pc = reinterpret_cast<Address>(this->callee_pc());
@@ -1598,7 +1613,7 @@ bool WasmFrame::at_to_number_conversion() const {
return !!pos;
}
-int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) {
+int WasmCompiledFrame::LookupExceptionHandlerInTable(int* stack_slots) {
DCHECK_NOT_NULL(stack_slots);
Code* code = LookupCode();
HandlerTable* table = HandlerTable::cast(code->handler_table());
@@ -1607,6 +1622,49 @@ int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) {
return table->LookupReturn(pc_offset);
}
+void WasmInterpreterEntryFrame::Iterate(ObjectVisitor* v) const {
+ IterateCompiledFrame(v);
+}
+
+void WasmInterpreterEntryFrame::Print(StringStream* accumulator, PrintMode mode,
+ int index) const {
+ PrintIndex(accumulator, mode, index);
+ accumulator->Add("WASM TO INTERPRETER [");
+ Script* script = this->script();
+ accumulator->PrintName(script->name());
+ accumulator->Add("]");
+ if (mode != OVERVIEW) accumulator->Add("\n");
+}
+
+void WasmInterpreterEntryFrame::Summarize(List<FrameSummary>* functions,
+ FrameSummary::Mode mode) const {
+ // TODO(clemensh): Implement this.
+}
+
+Code* WasmInterpreterEntryFrame::unchecked_code() const {
+ return isolate()->FindCodeObject(pc());
+}
+
+WasmInstanceObject* WasmInterpreterEntryFrame::wasm_instance() const {
+ WasmInstanceObject* ret = wasm::GetOwningWasmInstance(LookupCode());
+ // This is a live stack frame, there must be a live wasm instance available.
+ DCHECK_NOT_NULL(ret);
+ return ret;
+}
+
+Script* WasmInterpreterEntryFrame::script() const {
+ return wasm_instance()->compiled_module()->script();
+}
+
+int WasmInterpreterEntryFrame::position() const {
+ // TODO(clemensh): Implement this.
+ return 0;
+}
+
+Address WasmInterpreterEntryFrame::GetCallerStackPointer() const {
+ return fp() + ExitFrameConstants::kCallerSPOffset;
+}
+
namespace {
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698