| 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 <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
| 10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 switch (type) { | 127 switch (type) { |
| 128 case StackFrame::NONE: return NULL; | 128 case StackFrame::NONE: return NULL; |
| 129 STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE) | 129 STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE) |
| 130 default: break; | 130 default: break; |
| 131 } | 131 } |
| 132 return NULL; | 132 return NULL; |
| 133 | 133 |
| 134 #undef FRAME_TYPE_CASE | 134 #undef FRAME_TYPE_CASE |
| 135 } | 135 } |
| 136 | 136 |
| 137 | |
| 138 // ------------------------------------------------------------------------- | 137 // ------------------------------------------------------------------------- |
| 139 | 138 |
| 140 | 139 JavaScriptFrameIterator::JavaScriptFrameIterator(Isolate* isolate, |
| 141 JavaScriptFrameIterator::JavaScriptFrameIterator( | 140 StackFrame::Id id) |
| 142 Isolate* isolate, StackFrame::Id id) | |
| 143 : iterator_(isolate) { | 141 : iterator_(isolate) { |
| 144 while (!done()) { | 142 while (!done()) { |
| 145 Advance(); | 143 Advance(); |
| 146 if (frame()->id() == id) return; | 144 if (frame()->id() == id) return; |
| 147 } | 145 } |
| 148 } | 146 } |
| 149 | 147 |
| 150 | 148 |
| 151 void JavaScriptFrameIterator::Advance() { | 149 void JavaScriptFrameIterator::Advance() { |
| 152 do { | 150 do { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 437 |
| 440 Object* marker = | 438 Object* marker = |
| 441 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); | 439 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); |
| 442 if (code_obj != nullptr) { | 440 if (code_obj != nullptr) { |
| 443 switch (code_obj->kind()) { | 441 switch (code_obj->kind()) { |
| 444 case Code::FUNCTION: | 442 case Code::FUNCTION: |
| 445 return JAVA_SCRIPT; | 443 return JAVA_SCRIPT; |
| 446 case Code::OPTIMIZED_FUNCTION: | 444 case Code::OPTIMIZED_FUNCTION: |
| 447 return OPTIMIZED; | 445 return OPTIMIZED; |
| 448 case Code::WASM_FUNCTION: | 446 case Code::WASM_FUNCTION: |
| 449 return STUB; | 447 return WASM; |
| 450 case Code::BUILTIN: | 448 case Code::BUILTIN: |
| 451 if (!marker->IsSmi()) { | 449 if (!marker->IsSmi()) { |
| 452 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { | 450 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { |
| 453 // An adapter frame has a special SMI constant for the context and | 451 // An adapter frame has a special SMI constant for the context and |
| 454 // is not distinguished through the marker. | 452 // is not distinguished through the marker. |
| 455 return ARGUMENTS_ADAPTOR; | 453 return ARGUMENTS_ADAPTOR; |
| 456 } else { | 454 } else { |
| 457 // The interpreter entry trampoline has a non-SMI marker. | 455 // The interpreter entry trampoline has a non-SMI marker. |
| 458 DCHECK(code_obj->is_interpreter_entry_trampoline() || | 456 DCHECK(code_obj->is_interpreter_entry_trampoline() || |
| 459 code_obj->is_interpreter_enter_bytecode_dispatch()); | 457 code_obj->is_interpreter_enter_bytecode_dispatch()); |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 return reinterpret_cast<Code*>(code); | 1213 return reinterpret_cast<Code*>(code); |
| 1216 } | 1214 } |
| 1217 | 1215 |
| 1218 | 1216 |
| 1219 void StackFrame::PrintIndex(StringStream* accumulator, | 1217 void StackFrame::PrintIndex(StringStream* accumulator, |
| 1220 PrintMode mode, | 1218 PrintMode mode, |
| 1221 int index) { | 1219 int index) { |
| 1222 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); | 1220 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); |
| 1223 } | 1221 } |
| 1224 | 1222 |
| 1223 void WasmFrame::Print(StringStream* accumulator, PrintMode mode, |
| 1224 int index) const { |
| 1225 accumulator->Add("wasm frame"); |
| 1226 } |
| 1227 |
| 1228 Code* WasmFrame::unchecked_code() const { |
| 1229 return static_cast<Code*>(isolate()->FindCodeObject(pc())); |
| 1230 } |
| 1231 |
| 1232 void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } |
| 1233 |
| 1234 Address WasmFrame::GetCallerStackPointer() const { |
| 1235 return fp() + ExitFrameConstants::kCallerSPDisplacement; |
| 1236 } |
| 1225 | 1237 |
| 1226 namespace { | 1238 namespace { |
| 1227 | 1239 |
| 1228 | 1240 |
| 1229 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, | 1241 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, |
| 1230 Code* code) { | 1242 Code* code) { |
| 1231 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { | 1243 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { |
| 1232 std::ostringstream os; | 1244 std::ostringstream os; |
| 1233 os << "--------- s o u r c e c o d e ---------\n" | 1245 os << "--------- s o u r c e c o d e ---------\n" |
| 1234 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) | 1246 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1658 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1647 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1659 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1648 list.Add(frame, zone); | 1660 list.Add(frame, zone); |
| 1649 } | 1661 } |
| 1650 return list.ToVector(); | 1662 return list.ToVector(); |
| 1651 } | 1663 } |
| 1652 | 1664 |
| 1653 | 1665 |
| 1654 } // namespace internal | 1666 } // namespace internal |
| 1655 } // namespace v8 | 1667 } // namespace v8 |
| OLD | NEW |