| 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_TO_INTERPRETER: |
| 477 return WASM_TO_INTERPRETER; |
| 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_TO_INTERPRETER: |
| 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 Vector<const uint8_t> raw_func_name; | 1541 Vector<const uint8_t> raw_func_name; |
| 1533 Object* instance_or_undef = this->wasm_instance(); | 1542 Object* instance_or_undef = this->wasm_instance(); |
| 1534 if (instance_or_undef->IsUndefined(this->isolate())) { | 1543 if (instance_or_undef->IsUndefined(this->isolate())) { |
| 1535 raw_func_name = STATIC_CHAR_VECTOR("<undefined>"); | 1544 raw_func_name = STATIC_CHAR_VECTOR("<undefined>"); |
| 1536 } else { | 1545 } else { |
| 1537 raw_func_name = WasmInstanceObject::cast(instance_or_undef) | 1546 raw_func_name = WasmInstanceObject::cast(instance_or_undef) |
| 1538 ->compiled_module() | 1547 ->compiled_module() |
| 1539 ->GetRawFunctionName(this->function_index()); | 1548 ->GetRawFunctionName(this->function_index()); |
| 1540 } | 1549 } |
| 1541 const int kMaxPrintedFunctionName = 64; | 1550 const int kMaxPrintedFunctionName = 64; |
| 1542 char func_name[kMaxPrintedFunctionName + 1]; | 1551 char func_name[kMaxPrintedFunctionName + 1]; |
| 1543 int func_name_len = std::min(kMaxPrintedFunctionName, raw_func_name.length()); | 1552 int func_name_len = std::min(kMaxPrintedFunctionName, raw_func_name.length()); |
| 1544 memcpy(func_name, raw_func_name.start(), func_name_len); | 1553 memcpy(func_name, raw_func_name.start(), func_name_len); |
| 1545 func_name[func_name_len] = '\0'; | 1554 func_name[func_name_len] = '\0'; |
| 1546 accumulator->Add("], function #%u ('%s'), pc=%p, pos=%d\n", | 1555 accumulator->Add("], function #%u ('%s'), pc=%p, pos=%d\n", |
| 1547 this->function_index(), func_name, pc, this->position()); | 1556 this->function_index(), func_name, pc, this->position()); |
| 1548 if (mode != OVERVIEW) accumulator->Add("\n"); | 1557 if (mode != OVERVIEW) accumulator->Add("\n"); |
| 1549 } | 1558 } |
| 1550 | 1559 |
| 1551 Code* WasmFrame::unchecked_code() const { | 1560 Code* WasmCompiledFrame::unchecked_code() const { |
| 1552 return static_cast<Code*>(isolate()->FindCodeObject(pc())); | 1561 return isolate()->FindCodeObject(pc()); |
| 1553 } | 1562 } |
| 1554 | 1563 |
| 1555 void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } | 1564 void WasmCompiledFrame::Iterate(ObjectVisitor* v) const { |
| 1565 IterateCompiledFrame(v); |
| 1566 } |
| 1556 | 1567 |
| 1557 Address WasmFrame::GetCallerStackPointer() const { | 1568 Address WasmCompiledFrame::GetCallerStackPointer() const { |
| 1558 return fp() + ExitFrameConstants::kCallerSPOffset; | 1569 return fp() + ExitFrameConstants::kCallerSPOffset; |
| 1559 } | 1570 } |
| 1560 | 1571 |
| 1561 WasmInstanceObject* WasmFrame::wasm_instance() const { | 1572 WasmInstanceObject* WasmCompiledFrame::wasm_instance() const { |
| 1562 WasmInstanceObject* obj = wasm::GetOwningWasmInstance(LookupCode()); | 1573 WasmInstanceObject* obj = wasm::GetOwningWasmInstance(LookupCode()); |
| 1563 // This is a live stack frame; it must have a live instance. | 1574 // This is a live stack frame; it must have a live instance. |
| 1564 DCHECK_NOT_NULL(obj); | 1575 DCHECK_NOT_NULL(obj); |
| 1565 return obj; | 1576 return obj; |
| 1566 } | 1577 } |
| 1567 | 1578 |
| 1568 uint32_t WasmFrame::function_index() const { | 1579 uint32_t WasmCompiledFrame::function_index() const { |
| 1569 FixedArray* deopt_data = LookupCode()->deoptimization_data(); | 1580 FixedArray* deopt_data = LookupCode()->deoptimization_data(); |
| 1570 DCHECK(deopt_data->length() == 2); | 1581 DCHECK(deopt_data->length() == 2); |
| 1571 return Smi::cast(deopt_data->get(1))->value(); | 1582 return Smi::cast(deopt_data->get(1))->value(); |
| 1572 } | 1583 } |
| 1573 | 1584 |
| 1574 Script* WasmFrame::script() const { | 1585 Script* WasmCompiledFrame::script() const { |
| 1575 Handle<JSObject> instance(JSObject::cast(wasm_instance()), isolate()); | 1586 return wasm_instance()->compiled_module()->script(); |
| 1576 return *wasm::GetScript(instance); | |
| 1577 } | 1587 } |
| 1578 | 1588 |
| 1579 int WasmFrame::position() const { | 1589 int WasmCompiledFrame::position() const { |
| 1580 int position = StandardFrame::position(); | 1590 int position = StandardFrame::position(); |
| 1581 if (wasm_instance()->compiled_module()->is_asm_js()) { | 1591 if (wasm_instance()->compiled_module()->is_asm_js()) { |
| 1582 Handle<WasmCompiledModule> compiled_module( | 1592 Handle<WasmCompiledModule> compiled_module( |
| 1583 WasmInstanceObject::cast(wasm_instance())->compiled_module(), | 1593 WasmInstanceObject::cast(wasm_instance())->compiled_module(), |
| 1584 isolate()); | 1594 isolate()); |
| 1585 DCHECK_LE(0, position); | 1595 DCHECK_LE(0, position); |
| 1586 position = WasmCompiledModule::GetAsmJsSourcePosition( | 1596 position = WasmCompiledModule::GetAsmJsSourcePosition( |
| 1587 compiled_module, function_index(), static_cast<uint32_t>(position), | 1597 compiled_module, function_index(), static_cast<uint32_t>(position), |
| 1588 at_to_number_conversion()); | 1598 at_to_number_conversion()); |
| 1589 } | 1599 } |
| 1590 return position; | 1600 return position; |
| 1591 } | 1601 } |
| 1592 | 1602 |
| 1593 bool WasmFrame::at_to_number_conversion() const { | 1603 void WasmCompiledFrame::Summarize(List<FrameSummary>* functions, |
| 1604 FrameSummary::Mode mode) const { |
| 1605 // TODO(clemensh): Implement. |
| 1606 } |
| 1607 |
| 1608 bool WasmCompiledFrame::at_to_number_conversion() const { |
| 1594 // Check whether our callee is a WASM_TO_JS frame, and this frame is at the | 1609 // Check whether our callee is a WASM_TO_JS frame, and this frame is at the |
| 1595 // ToNumber conversion call. | 1610 // ToNumber conversion call. |
| 1596 Address callee_pc = reinterpret_cast<Address>(this->callee_pc()); | 1611 Address callee_pc = reinterpret_cast<Address>(this->callee_pc()); |
| 1597 Code* code = callee_pc ? isolate()->FindCodeObject(callee_pc) : nullptr; | 1612 Code* code = callee_pc ? isolate()->FindCodeObject(callee_pc) : nullptr; |
| 1598 if (!code || code->kind() != Code::WASM_TO_JS_FUNCTION) return false; | 1613 if (!code || code->kind() != Code::WASM_TO_JS_FUNCTION) return false; |
| 1599 int offset = static_cast<int>(callee_pc - code->instruction_start()); | 1614 int offset = static_cast<int>(callee_pc - code->instruction_start()); |
| 1600 int pos = AbstractCode::cast(code)->SourcePosition(offset); | 1615 int pos = AbstractCode::cast(code)->SourcePosition(offset); |
| 1601 DCHECK(pos == 0 || pos == 1); | 1616 DCHECK(pos == 0 || pos == 1); |
| 1602 // The imported call has position 0, ToNumber has position 1. | 1617 // The imported call has position 0, ToNumber has position 1. |
| 1603 return !!pos; | 1618 return !!pos; |
| 1604 } | 1619 } |
| 1605 | 1620 |
| 1606 int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) { | 1621 int WasmCompiledFrame::LookupExceptionHandlerInTable(int* stack_slots) { |
| 1607 DCHECK_NOT_NULL(stack_slots); | 1622 DCHECK_NOT_NULL(stack_slots); |
| 1608 Code* code = LookupCode(); | 1623 Code* code = LookupCode(); |
| 1609 HandlerTable* table = HandlerTable::cast(code->handler_table()); | 1624 HandlerTable* table = HandlerTable::cast(code->handler_table()); |
| 1610 int pc_offset = static_cast<int>(pc() - code->entry()); | 1625 int pc_offset = static_cast<int>(pc() - code->entry()); |
| 1611 *stack_slots = code->stack_slots(); | 1626 *stack_slots = code->stack_slots(); |
| 1612 return table->LookupReturn(pc_offset); | 1627 return table->LookupReturn(pc_offset); |
| 1613 } | 1628 } |
| 1614 | 1629 |
| 1630 void WasmToInterpreterFrame::Iterate(ObjectVisitor* v) const { |
| 1631 IterateCompiledFrame(v); |
| 1632 } |
| 1633 |
| 1634 void WasmToInterpreterFrame::Print(StringStream* accumulator, PrintMode mode, |
| 1635 int index) const { |
| 1636 PrintIndex(accumulator, mode, index); |
| 1637 accumulator->Add("WASM TO INTERPRETER ["); |
| 1638 Script* script = this->script(); |
| 1639 accumulator->PrintName(script->name()); |
| 1640 accumulator->Add("]"); |
| 1641 if (mode != OVERVIEW) accumulator->Add("\n"); |
| 1642 } |
| 1643 |
| 1644 void WasmToInterpreterFrame::Summarize(List<FrameSummary>* functions, |
| 1645 FrameSummary::Mode mode) const { |
| 1646 // TODO(clemensh): Implement this. |
| 1647 } |
| 1648 |
| 1649 Code* WasmToInterpreterFrame::unchecked_code() const { |
| 1650 return isolate()->FindCodeObject(pc()); |
| 1651 } |
| 1652 |
| 1653 WasmInstanceObject* WasmToInterpreterFrame::wasm_instance() const { |
| 1654 WasmInstanceObject* ret = wasm::GetOwningWasmInstance(LookupCode()); |
| 1655 // This is a live stack frame, there must be a live wasm instance available. |
| 1656 DCHECK_NOT_NULL(ret); |
| 1657 return ret; |
| 1658 } |
| 1659 |
| 1660 Script* WasmToInterpreterFrame::script() const { |
| 1661 return wasm_instance()->compiled_module()->script(); |
| 1662 } |
| 1663 |
| 1664 int WasmToInterpreterFrame::position() const { |
| 1665 // TODO(clemensh): Implement this. |
| 1666 return 0; |
| 1667 } |
| 1668 |
| 1669 Address WasmToInterpreterFrame::GetCallerStackPointer() const { |
| 1670 return fp() + ExitFrameConstants::kCallerSPOffset; |
| 1671 } |
| 1672 |
| 1615 namespace { | 1673 namespace { |
| 1616 | 1674 |
| 1617 | 1675 |
| 1618 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, | 1676 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, |
| 1619 Code* code) { | 1677 Code* code) { |
| 1620 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { | 1678 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { |
| 1621 std::ostringstream os; | 1679 std::ostringstream os; |
| 1622 os << "--------- s o u r c e c o d e ---------\n" | 1680 os << "--------- s o u r c e c o d e ---------\n" |
| 1623 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) | 1681 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) |
| 1624 << "\n-----------------------------------------\n"; | 1682 << "\n-----------------------------------------\n"; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 2101 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 2044 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 2102 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 2045 list.Add(frame, zone); | 2103 list.Add(frame, zone); |
| 2046 } | 2104 } |
| 2047 return list.ToVector(); | 2105 return list.ToVector(); |
| 2048 } | 2106 } |
| 2049 | 2107 |
| 2050 | 2108 |
| 2051 } // namespace internal | 2109 } // namespace internal |
| 2052 } // namespace v8 | 2110 } // namespace v8 |
| OLD | NEW |