| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/frames.h" | 5 #include "src/frames.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 Code* WasmFrame::unchecked_code() const { | 1551 Code* WasmFrame::unchecked_code() const { |
| 1552 return static_cast<Code*>(isolate()->FindCodeObject(pc())); | 1552 return static_cast<Code*>(isolate()->FindCodeObject(pc())); |
| 1553 } | 1553 } |
| 1554 | 1554 |
| 1555 void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } | 1555 void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } |
| 1556 | 1556 |
| 1557 Address WasmFrame::GetCallerStackPointer() const { | 1557 Address WasmFrame::GetCallerStackPointer() const { |
| 1558 return fp() + ExitFrameConstants::kCallerSPOffset; | 1558 return fp() + ExitFrameConstants::kCallerSPOffset; |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 Object* WasmFrame::wasm_instance() const { | 1561 WasmInstanceObject* WasmFrame::wasm_instance() const { |
| 1562 Object* ret = wasm::GetOwningWasmInstance(LookupCode()); | 1562 Object* ret = wasm::GetOwningWasmInstance(LookupCode()); |
| 1563 if (ret == nullptr) ret = isolate()->heap()->undefined_value(); | 1563 // This is a live stack frame, there must be a live wasm instance available. |
| 1564 return ret; | 1564 DCHECK_NOT_NULL(ret); |
| 1565 return WasmInstanceObject::cast(ret); |
| 1565 } | 1566 } |
| 1566 | 1567 |
| 1567 uint32_t WasmFrame::function_index() const { | 1568 uint32_t WasmFrame::function_index() const { |
| 1568 FixedArray* deopt_data = LookupCode()->deoptimization_data(); | 1569 FixedArray* deopt_data = LookupCode()->deoptimization_data(); |
| 1569 DCHECK(deopt_data->length() == 2); | 1570 DCHECK(deopt_data->length() == 2); |
| 1570 return Smi::cast(deopt_data->get(1))->value(); | 1571 return Smi::cast(deopt_data->get(1))->value(); |
| 1571 } | 1572 } |
| 1572 | 1573 |
| 1573 Script* WasmFrame::script() const { | 1574 Script* WasmFrame::script() const { |
| 1574 Handle<JSObject> instance(JSObject::cast(wasm_instance()), isolate()); | 1575 Handle<JSObject> instance(JSObject::cast(wasm_instance()), isolate()); |
| 1575 return *wasm::GetScript(instance); | 1576 return *wasm::GetScript(instance); |
| 1576 } | 1577 } |
| 1577 | 1578 |
| 1578 int WasmFrame::position() const { | 1579 int WasmFrame::position() const { |
| 1579 int position = StandardFrame::position(); | 1580 int position = StandardFrame::position(); |
| 1580 if (wasm::WasmIsAsmJs(wasm_instance(), isolate())) { | 1581 if (wasm_instance()->get_compiled_module()->is_asm_js()) { |
| 1581 Handle<WasmCompiledModule> compiled_module( | 1582 Handle<WasmCompiledModule> compiled_module( |
| 1582 WasmInstanceObject::cast(wasm_instance())->get_compiled_module(), | 1583 WasmInstanceObject::cast(wasm_instance())->get_compiled_module(), |
| 1583 isolate()); | 1584 isolate()); |
| 1584 DCHECK_LE(0, position); | 1585 DCHECK_LE(0, position); |
| 1585 position = WasmCompiledModule::GetAsmJsSourcePosition( | 1586 position = WasmCompiledModule::GetAsmJsSourcePosition( |
| 1586 compiled_module, function_index(), static_cast<uint32_t>(position), | 1587 compiled_module, function_index(), static_cast<uint32_t>(position), |
| 1587 at_to_number_conversion()); | 1588 at_to_number_conversion()); |
| 1588 } | 1589 } |
| 1589 return position; | 1590 return position; |
| 1590 } | 1591 } |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 2043 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 2043 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 2044 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 2044 list.Add(frame, zone); | 2045 list.Add(frame, zone); |
| 2045 } | 2046 } |
| 2046 return list.ToVector(); | 2047 return list.ToVector(); |
| 2047 } | 2048 } |
| 2048 | 2049 |
| 2049 | 2050 |
| 2050 } // namespace internal | 2051 } // namespace internal |
| 2051 } // namespace v8 | 2052 } // namespace v8 |
| OLD | NEW |