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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 // Look up the code object to figure out the type of the stack frame. | 447 // Look up the code object to figure out the type of the stack frame. |
448 Code* code_obj = | 448 Code* code_obj = |
449 GetContainingCode(iterator->isolate(), *(state->pc_address)); | 449 GetContainingCode(iterator->isolate(), *(state->pc_address)); |
450 if (code_obj != nullptr) { | 450 if (code_obj != nullptr) { |
451 switch (code_obj->kind()) { | 451 switch (code_obj->kind()) { |
452 case Code::BUILTIN: | 452 case Code::BUILTIN: |
453 if (marker->IsSmi()) break; | 453 if (marker->IsSmi()) break; |
454 if (code_obj->is_interpreter_trampoline_builtin()) { | 454 if (code_obj->is_interpreter_trampoline_builtin()) { |
455 return INTERPRETED; | 455 return INTERPRETED; |
456 } | 456 } |
457 // We treat frames for BUILTIN Code objects as OptimizedFrame for now | 457 if (code_obj->is_turbofanned()) { |
458 // (all the builtins with JavaScript linkage are actually generated | 458 // TODO(bmeurer): We treat frames for BUILTIN Code objects as |
459 // with TurboFan currently, so this is sound). | 459 // OptimizedFrame for now (all the builtins with JavaScript |
460 return OPTIMIZED; | 460 // linkage are actually generated with TurboFan currently, so |
| 461 // this is sound). |
| 462 return OPTIMIZED; |
| 463 } |
| 464 return BUILTIN; |
461 case Code::FUNCTION: | 465 case Code::FUNCTION: |
462 return JAVA_SCRIPT; | 466 return JAVA_SCRIPT; |
463 case Code::OPTIMIZED_FUNCTION: | 467 case Code::OPTIMIZED_FUNCTION: |
464 return OPTIMIZED; | 468 return OPTIMIZED; |
465 case Code::WASM_FUNCTION: | 469 case Code::WASM_FUNCTION: |
466 return WASM; | 470 return WASM; |
467 case Code::WASM_TO_JS_FUNCTION: | 471 case Code::WASM_TO_JS_FUNCTION: |
468 return WASM_TO_JS; | 472 return WASM_TO_JS; |
469 case Code::JS_TO_WASM_FUNCTION: | 473 case Code::JS_TO_WASM_FUNCTION: |
470 return JS_TO_WASM; | 474 return JS_TO_WASM; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 case INTERNAL: | 689 case INTERNAL: |
686 case CONSTRUCT: | 690 case CONSTRUCT: |
687 case JS_TO_WASM: | 691 case JS_TO_WASM: |
688 case WASM_TO_JS: | 692 case WASM_TO_JS: |
689 case WASM: | 693 case WASM: |
690 frame_header_size = TypedFrameConstants::kFixedFrameSizeFromFp; | 694 frame_header_size = TypedFrameConstants::kFixedFrameSizeFromFp; |
691 break; | 695 break; |
692 case JAVA_SCRIPT: | 696 case JAVA_SCRIPT: |
693 case OPTIMIZED: | 697 case OPTIMIZED: |
694 case INTERPRETED: | 698 case INTERPRETED: |
| 699 case BUILTIN: |
695 // These frame types have a context, but they are actually stored | 700 // These frame types have a context, but they are actually stored |
696 // in the place on the stack that one finds the frame type. | 701 // in the place on the stack that one finds the frame type. |
697 UNREACHABLE(); | 702 UNREACHABLE(); |
698 break; | 703 break; |
699 case NONE: | 704 case NONE: |
700 case NUMBER_OF_TYPES: | 705 case NUMBER_OF_TYPES: |
701 case MANUAL: | 706 case MANUAL: |
702 UNREACHABLE(); | 707 UNREACHABLE(); |
703 break; | 708 break; |
704 } | 709 } |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 AbstractCode::cast(function()->shared()->bytecode_array()); | 1287 AbstractCode::cast(function()->shared()->bytecode_array()); |
1283 FrameSummary summary(receiver(), function(), abstract_code, | 1288 FrameSummary summary(receiver(), function(), abstract_code, |
1284 GetBytecodeOffset(), IsConstructor()); | 1289 GetBytecodeOffset(), IsConstructor()); |
1285 functions->Add(summary); | 1290 functions->Add(summary); |
1286 } | 1291 } |
1287 | 1292 |
1288 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { | 1293 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { |
1289 return Smi::cast(GetExpression(0))->value(); | 1294 return Smi::cast(GetExpression(0))->value(); |
1290 } | 1295 } |
1291 | 1296 |
1292 | |
1293 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const { | |
1294 return fp() + StandardFrameConstants::kCallerSPOffset; | |
1295 } | |
1296 | |
1297 int ArgumentsAdaptorFrame::GetLength(Address fp) { | 1297 int ArgumentsAdaptorFrame::GetLength(Address fp) { |
1298 const int offset = ArgumentsAdaptorFrameConstants::kLengthOffset; | 1298 const int offset = ArgumentsAdaptorFrameConstants::kLengthOffset; |
1299 return Smi::cast(Memory::Object_at(fp + offset))->value(); | 1299 return Smi::cast(Memory::Object_at(fp + offset))->value(); |
1300 } | 1300 } |
1301 | 1301 |
1302 Code* ArgumentsAdaptorFrame::unchecked_code() const { | 1302 Code* ArgumentsAdaptorFrame::unchecked_code() const { |
1303 return isolate()->builtins()->builtin( | 1303 return isolate()->builtins()->builtin( |
1304 Builtins::kArgumentsAdaptorTrampoline); | 1304 Builtins::kArgumentsAdaptorTrampoline); |
1305 } | 1305 } |
1306 | 1306 |
| 1307 void BuiltinFrame::Print(StringStream* accumulator, PrintMode mode, |
| 1308 int index) const { |
| 1309 // TODO(bmeurer) |
| 1310 } |
| 1311 |
| 1312 int BuiltinFrame::GetNumberOfIncomingArguments() const { |
| 1313 return Smi::cast(GetExpression(0))->value(); |
| 1314 } |
| 1315 |
1307 Address InternalFrame::GetCallerStackPointer() const { | 1316 Address InternalFrame::GetCallerStackPointer() const { |
1308 // Internal frames have no arguments. The stack pointer of the | 1317 // Internal frames have no arguments. The stack pointer of the |
1309 // caller is at a fixed offset from the frame pointer. | 1318 // caller is at a fixed offset from the frame pointer. |
1310 return fp() + StandardFrameConstants::kCallerSPOffset; | 1319 return fp() + StandardFrameConstants::kCallerSPOffset; |
1311 } | 1320 } |
1312 | 1321 |
1313 Code* InternalFrame::unchecked_code() const { | 1322 Code* InternalFrame::unchecked_code() const { |
1314 const int offset = InternalFrameConstants::kCodeOffset; | 1323 const int offset = InternalFrameConstants::kCodeOffset; |
1315 Object* code = Memory::Object_at(fp() + offset); | 1324 Object* code = Memory::Object_at(fp() + offset); |
1316 DCHECK(code != NULL); | 1325 DCHECK(code != NULL); |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1797 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1789 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1798 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1790 list.Add(frame, zone); | 1799 list.Add(frame, zone); |
1791 } | 1800 } |
1792 return list.ToVector(); | 1801 return list.ToVector(); |
1793 } | 1802 } |
1794 | 1803 |
1795 | 1804 |
1796 } // namespace internal | 1805 } // namespace internal |
1797 } // namespace v8 | 1806 } // namespace v8 |
OLD | NEW |