Chromium Code Reviews| Index: src/frames.cc |
| diff --git a/src/frames.cc b/src/frames.cc |
| index 2a1a26461d3b032b0efd5afa995cc363e20762e5..dea20d12cf231102f69891e4ac3dfdb06f738c7d 100644 |
| --- a/src/frames.cc |
| +++ b/src/frames.cc |
| @@ -16,6 +16,7 @@ |
| #include "src/safepoint-table.h" |
| #include "src/string-stream.h" |
| #include "src/vm-state-inl.h" |
| +#include "src/wasm/wasm-module.h" |
| namespace v8 { |
| namespace internal { |
| @@ -617,21 +618,6 @@ void ExitFrame::FillState(Address fp, Address sp, State* state) { |
| state->constant_pool_address = NULL; |
| } |
| -void StandardFrame::Summarize(List<FrameSummary>* functions, |
| - FrameSummary::Mode mode) const { |
| - DCHECK(functions->length() == 0); |
| - // default implementation: no summary added |
| -} |
| - |
| -JSFunction* StandardFrame::function() const { |
| - // this default implementation is overridden by JS and WASM frames |
| - return nullptr; |
| -} |
| - |
| -Object* StandardFrame::receiver() const { |
| - return isolate()->heap()->undefined_value(); |
| -} |
| - |
| Address StandardFrame::GetExpressionAddress(int n) const { |
| const int offset = StandardFrameConstants::kExpressionsOffset; |
| return fp() + offset - n * kPointerSize; |
| @@ -1342,30 +1328,36 @@ Code* WasmFrame::unchecked_code() const { |
| return static_cast<Code*>(isolate()->FindCodeObject(pc())); |
| } |
| -JSFunction* WasmFrame::function() const { |
| - // TODO(clemensh): generate the right JSFunctions once per wasm function and |
| - // cache them |
| - Factory* factory = isolate()->factory(); |
| - Handle<JSFunction> fun = |
| - factory->NewFunction(factory->NewStringFromAsciiChecked("<WASM>")); |
| - return *fun; |
| +void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } |
| + |
| +Address WasmFrame::GetCallerStackPointer() const { |
| + return fp() + ExitFrameConstants::kCallerSPOffset; |
| } |
| -void WasmFrame::Summarize(List<FrameSummary>* functions, |
| - FrameSummary::Mode mode) const { |
| - DCHECK(functions->length() == 0); |
| - Code* code = LookupCode(); |
| - int offset = static_cast<int>(pc() - code->instruction_start()); |
| - AbstractCode* abstract_code = AbstractCode::cast(code); |
| - Handle<JSFunction> fun(function(), isolate()); |
| - FrameSummary summary(receiver(), *fun, abstract_code, offset, false); |
| - functions->Add(summary); |
| +Object* WasmFrame::wasm_obj() { |
| + FixedArray* deopt_data = LookupCode()->deoptimization_data(); |
| + DCHECK(deopt_data->length() == 2); |
| + return deopt_data->get(0); |
| } |
| -void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } |
| +uint32_t WasmFrame::function_index() { |
| + FixedArray* deopt_data = LookupCode()->deoptimization_data(); |
| + DCHECK(deopt_data->length() == 2); |
| + Object* func_index_obj = deopt_data->get(1); |
| + if (func_index_obj->IsUndefined()) return static_cast<uint32_t>(-1); |
| + if (func_index_obj->IsSmi()) return Smi::cast(func_index_obj)->value(); |
| + DCHECK(func_index_obj->IsHeapNumber()); |
| + uint32_t val = static_cast<uint32_t>(-1); |
| + func_index_obj->ToUint32(&val); |
| + DCHECK(val != static_cast<uint32_t>(-1)); |
| + return val; |
| +} |
| -Address WasmFrame::GetCallerStackPointer() const { |
| - return fp() + ExitFrameConstants::kCallerSPOffset; |
| +Object* WasmFrame::function_name() { |
| + Object* wasm_obj_or_string = wasm_obj(); |
|
Yang
2016/05/04 19:02:21
is the name of this variable still accurate?
Clemens Hammacher
2016/05/05 12:29:16
No, sorry. Done.
|
| + if (wasm_obj_or_string->IsUndefined()) return wasm_obj_or_string; |
|
Yang
2016/05/04 19:02:22
I'm curious, in which case would wasm_obj() return
Clemens Hammacher
2016/05/05 12:29:16
Just in the tests. Where it was string or undefine
|
| + Handle<JSObject> wasm = handle(JSObject::cast(wasm_obj_or_string)); |
| + return *wasm::GetWasmFunctionName(wasm, function_index()); |
| } |
| namespace { |