| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 // linkage are actually generated with TurboFan currently, so | 461 // linkage are actually generated with TurboFan currently, so |
| 462 // this is sound). | 462 // this is sound). |
| 463 return OPTIMIZED; | 463 return OPTIMIZED; |
| 464 } | 464 } |
| 465 return BUILTIN; | 465 return BUILTIN; |
| 466 case Code::FUNCTION: | 466 case Code::FUNCTION: |
| 467 return JAVA_SCRIPT; | 467 return JAVA_SCRIPT; |
| 468 case Code::OPTIMIZED_FUNCTION: | 468 case Code::OPTIMIZED_FUNCTION: |
| 469 return OPTIMIZED; | 469 return OPTIMIZED; |
| 470 case Code::WASM_FUNCTION: | 470 case Code::WASM_FUNCTION: |
| 471 return WASM; | 471 return WASM_COMPILED; |
| 472 case Code::WASM_TO_JS_FUNCTION: | 472 case Code::WASM_TO_JS_FUNCTION: |
| 473 return WASM_TO_JS; | 473 return WASM_TO_JS; |
| 474 case Code::JS_TO_WASM_FUNCTION: | 474 case Code::JS_TO_WASM_FUNCTION: |
| 475 return JS_TO_WASM; | 475 return JS_TO_WASM; |
| 476 case Code::WASM_INTERPRETER_ENTRY: |
| 477 return WASM_INTERPRETER_ENTRY; |
| 476 default: | 478 default: |
| 477 // All other types should have an explicit marker | 479 // All other types should have an explicit marker |
| 478 break; | 480 break; |
| 479 } | 481 } |
| 480 } else { | 482 } else { |
| 481 return NONE; | 483 return NONE; |
| 482 } | 484 } |
| 483 } | 485 } |
| 484 | 486 |
| 485 DCHECK(marker->IsSmi()); | 487 DCHECK(marker->IsSmi()); |
| 486 StackFrame::Type candidate = | 488 StackFrame::Type candidate = |
| 487 static_cast<StackFrame::Type>(Smi::cast(marker)->value()); | 489 static_cast<StackFrame::Type>(Smi::cast(marker)->value()); |
| 488 switch (candidate) { | 490 switch (candidate) { |
| 489 case ENTRY: | 491 case ENTRY: |
| 490 case ENTRY_CONSTRUCT: | 492 case ENTRY_CONSTRUCT: |
| 491 case EXIT: | 493 case EXIT: |
| 492 case BUILTIN_EXIT: | 494 case BUILTIN_EXIT: |
| 493 case STUB: | 495 case STUB: |
| 494 case STUB_FAILURE_TRAMPOLINE: | 496 case STUB_FAILURE_TRAMPOLINE: |
| 495 case INTERNAL: | 497 case INTERNAL: |
| 496 case CONSTRUCT: | 498 case CONSTRUCT: |
| 497 case ARGUMENTS_ADAPTOR: | 499 case ARGUMENTS_ADAPTOR: |
| 498 case WASM_TO_JS: | 500 case WASM_TO_JS: |
| 499 case WASM: | 501 case WASM_COMPILED: |
| 500 return candidate; | 502 return candidate; |
| 501 case JS_TO_WASM: | 503 case JS_TO_WASM: |
| 502 case JAVA_SCRIPT: | 504 case JAVA_SCRIPT: |
| 503 case OPTIMIZED: | 505 case OPTIMIZED: |
| 504 case INTERPRETED: | 506 case INTERPRETED: |
| 505 default: | 507 default: |
| 506 // Unoptimized and optimized JavaScript frames, including | 508 // Unoptimized and optimized JavaScript frames, including |
| 507 // interpreted frames, should never have a StackFrame::Type | 509 // interpreted frames, should never have a StackFrame::Type |
| 508 // marker. If we find one, we're likely being called from the | 510 // marker. If we find one, we're likely being called from the |
| 509 // profiler in a bogus stack frame. | 511 // profiler in a bogus stack frame. |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 755 } |
| 754 | 756 |
| 755 | 757 |
| 756 void StandardFrame::SetCallerFp(Address caller_fp) { | 758 void StandardFrame::SetCallerFp(Address caller_fp) { |
| 757 Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset) = | 759 Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset) = |
| 758 caller_fp; | 760 caller_fp; |
| 759 } | 761 } |
| 760 | 762 |
| 761 bool StandardFrame::IsConstructor() const { return false; } | 763 bool StandardFrame::IsConstructor() const { return false; } |
| 762 | 764 |
| 765 void StandardFrame::Summarize(List<FrameSummary>* functions, |
| 766 FrameSummary::Mode mode) const { |
| 767 // This should only be called on frames which override this method. |
| 768 UNREACHABLE(); |
| 769 } |
| 770 |
| 763 void StandardFrame::IterateCompiledFrame(ObjectVisitor* v) const { | 771 void StandardFrame::IterateCompiledFrame(ObjectVisitor* v) const { |
| 764 // Make sure that we're not doing "safe" stack frame iteration. We cannot | 772 // Make sure that we're not doing "safe" stack frame iteration. We cannot |
| 765 // possibly find pointers in optimized frames in that state. | 773 // possibly find pointers in optimized frames in that state. |
| 766 DCHECK(can_access_heap_objects()); | 774 DCHECK(can_access_heap_objects()); |
| 767 | 775 |
| 768 // Compute the safepoint information. | 776 // Compute the safepoint information. |
| 769 unsigned stack_slots = 0; | 777 unsigned stack_slots = 0; |
| 770 SafepointEntry safepoint_entry; | 778 SafepointEntry safepoint_entry; |
| 771 Code* code = StackFrame::GetSafepointData( | 779 Code* code = StackFrame::GetSafepointData( |
| 772 isolate(), pc(), &safepoint_entry, &stack_slots); | 780 isolate(), pc(), &safepoint_entry, &stack_slots); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 784 case ENTRY_CONSTRUCT: | 792 case ENTRY_CONSTRUCT: |
| 785 case EXIT: | 793 case EXIT: |
| 786 case BUILTIN_EXIT: | 794 case BUILTIN_EXIT: |
| 787 case STUB_FAILURE_TRAMPOLINE: | 795 case STUB_FAILURE_TRAMPOLINE: |
| 788 case ARGUMENTS_ADAPTOR: | 796 case ARGUMENTS_ADAPTOR: |
| 789 case STUB: | 797 case STUB: |
| 790 case INTERNAL: | 798 case INTERNAL: |
| 791 case CONSTRUCT: | 799 case CONSTRUCT: |
| 792 case JS_TO_WASM: | 800 case JS_TO_WASM: |
| 793 case WASM_TO_JS: | 801 case WASM_TO_JS: |
| 794 case WASM: | 802 case WASM_COMPILED: |
| 803 case WASM_INTERPRETER_ENTRY: |
| 795 frame_header_size = TypedFrameConstants::kFixedFrameSizeFromFp; | 804 frame_header_size = TypedFrameConstants::kFixedFrameSizeFromFp; |
| 796 break; | 805 break; |
| 797 case JAVA_SCRIPT: | 806 case JAVA_SCRIPT: |
| 798 case OPTIMIZED: | 807 case OPTIMIZED: |
| 799 case INTERPRETED: | 808 case INTERPRETED: |
| 800 case BUILTIN: | 809 case BUILTIN: |
| 801 // These frame types have a context, but they are actually stored | 810 // These frame types have a context, but they are actually stored |
| 802 // in the place on the stack that one finds the frame type. | 811 // in the place on the stack that one finds the frame type. |
| 803 UNREACHABLE(); | 812 UNREACHABLE(); |
| 804 break; | 813 break; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 IsConstructor(), mode); | 975 IsConstructor(), mode); |
| 967 functions->Add(summary); | 976 functions->Add(summary); |
| 968 } | 977 } |
| 969 | 978 |
| 970 JSFunction* JavaScriptFrame::function() const { | 979 JSFunction* JavaScriptFrame::function() const { |
| 971 return JSFunction::cast(function_slot_object()); | 980 return JSFunction::cast(function_slot_object()); |
| 972 } | 981 } |
| 973 | 982 |
| 974 Object* JavaScriptFrame::receiver() const { return GetParameter(-1); } | 983 Object* JavaScriptFrame::receiver() const { return GetParameter(-1); } |
| 975 | 984 |
| 976 Script* JavaScriptFrame::script() const { | |
| 977 return Script::cast(function()->shared()->script()); | |
| 978 } | |
| 979 | |
| 980 Object* JavaScriptFrame::context() const { | 985 Object* JavaScriptFrame::context() const { |
| 981 const int offset = StandardFrameConstants::kContextOffset; | 986 const int offset = StandardFrameConstants::kContextOffset; |
| 982 Object* maybe_result = Memory::Object_at(fp() + offset); | 987 Object* maybe_result = Memory::Object_at(fp() + offset); |
| 983 DCHECK(!maybe_result->IsSmi()); | 988 DCHECK(!maybe_result->IsSmi()); |
| 984 return maybe_result; | 989 return maybe_result; |
| 985 } | 990 } |
| 986 | 991 |
| 992 Script* JavaScriptFrame::script() const { |
| 993 return Script::cast(function()->shared()->script()); |
| 994 } |
| 995 |
| 987 int JavaScriptFrame::LookupExceptionHandlerInTable( | 996 int JavaScriptFrame::LookupExceptionHandlerInTable( |
| 988 int* stack_depth, HandlerTable::CatchPrediction* prediction) { | 997 int* stack_depth, HandlerTable::CatchPrediction* prediction) { |
| 989 DCHECK_EQ(0, LookupCode()->handler_table()->length()); | 998 DCHECK_EQ(0, LookupCode()->handler_table()->length()); |
| 990 DCHECK(!LookupCode()->is_optimized_code()); | 999 DCHECK(!LookupCode()->is_optimized_code()); |
| 991 return -1; | 1000 return -1; |
| 992 } | 1001 } |
| 993 | 1002 |
| 994 void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function, | 1003 void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function, |
| 995 AbstractCode* code, | 1004 AbstractCode* code, |
| 996 int code_offset, FILE* file, | 1005 int code_offset, FILE* file, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 function_(function), | 1136 function_(function), |
| 1128 abstract_code_(abstract_code), | 1137 abstract_code_(abstract_code), |
| 1129 code_offset_(code_offset), | 1138 code_offset_(code_offset), |
| 1130 is_constructor_(is_constructor) { | 1139 is_constructor_(is_constructor) { |
| 1131 DCHECK(abstract_code->IsBytecodeArray() || | 1140 DCHECK(abstract_code->IsBytecodeArray() || |
| 1132 Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION || | 1141 Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION || |
| 1133 CannotDeoptFromAsmCode(Code::cast(abstract_code), function) || | 1142 CannotDeoptFromAsmCode(Code::cast(abstract_code), function) || |
| 1134 mode == kApproximateSummary); | 1143 mode == kApproximateSummary); |
| 1135 } | 1144 } |
| 1136 | 1145 |
| 1137 FrameSummary FrameSummary::GetFirst(JavaScriptFrame* frame) { | 1146 FrameSummary FrameSummary::GetFirst(StandardFrame* frame) { |
| 1138 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); | 1147 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
| 1139 frame->Summarize(&frames); | 1148 frame->Summarize(&frames); |
| 1140 return frames.first(); | 1149 return frames.first(); |
| 1141 } | 1150 } |
| 1142 | 1151 |
| 1143 void FrameSummary::Print() { | 1152 void FrameSummary::Print() { |
| 1144 PrintF("receiver: "); | 1153 PrintF("receiver: "); |
| 1145 receiver_->ShortPrint(); | 1154 receiver_->ShortPrint(); |
| 1146 PrintF("\nfunction: "); | 1155 PrintF("\nfunction: "); |
| 1147 function_->shared()->DebugName()->ShortPrint(); | 1156 function_->shared()->DebugName()->ShortPrint(); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 return reinterpret_cast<Code*>(code); | 1524 return reinterpret_cast<Code*>(code); |
| 1516 } | 1525 } |
| 1517 | 1526 |
| 1518 | 1527 |
| 1519 void StackFrame::PrintIndex(StringStream* accumulator, | 1528 void StackFrame::PrintIndex(StringStream* accumulator, |
| 1520 PrintMode mode, | 1529 PrintMode mode, |
| 1521 int index) { | 1530 int index) { |
| 1522 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); | 1531 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); |
| 1523 } | 1532 } |
| 1524 | 1533 |
| 1525 void WasmFrame::Print(StringStream* accumulator, PrintMode mode, | 1534 void WasmCompiledFrame::Print(StringStream* accumulator, PrintMode mode, |
| 1526 int index) const { | 1535 int index) const { |
| 1527 PrintIndex(accumulator, mode, index); | 1536 PrintIndex(accumulator, mode, index); |
| 1528 accumulator->Add("WASM ["); | 1537 accumulator->Add("WASM ["); |
| 1529 Script* script = this->script(); | 1538 Script* script = this->script(); |
| 1530 accumulator->PrintName(script->name()); | 1539 accumulator->PrintName(script->name()); |
| 1531 int pc = static_cast<int>(this->pc() - LookupCode()->instruction_start()); | 1540 int pc = static_cast<int>(this->pc() - LookupCode()->instruction_start()); |
| 1532 Object* instance = this->wasm_instance(); | 1541 Object* instance = this->wasm_instance(); |
| 1533 Vector<const uint8_t> raw_func_name = | 1542 Vector<const uint8_t> raw_func_name = |
| 1534 WasmInstanceObject::cast(instance)->compiled_module()->GetRawFunctionName( | 1543 WasmInstanceObject::cast(instance)->compiled_module()->GetRawFunctionName( |
| 1535 this->function_index()); | 1544 this->function_index()); |
| 1536 const int kMaxPrintedFunctionName = 64; | 1545 const int kMaxPrintedFunctionName = 64; |
| 1537 char func_name[kMaxPrintedFunctionName + 1]; | 1546 char func_name[kMaxPrintedFunctionName + 1]; |
| 1538 int func_name_len = std::min(kMaxPrintedFunctionName, raw_func_name.length()); | 1547 int func_name_len = std::min(kMaxPrintedFunctionName, raw_func_name.length()); |
| 1539 memcpy(func_name, raw_func_name.start(), func_name_len); | 1548 memcpy(func_name, raw_func_name.start(), func_name_len); |
| 1540 func_name[func_name_len] = '\0'; | 1549 func_name[func_name_len] = '\0'; |
| 1541 accumulator->Add("], function #%u ('%s'), pc=%p, pos=%d\n", | 1550 accumulator->Add("], function #%u ('%s'), pc=%p, pos=%d\n", |
| 1542 this->function_index(), func_name, pc, this->position()); | 1551 this->function_index(), func_name, pc, this->position()); |
| 1543 if (mode != OVERVIEW) accumulator->Add("\n"); | 1552 if (mode != OVERVIEW) accumulator->Add("\n"); |
| 1544 } | 1553 } |
| 1545 | 1554 |
| 1546 Code* WasmFrame::unchecked_code() const { | 1555 Code* WasmCompiledFrame::unchecked_code() const { |
| 1547 return static_cast<Code*>(isolate()->FindCodeObject(pc())); | 1556 return isolate()->FindCodeObject(pc()); |
| 1548 } | 1557 } |
| 1549 | 1558 |
| 1550 void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } | 1559 void WasmCompiledFrame::Iterate(ObjectVisitor* v) const { |
| 1560 IterateCompiledFrame(v); |
| 1561 } |
| 1551 | 1562 |
| 1552 Address WasmFrame::GetCallerStackPointer() const { | 1563 Address WasmCompiledFrame::GetCallerStackPointer() const { |
| 1553 return fp() + ExitFrameConstants::kCallerSPOffset; | 1564 return fp() + ExitFrameConstants::kCallerSPOffset; |
| 1554 } | 1565 } |
| 1555 | 1566 |
| 1556 WasmInstanceObject* WasmFrame::wasm_instance() const { | 1567 WasmInstanceObject* WasmCompiledFrame::wasm_instance() const { |
| 1557 WasmInstanceObject* obj = wasm::GetOwningWasmInstance(LookupCode()); | 1568 WasmInstanceObject* obj = wasm::GetOwningWasmInstance(LookupCode()); |
| 1558 // This is a live stack frame; it must have a live instance. | 1569 // This is a live stack frame; it must have a live instance. |
| 1559 DCHECK_NOT_NULL(obj); | 1570 DCHECK_NOT_NULL(obj); |
| 1560 return obj; | 1571 return obj; |
| 1561 } | 1572 } |
| 1562 | 1573 |
| 1563 uint32_t WasmFrame::function_index() const { | 1574 uint32_t WasmCompiledFrame::function_index() const { |
| 1564 FixedArray* deopt_data = LookupCode()->deoptimization_data(); | 1575 FixedArray* deopt_data = LookupCode()->deoptimization_data(); |
| 1565 DCHECK(deopt_data->length() == 2); | 1576 DCHECK(deopt_data->length() == 2); |
| 1566 return Smi::cast(deopt_data->get(1))->value(); | 1577 return Smi::cast(deopt_data->get(1))->value(); |
| 1567 } | 1578 } |
| 1568 | 1579 |
| 1569 Script* WasmFrame::script() const { | 1580 Script* WasmCompiledFrame::script() const { |
| 1570 Handle<JSObject> instance(JSObject::cast(wasm_instance()), isolate()); | 1581 return wasm_instance()->compiled_module()->script(); |
| 1571 return *wasm::GetScript(instance); | |
| 1572 } | 1582 } |
| 1573 | 1583 |
| 1574 int WasmFrame::position() const { | 1584 int WasmCompiledFrame::position() const { |
| 1575 int position = StandardFrame::position(); | 1585 int position = StandardFrame::position(); |
| 1576 if (wasm_instance()->compiled_module()->is_asm_js()) { | 1586 if (wasm_instance()->compiled_module()->is_asm_js()) { |
| 1577 Handle<WasmCompiledModule> compiled_module( | 1587 Handle<WasmCompiledModule> compiled_module( |
| 1578 WasmInstanceObject::cast(wasm_instance())->compiled_module(), | 1588 WasmInstanceObject::cast(wasm_instance())->compiled_module(), |
| 1579 isolate()); | 1589 isolate()); |
| 1580 DCHECK_LE(0, position); | 1590 DCHECK_LE(0, position); |
| 1581 position = WasmCompiledModule::GetAsmJsSourcePosition( | 1591 position = WasmCompiledModule::GetAsmJsSourcePosition( |
| 1582 compiled_module, function_index(), static_cast<uint32_t>(position), | 1592 compiled_module, function_index(), static_cast<uint32_t>(position), |
| 1583 at_to_number_conversion()); | 1593 at_to_number_conversion()); |
| 1584 } | 1594 } |
| 1585 return position; | 1595 return position; |
| 1586 } | 1596 } |
| 1587 | 1597 |
| 1588 bool WasmFrame::at_to_number_conversion() const { | 1598 void WasmCompiledFrame::Summarize(List<FrameSummary>* functions, |
| 1599 FrameSummary::Mode mode) const { |
| 1600 // TODO(clemensh): Implement. |
| 1601 } |
| 1602 |
| 1603 bool WasmCompiledFrame::at_to_number_conversion() const { |
| 1589 // Check whether our callee is a WASM_TO_JS frame, and this frame is at the | 1604 // Check whether our callee is a WASM_TO_JS frame, and this frame is at the |
| 1590 // ToNumber conversion call. | 1605 // ToNumber conversion call. |
| 1591 Address callee_pc = reinterpret_cast<Address>(this->callee_pc()); | 1606 Address callee_pc = reinterpret_cast<Address>(this->callee_pc()); |
| 1592 Code* code = callee_pc ? isolate()->FindCodeObject(callee_pc) : nullptr; | 1607 Code* code = callee_pc ? isolate()->FindCodeObject(callee_pc) : nullptr; |
| 1593 if (!code || code->kind() != Code::WASM_TO_JS_FUNCTION) return false; | 1608 if (!code || code->kind() != Code::WASM_TO_JS_FUNCTION) return false; |
| 1594 int offset = static_cast<int>(callee_pc - code->instruction_start()); | 1609 int offset = static_cast<int>(callee_pc - code->instruction_start()); |
| 1595 int pos = AbstractCode::cast(code)->SourcePosition(offset); | 1610 int pos = AbstractCode::cast(code)->SourcePosition(offset); |
| 1596 DCHECK(pos == 0 || pos == 1); | 1611 DCHECK(pos == 0 || pos == 1); |
| 1597 // The imported call has position 0, ToNumber has position 1. | 1612 // The imported call has position 0, ToNumber has position 1. |
| 1598 return !!pos; | 1613 return !!pos; |
| 1599 } | 1614 } |
| 1600 | 1615 |
| 1601 int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) { | 1616 int WasmCompiledFrame::LookupExceptionHandlerInTable(int* stack_slots) { |
| 1602 DCHECK_NOT_NULL(stack_slots); | 1617 DCHECK_NOT_NULL(stack_slots); |
| 1603 Code* code = LookupCode(); | 1618 Code* code = LookupCode(); |
| 1604 HandlerTable* table = HandlerTable::cast(code->handler_table()); | 1619 HandlerTable* table = HandlerTable::cast(code->handler_table()); |
| 1605 int pc_offset = static_cast<int>(pc() - code->entry()); | 1620 int pc_offset = static_cast<int>(pc() - code->entry()); |
| 1606 *stack_slots = code->stack_slots(); | 1621 *stack_slots = code->stack_slots(); |
| 1607 return table->LookupReturn(pc_offset); | 1622 return table->LookupReturn(pc_offset); |
| 1608 } | 1623 } |
| 1609 | 1624 |
| 1625 void WasmInterpreterEntryFrame::Iterate(ObjectVisitor* v) const { |
| 1626 IterateCompiledFrame(v); |
| 1627 } |
| 1628 |
| 1629 void WasmInterpreterEntryFrame::Print(StringStream* accumulator, PrintMode mode, |
| 1630 int index) const { |
| 1631 PrintIndex(accumulator, mode, index); |
| 1632 accumulator->Add("WASM TO INTERPRETER ["); |
| 1633 Script* script = this->script(); |
| 1634 accumulator->PrintName(script->name()); |
| 1635 accumulator->Add("]"); |
| 1636 if (mode != OVERVIEW) accumulator->Add("\n"); |
| 1637 } |
| 1638 |
| 1639 void WasmInterpreterEntryFrame::Summarize(List<FrameSummary>* functions, |
| 1640 FrameSummary::Mode mode) const { |
| 1641 // TODO(clemensh): Implement this. |
| 1642 } |
| 1643 |
| 1644 Code* WasmInterpreterEntryFrame::unchecked_code() const { |
| 1645 return isolate()->FindCodeObject(pc()); |
| 1646 } |
| 1647 |
| 1648 WasmInstanceObject* WasmInterpreterEntryFrame::wasm_instance() const { |
| 1649 WasmInstanceObject* ret = wasm::GetOwningWasmInstance(LookupCode()); |
| 1650 // This is a live stack frame, there must be a live wasm instance available. |
| 1651 DCHECK_NOT_NULL(ret); |
| 1652 return ret; |
| 1653 } |
| 1654 |
| 1655 Script* WasmInterpreterEntryFrame::script() const { |
| 1656 return wasm_instance()->compiled_module()->script(); |
| 1657 } |
| 1658 |
| 1659 int WasmInterpreterEntryFrame::position() const { |
| 1660 // TODO(clemensh): Implement this. |
| 1661 return 0; |
| 1662 } |
| 1663 |
| 1664 Address WasmInterpreterEntryFrame::GetCallerStackPointer() const { |
| 1665 return fp() + ExitFrameConstants::kCallerSPOffset; |
| 1666 } |
| 1667 |
| 1610 namespace { | 1668 namespace { |
| 1611 | 1669 |
| 1612 | 1670 |
| 1613 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, | 1671 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, |
| 1614 Code* code) { | 1672 Code* code) { |
| 1615 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { | 1673 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { |
| 1616 std::ostringstream os; | 1674 std::ostringstream os; |
| 1617 os << "--------- s o u r c e c o d e ---------\n" | 1675 os << "--------- s o u r c e c o d e ---------\n" |
| 1618 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) | 1676 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) |
| 1619 << "\n-----------------------------------------\n"; | 1677 << "\n-----------------------------------------\n"; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2038 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 2096 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 2039 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 2097 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 2040 list.Add(frame, zone); | 2098 list.Add(frame, zone); |
| 2041 } | 2099 } |
| 2042 return list.ToVector(); | 2100 return list.ToVector(); |
| 2043 } | 2101 } |
| 2044 | 2102 |
| 2045 | 2103 |
| 2046 } // namespace internal | 2104 } // namespace internal |
| 2047 } // namespace v8 | 2105 } // namespace v8 |
| OLD | NEW |