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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 return NONE; | 497 return NONE; |
498 } | 498 } |
499 } | 499 } |
500 | 500 |
501 DCHECK(StackFrame::IsTypeMarker(marker)); | 501 DCHECK(StackFrame::IsTypeMarker(marker)); |
502 StackFrame::Type candidate = StackFrame::MarkerToType(marker); | 502 StackFrame::Type candidate = StackFrame::MarkerToType(marker); |
503 switch (candidate) { | 503 switch (candidate) { |
504 case ENTRY: | 504 case ENTRY: |
505 case ENTRY_CONSTRUCT: | 505 case ENTRY_CONSTRUCT: |
506 case EXIT: | 506 case EXIT: |
| 507 case BUILTIN_CONTINUATION: |
| 508 case JAVA_SCRIPT_BUILTIN_CONTINUATION: |
507 case BUILTIN_EXIT: | 509 case BUILTIN_EXIT: |
508 case STUB: | 510 case STUB: |
509 case STUB_FAILURE_TRAMPOLINE: | 511 case STUB_FAILURE_TRAMPOLINE: |
510 case INTERNAL: | 512 case INTERNAL: |
511 case CONSTRUCT: | 513 case CONSTRUCT: |
512 case ARGUMENTS_ADAPTOR: | 514 case ARGUMENTS_ADAPTOR: |
513 case WASM_TO_JS: | 515 case WASM_TO_JS: |
514 case WASM_COMPILED: | 516 case WASM_COMPILED: |
515 return candidate; | 517 return candidate; |
516 case JS_TO_WASM: | 518 case JS_TO_WASM: |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 // Determine the fixed header and spill slot area size. | 797 // Determine the fixed header and spill slot area size. |
796 int frame_header_size = StandardFrameConstants::kFixedFrameSizeFromFp; | 798 int frame_header_size = StandardFrameConstants::kFixedFrameSizeFromFp; |
797 intptr_t marker = | 799 intptr_t marker = |
798 Memory::intptr_at(fp() + CommonFrameConstants::kContextOrFrameTypeOffset); | 800 Memory::intptr_at(fp() + CommonFrameConstants::kContextOrFrameTypeOffset); |
799 if (StackFrame::IsTypeMarker(marker)) { | 801 if (StackFrame::IsTypeMarker(marker)) { |
800 StackFrame::Type candidate = StackFrame::MarkerToType(marker); | 802 StackFrame::Type candidate = StackFrame::MarkerToType(marker); |
801 switch (candidate) { | 803 switch (candidate) { |
802 case ENTRY: | 804 case ENTRY: |
803 case ENTRY_CONSTRUCT: | 805 case ENTRY_CONSTRUCT: |
804 case EXIT: | 806 case EXIT: |
| 807 case BUILTIN_CONTINUATION: |
| 808 case JAVA_SCRIPT_BUILTIN_CONTINUATION: |
805 case BUILTIN_EXIT: | 809 case BUILTIN_EXIT: |
806 case STUB_FAILURE_TRAMPOLINE: | 810 case STUB_FAILURE_TRAMPOLINE: |
807 case ARGUMENTS_ADAPTOR: | 811 case ARGUMENTS_ADAPTOR: |
808 case STUB: | 812 case STUB: |
809 case INTERNAL: | 813 case INTERNAL: |
810 case CONSTRUCT: | 814 case CONSTRUCT: |
811 case JS_TO_WASM: | 815 case JS_TO_WASM: |
812 case WASM_TO_JS: | 816 case WASM_TO_JS: |
813 case WASM_COMPILED: | 817 case WASM_COMPILED: |
814 case WASM_INTERPRETER_ENTRY: | 818 case WASM_INTERPRETER_ENTRY: |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 } | 1140 } |
1137 | 1141 |
1138 Object* JavaScriptFrame::GetParameter(int index) const { | 1142 Object* JavaScriptFrame::GetParameter(int index) const { |
1139 return Memory::Object_at(GetParameterSlot(index)); | 1143 return Memory::Object_at(GetParameterSlot(index)); |
1140 } | 1144 } |
1141 | 1145 |
1142 int JavaScriptFrame::ComputeParametersCount() const { | 1146 int JavaScriptFrame::ComputeParametersCount() const { |
1143 return GetNumberOfIncomingArguments(); | 1147 return GetNumberOfIncomingArguments(); |
1144 } | 1148 } |
1145 | 1149 |
| 1150 int JavaScriptBuiltinContinuationFrame::ComputeParametersCount() const { |
| 1151 Object* argc_object = |
| 1152 Memory::Object_at(fp() + BuiltinContinuationFrameConstants::kArgCOffset); |
| 1153 return Smi::cast(argc_object)->value(); |
| 1154 } |
| 1155 |
1146 namespace { | 1156 namespace { |
1147 | 1157 |
1148 bool CannotDeoptFromAsmCode(Code* code, JSFunction* function) { | 1158 bool CannotDeoptFromAsmCode(Code* code, JSFunction* function) { |
1149 return code->is_turbofanned() && function->shared()->asm_function(); | 1159 return code->is_turbofanned() && function->shared()->asm_function(); |
1150 } | 1160 } |
1151 | 1161 |
1152 } // namespace | 1162 } // namespace |
1153 | 1163 |
1154 FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary( | 1164 FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary( |
1155 Isolate* isolate, Object* receiver, JSFunction* function, | 1165 Isolate* isolate, Object* receiver, JSFunction* function, |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 DCHECK_EQ(Translation::BEGIN, frame_opcode); | 1380 DCHECK_EQ(Translation::BEGIN, frame_opcode); |
1371 it.Next(); // Drop frame count. | 1381 it.Next(); // Drop frame count. |
1372 int jsframe_count = it.Next(); | 1382 int jsframe_count = it.Next(); |
1373 | 1383 |
1374 // We create the summary in reverse order because the frames | 1384 // We create the summary in reverse order because the frames |
1375 // in the deoptimization translation are ordered bottom-to-top. | 1385 // in the deoptimization translation are ordered bottom-to-top. |
1376 bool is_constructor = IsConstructor(); | 1386 bool is_constructor = IsConstructor(); |
1377 while (jsframe_count != 0) { | 1387 while (jsframe_count != 0) { |
1378 frame_opcode = static_cast<Translation::Opcode>(it.Next()); | 1388 frame_opcode = static_cast<Translation::Opcode>(it.Next()); |
1379 if (frame_opcode == Translation::JS_FRAME || | 1389 if (frame_opcode == Translation::JS_FRAME || |
1380 frame_opcode == Translation::INTERPRETED_FRAME) { | 1390 frame_opcode == Translation::INTERPRETED_FRAME || |
| 1391 frame_opcode == Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME) { |
1381 jsframe_count--; | 1392 jsframe_count--; |
1382 BailoutId const bailout_id = BailoutId(it.Next()); | 1393 BailoutId const bailout_id = BailoutId(it.Next()); |
1383 SharedFunctionInfo* const shared_info = | 1394 SharedFunctionInfo* const shared_info = |
1384 SharedFunctionInfo::cast(literal_array->get(it.Next())); | 1395 SharedFunctionInfo::cast(literal_array->get(it.Next())); |
1385 it.Next(); // Skip height. | 1396 it.Next(); // Skip height. |
1386 | 1397 |
1387 // The translation commands are ordered and the function is always | 1398 // The translation commands are ordered and the function is always |
1388 // at the first position, and the receiver is next. | 1399 // at the first position, and the receiver is next. |
1389 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | 1400 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
1390 | 1401 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 | 1433 |
1423 unsigned code_offset; | 1434 unsigned code_offset; |
1424 if (frame_opcode == Translation::JS_FRAME) { | 1435 if (frame_opcode == Translation::JS_FRAME) { |
1425 Code* code = shared_info->code(); | 1436 Code* code = shared_info->code(); |
1426 DeoptimizationOutputData* const output_data = | 1437 DeoptimizationOutputData* const output_data = |
1427 DeoptimizationOutputData::cast(code->deoptimization_data()); | 1438 DeoptimizationOutputData::cast(code->deoptimization_data()); |
1428 unsigned const entry = | 1439 unsigned const entry = |
1429 Deoptimizer::GetOutputInfo(output_data, bailout_id, shared_info); | 1440 Deoptimizer::GetOutputInfo(output_data, bailout_id, shared_info); |
1430 code_offset = FullCodeGenerator::PcField::decode(entry); | 1441 code_offset = FullCodeGenerator::PcField::decode(entry); |
1431 abstract_code = AbstractCode::cast(code); | 1442 abstract_code = AbstractCode::cast(code); |
| 1443 } else if (frame_opcode == |
| 1444 Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME) { |
| 1445 code_offset = 0; |
| 1446 abstract_code = AbstractCode::cast(isolate()->builtins()->builtin( |
| 1447 Builtins::GetBuiltinFromBailoutId(bailout_id))); |
1432 } else { | 1448 } else { |
1433 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); | 1449 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); |
1434 code_offset = bailout_id.ToInt(); // Points to current bytecode. | 1450 code_offset = bailout_id.ToInt(); // Points to current bytecode. |
1435 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); | 1451 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); |
1436 } | 1452 } |
1437 FrameSummary::JavaScriptFrameSummary summary(isolate(), receiver, | 1453 FrameSummary::JavaScriptFrameSummary summary(isolate(), receiver, |
1438 function, abstract_code, | 1454 function, abstract_code, |
1439 code_offset, is_constructor); | 1455 code_offset, is_constructor); |
1440 frames->Add(summary); | 1456 frames->Add(summary); |
1441 is_constructor = false; | 1457 is_constructor = false; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | 1546 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
1531 DCHECK_EQ(Translation::BEGIN, opcode); | 1547 DCHECK_EQ(Translation::BEGIN, opcode); |
1532 it.Next(); // Skip frame count. | 1548 it.Next(); // Skip frame count. |
1533 int jsframe_count = it.Next(); | 1549 int jsframe_count = it.Next(); |
1534 | 1550 |
1535 // We insert the frames in reverse order because the frames | 1551 // We insert the frames in reverse order because the frames |
1536 // in the deoptimization translation are ordered bottom-to-top. | 1552 // in the deoptimization translation are ordered bottom-to-top. |
1537 while (jsframe_count != 0) { | 1553 while (jsframe_count != 0) { |
1538 opcode = static_cast<Translation::Opcode>(it.Next()); | 1554 opcode = static_cast<Translation::Opcode>(it.Next()); |
1539 if (opcode == Translation::JS_FRAME || | 1555 if (opcode == Translation::JS_FRAME || |
1540 opcode == Translation::INTERPRETED_FRAME) { | 1556 opcode == Translation::INTERPRETED_FRAME || |
| 1557 opcode == Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME) { |
1541 it.Next(); // Skip bailout id. | 1558 it.Next(); // Skip bailout id. |
1542 jsframe_count--; | 1559 jsframe_count--; |
1543 | 1560 |
1544 // The second operand of the frame points to the function. | 1561 // The second operand of the frame points to the function. |
1545 Object* shared = literal_array->get(it.Next()); | 1562 Object* shared = literal_array->get(it.Next()); |
1546 functions->Add(SharedFunctionInfo::cast(shared)); | 1563 functions->Add(SharedFunctionInfo::cast(shared)); |
1547 | 1564 |
1548 // Skip over remaining operands to advance to the next opcode. | 1565 // Skip over remaining operands to advance to the next opcode. |
1549 it.Skip(Translation::NumberOfOperandsFor(opcode) - 2); | 1566 it.Skip(Translation::NumberOfOperandsFor(opcode) - 2); |
1550 } else { | 1567 } else { |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 2279 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
2263 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 2280 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
2264 list.Add(frame, zone); | 2281 list.Add(frame, zone); |
2265 } | 2282 } |
2266 return list.ToVector(); | 2283 return list.ToVector(); |
2267 } | 2284 } |
2268 | 2285 |
2269 | 2286 |
2270 } // namespace internal | 2287 } // namespace internal |
2271 } // namespace v8 | 2288 } // namespace v8 |
OLD | NEW |