Chromium Code Reviews| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 Code* code_obj = | 444 Code* code_obj = | 
| 445 GetContainingCode(iterator->isolate(), *(state->pc_address)); | 445 GetContainingCode(iterator->isolate(), *(state->pc_address)); | 
| 446 if (code_obj != nullptr) { | 446 if (code_obj != nullptr) { | 
| 447 if (code_obj->is_interpreter_entry_trampoline() || | 447 if (code_obj->is_interpreter_entry_trampoline() || | 
| 448 code_obj->is_interpreter_enter_bytecode_dispatch()) { | 448 code_obj->is_interpreter_enter_bytecode_dispatch()) { | 
| 449 return INTERPRETED; | 449 return INTERPRETED; | 
| 450 } | 450 } | 
| 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 // We treat frames for BUILTIN Code objects as OptimizedFrame for now | 454 if (code_obj->is_turbofanned()) { | 
| 455 // (all the builtins with JavaScript linkage are actually generated | 455 // TODO(bmeurer): We treat frames for BUILTIN Code objects as | 
| 456 // with TurboFan currently, so this is sound). | 456 // OptimizedFrame for now (all the builtins with JavaScript | 
| 457 return OPTIMIZED; | 457 // linkage are actually generated with TurboFan currently, so | 
| 458 // this is sound). | |
| 459 return OPTIMIZED; | |
| 
 
Jarin
2016/04/20 11:47:57
What would go wrong if you also optimized function
 
 | |
| 460 } | |
| 461 return BUILTIN; | |
| 458 case Code::FUNCTION: | 462 case Code::FUNCTION: | 
| 459 return JAVA_SCRIPT; | 463 return JAVA_SCRIPT; | 
| 460 case Code::OPTIMIZED_FUNCTION: | 464 case Code::OPTIMIZED_FUNCTION: | 
| 461 return OPTIMIZED; | 465 return OPTIMIZED; | 
| 462 case Code::WASM_FUNCTION: | 466 case Code::WASM_FUNCTION: | 
| 463 return WASM; | 467 return WASM; | 
| 464 case Code::WASM_TO_JS_FUNCTION: | 468 case Code::WASM_TO_JS_FUNCTION: | 
| 465 return WASM_TO_JS; | 469 return WASM_TO_JS; | 
| 466 case Code::JS_TO_WASM_FUNCTION: | 470 case Code::JS_TO_WASM_FUNCTION: | 
| 467 return JS_TO_WASM; | 471 return JS_TO_WASM; | 
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 695 case INTERNAL: | 699 case INTERNAL: | 
| 696 case CONSTRUCT: | 700 case CONSTRUCT: | 
| 697 case JS_TO_WASM: | 701 case JS_TO_WASM: | 
| 698 case WASM_TO_JS: | 702 case WASM_TO_JS: | 
| 699 case WASM: | 703 case WASM: | 
| 700 frame_header_size = TypedFrameConstants::kFixedFrameSizeFromFp; | 704 frame_header_size = TypedFrameConstants::kFixedFrameSizeFromFp; | 
| 701 break; | 705 break; | 
| 702 case JAVA_SCRIPT: | 706 case JAVA_SCRIPT: | 
| 703 case OPTIMIZED: | 707 case OPTIMIZED: | 
| 704 case INTERPRETED: | 708 case INTERPRETED: | 
| 709 case BUILTIN: | |
| 705 // These frame types have a context, but they are actually stored | 710 // These frame types have a context, but they are actually stored | 
| 706 // in the place on the stack that one finds the frame type. | 711 // in the place on the stack that one finds the frame type. | 
| 707 UNREACHABLE(); | 712 UNREACHABLE(); | 
| 708 break; | 713 break; | 
| 709 case NONE: | 714 case NONE: | 
| 710 case NUMBER_OF_TYPES: | 715 case NUMBER_OF_TYPES: | 
| 711 case MANUAL: | 716 case MANUAL: | 
| 712 UNREACHABLE(); | 717 UNREACHABLE(); | 
| 713 break; | 718 break; | 
| 714 } | 719 } | 
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1273 AbstractCode::cast(function()->shared()->bytecode_array()); | 1278 AbstractCode::cast(function()->shared()->bytecode_array()); | 
| 1274 FrameSummary summary(receiver(), function(), abstract_code, | 1279 FrameSummary summary(receiver(), function(), abstract_code, | 
| 1275 GetBytecodeOffset(), IsConstructor()); | 1280 GetBytecodeOffset(), IsConstructor()); | 
| 1276 functions->Add(summary); | 1281 functions->Add(summary); | 
| 1277 } | 1282 } | 
| 1278 | 1283 | 
| 1279 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { | 1284 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { | 
| 1280 return Smi::cast(GetExpression(0))->value(); | 1285 return Smi::cast(GetExpression(0))->value(); | 
| 1281 } | 1286 } | 
| 1282 | 1287 | 
| 1283 | |
| 1284 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const { | |
| 1285 return fp() + StandardFrameConstants::kCallerSPOffset; | |
| 1286 } | |
| 1287 | |
| 1288 int ArgumentsAdaptorFrame::GetLength(Address fp) { | 1288 int ArgumentsAdaptorFrame::GetLength(Address fp) { | 
| 1289 const int offset = ArgumentsAdaptorFrameConstants::kLengthOffset; | 1289 const int offset = ArgumentsAdaptorFrameConstants::kLengthOffset; | 
| 1290 return Smi::cast(Memory::Object_at(fp + offset))->value(); | 1290 return Smi::cast(Memory::Object_at(fp + offset))->value(); | 
| 1291 } | 1291 } | 
| 1292 | 1292 | 
| 1293 Code* ArgumentsAdaptorFrame::unchecked_code() const { | 1293 Code* ArgumentsAdaptorFrame::unchecked_code() const { | 
| 1294 return isolate()->builtins()->builtin( | 1294 return isolate()->builtins()->builtin( | 
| 1295 Builtins::kArgumentsAdaptorTrampoline); | 1295 Builtins::kArgumentsAdaptorTrampoline); | 
| 1296 } | 1296 } | 
| 1297 | 1297 | 
| 1298 void BuiltinFrame::Print(StringStream* accumulator, PrintMode mode, | |
| 1299 int index) const { | |
| 1300 // TODO(bmeurer) | |
| 1301 } | |
| 1302 | |
| 1303 int BuiltinFrame::GetNumberOfIncomingArguments() const { | |
| 1304 return Smi::cast(GetExpression(0))->value(); | |
| 1305 } | |
| 1306 | |
| 1298 Address InternalFrame::GetCallerStackPointer() const { | 1307 Address InternalFrame::GetCallerStackPointer() const { | 
| 1299 // Internal frames have no arguments. The stack pointer of the | 1308 // Internal frames have no arguments. The stack pointer of the | 
| 1300 // caller is at a fixed offset from the frame pointer. | 1309 // caller is at a fixed offset from the frame pointer. | 
| 1301 return fp() + StandardFrameConstants::kCallerSPOffset; | 1310 return fp() + StandardFrameConstants::kCallerSPOffset; | 
| 1302 } | 1311 } | 
| 1303 | 1312 | 
| 1304 Code* InternalFrame::unchecked_code() const { | 1313 Code* InternalFrame::unchecked_code() const { | 
| 1305 const int offset = InternalFrameConstants::kCodeOffset; | 1314 const int offset = InternalFrameConstants::kCodeOffset; | 
| 1306 Object* code = Memory::Object_at(fp() + offset); | 1315 Object* code = Memory::Object_at(fp() + offset); | 
| 1307 DCHECK(code != NULL); | 1316 DCHECK(code != NULL); | 
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1773 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1782 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 
| 1774 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1783 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 
| 1775 list.Add(frame, zone); | 1784 list.Add(frame, zone); | 
| 1776 } | 1785 } | 
| 1777 return list.ToVector(); | 1786 return list.ToVector(); | 
| 1778 } | 1787 } | 
| 1779 | 1788 | 
| 1780 | 1789 | 
| 1781 } // namespace internal | 1790 } // namespace internal | 
| 1782 } // namespace v8 | 1791 } // namespace v8 | 
| OLD | NEW |