| Index: src/frames.cc
|
| diff --git a/src/frames.cc b/src/frames.cc
|
| index 2a1a26461d3b032b0efd5afa995cc363e20762e5..98feb034ad66257cdea4cbca76858bfedecd705f 100644
|
| --- a/src/frames.cc
|
| +++ b/src/frames.cc
|
| @@ -617,21 +617,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,32 +1327,52 @@ 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::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);
|
| -}
|
| -
|
| void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); }
|
|
|
| Address WasmFrame::GetCallerStackPointer() const {
|
| return fp() + ExitFrameConstants::kCallerSPOffset;
|
| }
|
|
|
| +Object* WasmFrame::wasm_obj(Handle<Code> code) {
|
| + DCHECK_IMPLIES(!code.is_null(), *code == LookupCode());
|
| + if (code.is_null()) code = Handle<Code>(LookupCode(), isolate());
|
| + Handle<FixedArray> deopt_data(code->deoptimization_data(), isolate());
|
| + DCHECK(deopt_data->length() == 2);
|
| + return deopt_data->get(0);
|
| +}
|
| +
|
| +uint32_t WasmFrame::function_index(Handle<Code> code) {
|
| + DCHECK_IMPLIES(!code.is_null(), *code == LookupCode());
|
| + if (code.is_null()) code = Handle<Code>(LookupCode(), isolate());
|
| + Handle<FixedArray> deopt_data(code->deoptimization_data(), isolate());
|
| + 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;
|
| +}
|
| +
|
| +Object* WasmFrame::function_name(Handle<Code> code) {
|
| + DCHECK_IMPLIES(!code.is_null(), *code == LookupCode());
|
| + if (code.is_null()) code = Handle<Code>(LookupCode(), isolate());
|
| + Object* wasm_obj_or_string = wasm_obj();
|
| + if (wasm_obj_or_string->IsString()) return wasm_obj_or_string;
|
| + DCHECK(wasm_obj_or_string->IsJSObject());
|
| + Handle<JSObject> wasm = handle(JSObject::cast(wasm_obj()));
|
| + MaybeHandle<Object> fun_names_prop = JSObject::GetDataProperty(
|
| + wasm, isolate()->factory()->InternalizeUtf8String(
|
| + Vector<const char>("function_names")));
|
| + Handle<FixedArray> func_names =
|
| + Handle<FixedArray>::cast(fun_names_prop.ToHandleChecked());
|
| + uint32_t func_index = function_index();
|
| + DCHECK(func_index < static_cast<uint32_t>(func_names->length()));
|
| + return func_names->get(func_index);
|
| +}
|
| +
|
| namespace {
|
|
|
|
|
|
|