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 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 Code* WasmFrame::unchecked_code() const { | 1485 Code* WasmFrame::unchecked_code() const { |
1486 return static_cast<Code*>(isolate()->FindCodeObject(pc())); | 1486 return static_cast<Code*>(isolate()->FindCodeObject(pc())); |
1487 } | 1487 } |
1488 | 1488 |
1489 void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } | 1489 void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } |
1490 | 1490 |
1491 Address WasmFrame::GetCallerStackPointer() const { | 1491 Address WasmFrame::GetCallerStackPointer() const { |
1492 return fp() + ExitFrameConstants::kCallerSPOffset; | 1492 return fp() + ExitFrameConstants::kCallerSPOffset; |
1493 } | 1493 } |
1494 | 1494 |
1495 Object* WasmFrame::wasm_obj() const { | 1495 Object* WasmFrame::wasm_instance() const { |
1496 Object* ret = wasm::GetOwningWasmInstance(LookupCode()); | 1496 Object* ret = wasm::GetOwningWasmInstance(LookupCode()); |
1497 if (ret == nullptr) ret = *(isolate()->factory()->undefined_value()); | 1497 if (ret == nullptr) ret = *(isolate()->factory()->undefined_value()); |
1498 return ret; | 1498 return ret; |
1499 } | 1499 } |
1500 | 1500 |
1501 uint32_t WasmFrame::function_index() const { | 1501 uint32_t WasmFrame::function_index() const { |
1502 FixedArray* deopt_data = LookupCode()->deoptimization_data(); | 1502 FixedArray* deopt_data = LookupCode()->deoptimization_data(); |
1503 DCHECK(deopt_data->length() == 2); | 1503 DCHECK(deopt_data->length() == 2); |
1504 return Smi::cast(deopt_data->get(1))->value(); | 1504 return Smi::cast(deopt_data->get(1))->value(); |
1505 } | 1505 } |
1506 | 1506 |
1507 Script* WasmFrame::script() const { | 1507 Script* WasmFrame::script() const { |
1508 Handle<JSObject> wasm(JSObject::cast(wasm_obj()), isolate()); | 1508 Handle<JSObject> instance(JSObject::cast(wasm_instance()), isolate()); |
1509 if (wasm::WasmIsAsmJs(*wasm, isolate())) { | 1509 if (wasm::WasmIsAsmJs(*instance, isolate())) { |
1510 return *wasm::GetAsmWasmScript(wasm); | 1510 return *wasm::GetAsmWasmScript(instance); |
1511 } | 1511 } |
1512 Handle<wasm::WasmDebugInfo> debug_info = wasm::GetDebugInfo(wasm); | 1512 Handle<wasm::WasmDebugInfo> debug_info = wasm::GetDebugInfo(instance); |
1513 return wasm::WasmDebugInfo::GetFunctionScript(debug_info, function_index()); | 1513 return wasm::WasmDebugInfo::GetFunctionScript(debug_info, function_index()); |
1514 } | 1514 } |
1515 | 1515 |
1516 int WasmFrame::position() const { | 1516 int WasmFrame::position() const { |
1517 int position = StandardFrame::position(); | 1517 int position = StandardFrame::position(); |
1518 if (wasm::WasmIsAsmJs(wasm_obj(), isolate())) { | 1518 if (wasm::WasmIsAsmJs(wasm_instance(), isolate())) { |
1519 Handle<JSObject> wasm(JSObject::cast(wasm_obj()), isolate()); | 1519 Handle<JSObject> instance(JSObject::cast(wasm_instance()), isolate()); |
1520 position = wasm::GetAsmWasmSourcePosition(wasm, function_index(), position); | 1520 position = |
| 1521 wasm::GetAsmWasmSourcePosition(instance, function_index(), position); |
1521 } | 1522 } |
1522 return position; | 1523 return position; |
1523 } | 1524 } |
1524 | 1525 |
1525 int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) { | 1526 int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) { |
1526 DCHECK_NOT_NULL(stack_slots); | 1527 DCHECK_NOT_NULL(stack_slots); |
1527 Code* code = LookupCode(); | 1528 Code* code = LookupCode(); |
1528 HandlerTable* table = HandlerTable::cast(code->handler_table()); | 1529 HandlerTable* table = HandlerTable::cast(code->handler_table()); |
1529 int pc_offset = static_cast<int>(pc() - code->entry()); | 1530 int pc_offset = static_cast<int>(pc() - code->entry()); |
1530 *stack_slots = code->stack_slots(); | 1531 *stack_slots = code->stack_slots(); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1963 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1963 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1964 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1964 list.Add(frame, zone); | 1965 list.Add(frame, zone); |
1965 } | 1966 } |
1966 return list.ToVector(); | 1967 return list.ToVector(); |
1967 } | 1968 } |
1968 | 1969 |
1969 | 1970 |
1970 } // namespace internal | 1971 } // namespace internal |
1971 } // namespace v8 | 1972 } // namespace v8 |
OLD | NEW |