| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 DCHECK_EQ(Translation::BEGIN, frame_opcode); | 1374 DCHECK_EQ(Translation::BEGIN, frame_opcode); |
| 1371 it.Next(); // Drop frame count. | 1375 it.Next(); // Drop frame count. |
| 1372 int jsframe_count = it.Next(); | 1376 int jsframe_count = it.Next(); |
| 1373 | 1377 |
| 1374 // We create the summary in reverse order because the frames | 1378 // We create the summary in reverse order because the frames |
| 1375 // in the deoptimization translation are ordered bottom-to-top. | 1379 // in the deoptimization translation are ordered bottom-to-top. |
| 1376 bool is_constructor = IsConstructor(); | 1380 bool is_constructor = IsConstructor(); |
| 1377 while (jsframe_count != 0) { | 1381 while (jsframe_count != 0) { |
| 1378 frame_opcode = static_cast<Translation::Opcode>(it.Next()); | 1382 frame_opcode = static_cast<Translation::Opcode>(it.Next()); |
| 1379 if (frame_opcode == Translation::JS_FRAME || | 1383 if (frame_opcode == Translation::JS_FRAME || |
| 1380 frame_opcode == Translation::INTERPRETED_FRAME) { | 1384 frame_opcode == Translation::INTERPRETED_FRAME || |
| 1385 frame_opcode == Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME) { |
| 1381 jsframe_count--; | 1386 jsframe_count--; |
| 1382 BailoutId const bailout_id = BailoutId(it.Next()); | 1387 BailoutId const bailout_id = BailoutId(it.Next()); |
| 1383 SharedFunctionInfo* const shared_info = | 1388 SharedFunctionInfo* const shared_info = |
| 1384 SharedFunctionInfo::cast(literal_array->get(it.Next())); | 1389 SharedFunctionInfo::cast(literal_array->get(it.Next())); |
| 1385 it.Next(); // Skip height. | 1390 it.Next(); // Skip height. |
| 1386 | 1391 |
| 1387 // The translation commands are ordered and the function is always | 1392 // The translation commands are ordered and the function is always |
| 1388 // at the first position, and the receiver is next. | 1393 // at the first position, and the receiver is next. |
| 1389 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); | 1394 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
| 1390 | 1395 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 | 1427 |
| 1423 unsigned code_offset; | 1428 unsigned code_offset; |
| 1424 if (frame_opcode == Translation::JS_FRAME) { | 1429 if (frame_opcode == Translation::JS_FRAME) { |
| 1425 Code* code = shared_info->code(); | 1430 Code* code = shared_info->code(); |
| 1426 DeoptimizationOutputData* const output_data = | 1431 DeoptimizationOutputData* const output_data = |
| 1427 DeoptimizationOutputData::cast(code->deoptimization_data()); | 1432 DeoptimizationOutputData::cast(code->deoptimization_data()); |
| 1428 unsigned const entry = | 1433 unsigned const entry = |
| 1429 Deoptimizer::GetOutputInfo(output_data, bailout_id, shared_info); | 1434 Deoptimizer::GetOutputInfo(output_data, bailout_id, shared_info); |
| 1430 code_offset = FullCodeGenerator::PcField::decode(entry); | 1435 code_offset = FullCodeGenerator::PcField::decode(entry); |
| 1431 abstract_code = AbstractCode::cast(code); | 1436 abstract_code = AbstractCode::cast(code); |
| 1437 } else if (frame_opcode == |
| 1438 Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME) { |
| 1439 code_offset = 0; |
| 1440 abstract_code = AbstractCode::cast(isolate()->builtins()->builtin( |
| 1441 Builtins::GetBuiltinFromBailoutId(bailout_id))); |
| 1432 } else { | 1442 } else { |
| 1433 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); | 1443 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); |
| 1434 code_offset = bailout_id.ToInt(); // Points to current bytecode. | 1444 code_offset = bailout_id.ToInt(); // Points to current bytecode. |
| 1435 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); | 1445 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); |
| 1436 } | 1446 } |
| 1437 FrameSummary::JavaScriptFrameSummary summary(isolate(), receiver, | 1447 FrameSummary::JavaScriptFrameSummary summary(isolate(), receiver, |
| 1438 function, abstract_code, | 1448 function, abstract_code, |
| 1439 code_offset, is_constructor); | 1449 code_offset, is_constructor); |
| 1440 frames->Add(summary); | 1450 frames->Add(summary); |
| 1441 is_constructor = false; | 1451 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()); | 1540 Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next()); |
| 1531 DCHECK_EQ(Translation::BEGIN, opcode); | 1541 DCHECK_EQ(Translation::BEGIN, opcode); |
| 1532 it.Next(); // Skip frame count. | 1542 it.Next(); // Skip frame count. |
| 1533 int jsframe_count = it.Next(); | 1543 int jsframe_count = it.Next(); |
| 1534 | 1544 |
| 1535 // We insert the frames in reverse order because the frames | 1545 // We insert the frames in reverse order because the frames |
| 1536 // in the deoptimization translation are ordered bottom-to-top. | 1546 // in the deoptimization translation are ordered bottom-to-top. |
| 1537 while (jsframe_count != 0) { | 1547 while (jsframe_count != 0) { |
| 1538 opcode = static_cast<Translation::Opcode>(it.Next()); | 1548 opcode = static_cast<Translation::Opcode>(it.Next()); |
| 1539 if (opcode == Translation::JS_FRAME || | 1549 if (opcode == Translation::JS_FRAME || |
| 1540 opcode == Translation::INTERPRETED_FRAME) { | 1550 opcode == Translation::INTERPRETED_FRAME || |
| 1551 opcode == Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME) { |
| 1541 it.Next(); // Skip bailout id. | 1552 it.Next(); // Skip bailout id. |
| 1542 jsframe_count--; | 1553 jsframe_count--; |
| 1543 | 1554 |
| 1544 // The second operand of the frame points to the function. | 1555 // The second operand of the frame points to the function. |
| 1545 Object* shared = literal_array->get(it.Next()); | 1556 Object* shared = literal_array->get(it.Next()); |
| 1546 functions->Add(SharedFunctionInfo::cast(shared)); | 1557 functions->Add(SharedFunctionInfo::cast(shared)); |
| 1547 | 1558 |
| 1548 // Skip over remaining operands to advance to the next opcode. | 1559 // Skip over remaining operands to advance to the next opcode. |
| 1549 it.Skip(Translation::NumberOfOperandsFor(opcode) - 2); | 1560 it.Skip(Translation::NumberOfOperandsFor(opcode) - 2); |
| 1550 } else { | 1561 } else { |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2262 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 2273 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 2263 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 2274 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 2264 list.Add(frame, zone); | 2275 list.Add(frame, zone); |
| 2265 } | 2276 } |
| 2266 return list.ToVector(); | 2277 return list.ToVector(); |
| 2267 } | 2278 } |
| 2268 | 2279 |
| 2269 | 2280 |
| 2270 } // namespace internal | 2281 } // namespace internal |
| 2271 } // namespace v8 | 2282 } // namespace v8 |
| OLD | NEW |