| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/deoptimizer.h" | 5 #include "src/deoptimizer.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/ast/prettyprinter.h" | 8 #include "src/ast/prettyprinter.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/disasm.h" | 10 #include "src/disasm.h" |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 unsigned height = translated_frame->height(); | 1344 unsigned height = translated_frame->height(); |
| 1345 unsigned height_in_bytes = height * kPointerSize; | 1345 unsigned height_in_bytes = height * kPointerSize; |
| 1346 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); | 1346 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); |
| 1347 value_iterator++; | 1347 value_iterator++; |
| 1348 input_index++; | 1348 input_index++; |
| 1349 if (trace_scope_ != NULL) { | 1349 if (trace_scope_ != NULL) { |
| 1350 PrintF(trace_scope_->file(), | 1350 PrintF(trace_scope_->file(), |
| 1351 " translating arguments adaptor => height=%d\n", height_in_bytes); | 1351 " translating arguments adaptor => height=%d\n", height_in_bytes); |
| 1352 } | 1352 } |
| 1353 | 1353 |
| 1354 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize; | 1354 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFixedFrameSize; |
| 1355 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1355 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 1356 | 1356 |
| 1357 // Allocate and store the output frame description. | 1357 // Allocate and store the output frame description. |
| 1358 int parameter_count = height; | 1358 int parameter_count = height; |
| 1359 FrameDescription* output_frame = new (output_frame_size) | 1359 FrameDescription* output_frame = new (output_frame_size) |
| 1360 FrameDescription(output_frame_size, parameter_count); | 1360 FrameDescription(output_frame_size, parameter_count); |
| 1361 output_frame->SetFrameType(StackFrame::ARGUMENTS_ADAPTOR); | 1361 output_frame->SetFrameType(StackFrame::ARGUMENTS_ADAPTOR); |
| 1362 | 1362 |
| 1363 // Arguments adaptor can not be topmost or bottommost. | 1363 // Arguments adaptor can not be topmost or bottommost. |
| 1364 CHECK(frame_index > 0 && frame_index < output_count_ - 1); | 1364 CHECK(frame_index > 0 && frame_index < output_count_ - 1); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 unsigned height = translated_frame->height(); | 1452 unsigned height = translated_frame->height(); |
| 1453 unsigned height_in_bytes = height * kPointerSize; | 1453 unsigned height_in_bytes = height * kPointerSize; |
| 1454 // Skip function. | 1454 // Skip function. |
| 1455 value_iterator++; | 1455 value_iterator++; |
| 1456 input_index++; | 1456 input_index++; |
| 1457 if (trace_scope_ != NULL) { | 1457 if (trace_scope_ != NULL) { |
| 1458 PrintF(trace_scope_->file(), | 1458 PrintF(trace_scope_->file(), |
| 1459 " translating construct stub => height=%d\n", height_in_bytes); | 1459 " translating construct stub => height=%d\n", height_in_bytes); |
| 1460 } | 1460 } |
| 1461 | 1461 |
| 1462 unsigned fixed_frame_size = ConstructFrameConstants::kFrameSize; | 1462 unsigned fixed_frame_size = ConstructFrameConstants::kFixedFrameSize; |
| 1463 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1463 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 1464 | 1464 |
| 1465 // Allocate and store the output frame description. | 1465 // Allocate and store the output frame description. |
| 1466 FrameDescription* output_frame = | 1466 FrameDescription* output_frame = |
| 1467 new (output_frame_size) FrameDescription(output_frame_size); | 1467 new (output_frame_size) FrameDescription(output_frame_size); |
| 1468 output_frame->SetFrameType(StackFrame::CONSTRUCT); | 1468 output_frame->SetFrameType(StackFrame::CONSTRUCT); |
| 1469 | 1469 |
| 1470 // Construct stub can not be topmost or bottommost. | 1470 // Construct stub can not be topmost or bottommost. |
| 1471 DCHECK(frame_index > 0 && frame_index < output_count_ - 1); | 1471 DCHECK(frame_index > 0 && frame_index < output_count_ - 1); |
| 1472 DCHECK(output_[frame_index] == NULL); | 1472 DCHECK(output_[frame_index] == NULL); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 | 1507 |
| 1508 if (FLAG_enable_embedded_constant_pool) { | 1508 if (FLAG_enable_embedded_constant_pool) { |
| 1509 // Read the caller's constant pool from the previous frame. | 1509 // Read the caller's constant pool from the previous frame. |
| 1510 output_offset -= kPointerSize; | 1510 output_offset -= kPointerSize; |
| 1511 value = output_[frame_index - 1]->GetConstantPool(); | 1511 value = output_[frame_index - 1]->GetConstantPool(); |
| 1512 output_frame->SetCallerConstantPool(output_offset, value); | 1512 output_frame->SetCallerConstantPool(output_offset, value); |
| 1513 DebugPrintOutputSlot(value, frame_index, output_offset, | 1513 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1514 "caller's constant_pool\n"); | 1514 "caller's constant_pool\n"); |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 // A marker value is used to mark the frame. |
| 1518 output_offset -= kPointerSize; |
| 1519 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); |
| 1520 output_frame->SetFrameSlot(output_offset, value); |
| 1521 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1522 "typed frame marker\n"); |
| 1523 |
| 1517 // The context can be gotten from the previous frame. | 1524 // The context can be gotten from the previous frame. |
| 1518 output_offset -= kPointerSize; | 1525 output_offset -= kPointerSize; |
| 1519 value = output_[frame_index - 1]->GetContext(); | 1526 value = output_[frame_index - 1]->GetContext(); |
| 1520 output_frame->SetFrameSlot(output_offset, value); | 1527 output_frame->SetFrameSlot(output_offset, value); |
| 1521 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); | 1528 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); |
| 1522 | 1529 |
| 1523 // A marker value is used in place of the function. | |
| 1524 output_offset -= kPointerSize; | |
| 1525 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); | |
| 1526 output_frame->SetFrameSlot(output_offset, value); | |
| 1527 DebugPrintOutputSlot(value, frame_index, output_offset, | |
| 1528 "function (construct sentinel)\n"); | |
| 1529 | |
| 1530 // The output frame reflects a JSConstructStubGeneric frame. | |
| 1531 output_offset -= kPointerSize; | |
| 1532 value = reinterpret_cast<intptr_t>(construct_stub); | |
| 1533 output_frame->SetFrameSlot(output_offset, value); | |
| 1534 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n"); | |
| 1535 | |
| 1536 // The allocation site. | 1530 // The allocation site. |
| 1537 output_offset -= kPointerSize; | 1531 output_offset -= kPointerSize; |
| 1538 value = reinterpret_cast<intptr_t>(isolate_->heap()->undefined_value()); | 1532 value = reinterpret_cast<intptr_t>(isolate_->heap()->undefined_value()); |
| 1539 output_frame->SetFrameSlot(output_offset, value); | 1533 output_frame->SetFrameSlot(output_offset, value); |
| 1540 DebugPrintOutputSlot(value, frame_index, output_offset, "allocation site\n"); | 1534 DebugPrintOutputSlot(value, frame_index, output_offset, "allocation site\n"); |
| 1541 | 1535 |
| 1542 // Number of incoming arguments. | 1536 // Number of incoming arguments. |
| 1543 output_offset -= kPointerSize; | 1537 output_offset -= kPointerSize; |
| 1544 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); | 1538 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); |
| 1545 output_frame->SetFrameSlot(output_offset, value); | 1539 output_frame->SetFrameSlot(output_offset, value); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 // frame. This means that we have to use a height of 0. | 1579 // frame. This means that we have to use a height of 0. |
| 1586 unsigned height = 0; | 1580 unsigned height = 0; |
| 1587 unsigned height_in_bytes = height * kPointerSize; | 1581 unsigned height_in_bytes = height * kPointerSize; |
| 1588 const char* kind = is_setter_stub_frame ? "setter" : "getter"; | 1582 const char* kind = is_setter_stub_frame ? "setter" : "getter"; |
| 1589 if (trace_scope_ != NULL) { | 1583 if (trace_scope_ != NULL) { |
| 1590 PrintF(trace_scope_->file(), | 1584 PrintF(trace_scope_->file(), |
| 1591 " translating %s stub => height=%u\n", kind, height_in_bytes); | 1585 " translating %s stub => height=%u\n", kind, height_in_bytes); |
| 1592 } | 1586 } |
| 1593 | 1587 |
| 1594 // We need 1 stack entry for the return address and enough entries for the | 1588 // We need 1 stack entry for the return address and enough entries for the |
| 1595 // StackFrame::INTERNAL (FP, context, frame type, code object and constant | 1589 // StackFrame::INTERNAL (FP, frame type, context, code object and constant |
| 1596 // pool (if enabled)- see MacroAssembler::EnterFrame). | 1590 // pool (if enabled)- see MacroAssembler::EnterFrame). |
| 1597 // For a setter stub frame we need one additional entry for the implicit | 1591 // For a setter stub frame we need one additional entry for the implicit |
| 1598 // return value, see StoreStubCompiler::CompileStoreViaSetter. | 1592 // return value, see StoreStubCompiler::CompileStoreViaSetter. |
| 1599 unsigned fixed_frame_entries = | 1593 unsigned fixed_frame_entries = |
| 1600 (StandardFrameConstants::kFixedFrameSize / kPointerSize) + 1 + | 1594 (StandardFrameConstants::kFixedFrameSize / kPointerSize) + 1 + |
| 1601 (is_setter_stub_frame ? 1 : 0); | 1595 (is_setter_stub_frame ? 1 : 0); |
| 1602 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; | 1596 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; |
| 1603 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1597 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 1604 | 1598 |
| 1605 // Allocate and store the output frame description. | 1599 // Allocate and store the output frame description. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1635 | 1629 |
| 1636 if (FLAG_enable_embedded_constant_pool) { | 1630 if (FLAG_enable_embedded_constant_pool) { |
| 1637 // Read the caller's constant pool from the previous frame. | 1631 // Read the caller's constant pool from the previous frame. |
| 1638 output_offset -= kPointerSize; | 1632 output_offset -= kPointerSize; |
| 1639 value = output_[frame_index - 1]->GetConstantPool(); | 1633 value = output_[frame_index - 1]->GetConstantPool(); |
| 1640 output_frame->SetCallerConstantPool(output_offset, value); | 1634 output_frame->SetCallerConstantPool(output_offset, value); |
| 1641 DebugPrintOutputSlot(value, frame_index, output_offset, | 1635 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1642 "caller's constant_pool\n"); | 1636 "caller's constant_pool\n"); |
| 1643 } | 1637 } |
| 1644 | 1638 |
| 1645 // The context can be gotten from the previous frame. | 1639 // Set the frame type. |
| 1646 output_offset -= kPointerSize; | |
| 1647 value = output_[frame_index - 1]->GetContext(); | |
| 1648 output_frame->SetFrameSlot(output_offset, value); | |
| 1649 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); | |
| 1650 | |
| 1651 // A marker value is used in place of the function. | |
| 1652 output_offset -= kPointerSize; | 1640 output_offset -= kPointerSize; |
| 1653 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); | 1641 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); |
| 1654 output_frame->SetFrameSlot(output_offset, value); | 1642 output_frame->SetFrameSlot(output_offset, value); |
| 1655 DebugPrintOutputSlot(value, frame_index, output_offset, "function "); | 1643 DebugPrintOutputSlot(value, frame_index, output_offset, "frame type "); |
| 1656 if (trace_scope_ != nullptr) { | 1644 if (trace_scope_ != nullptr) { |
| 1657 PrintF(trace_scope_->file(), "(%s sentinel)\n", kind); | 1645 PrintF(trace_scope_->file(), "(%s sentinel)\n", kind); |
| 1658 } | 1646 } |
| 1659 | 1647 |
| 1660 // Get Code object from accessor stub. | 1648 // Get Code object from accessor stub. |
| 1661 output_offset -= kPointerSize; | 1649 output_offset -= kPointerSize; |
| 1662 Builtins::Name name = is_setter_stub_frame ? | 1650 Builtins::Name name = is_setter_stub_frame ? |
| 1663 Builtins::kStoreIC_Setter_ForDeopt : | 1651 Builtins::kStoreIC_Setter_ForDeopt : |
| 1664 Builtins::kLoadIC_Getter_ForDeopt; | 1652 Builtins::kLoadIC_Getter_ForDeopt; |
| 1665 Code* accessor_stub = isolate_->builtins()->builtin(name); | 1653 Code* accessor_stub = isolate_->builtins()->builtin(name); |
| 1666 value = reinterpret_cast<intptr_t>(accessor_stub); | 1654 value = reinterpret_cast<intptr_t>(accessor_stub); |
| 1667 output_frame->SetFrameSlot(output_offset, value); | 1655 output_frame->SetFrameSlot(output_offset, value); |
| 1668 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n"); | 1656 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n"); |
| 1669 | 1657 |
| 1658 // The context can be gotten from the previous frame. |
| 1659 output_offset -= kPointerSize; |
| 1660 value = output_[frame_index - 1]->GetContext(); |
| 1661 output_frame->SetFrameSlot(output_offset, value); |
| 1662 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); |
| 1663 |
| 1670 // Skip receiver. | 1664 // Skip receiver. |
| 1671 value_iterator++; | 1665 value_iterator++; |
| 1672 input_index++; | 1666 input_index++; |
| 1673 | 1667 |
| 1674 if (is_setter_stub_frame) { | 1668 if (is_setter_stub_frame) { |
| 1675 // The implicit return value was part of the artificial setter stub | 1669 // The implicit return value was part of the artificial setter stub |
| 1676 // environment. | 1670 // environment. |
| 1677 output_offset -= kPointerSize; | 1671 output_offset -= kPointerSize; |
| 1678 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, | 1672 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 1679 output_offset); | 1673 output_offset); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 // and the standard stack frame slots. Include space for an argument | 1738 // and the standard stack frame slots. Include space for an argument |
| 1745 // object to the callee and optionally the space to pass the argument | 1739 // object to the callee and optionally the space to pass the argument |
| 1746 // object to the stub failure handler. | 1740 // object to the stub failure handler. |
| 1747 int param_count = descriptor.GetRegisterParameterCount(); | 1741 int param_count = descriptor.GetRegisterParameterCount(); |
| 1748 int stack_param_count = descriptor.GetStackParameterCount(); | 1742 int stack_param_count = descriptor.GetStackParameterCount(); |
| 1749 // The translated frame contains all of the register parameters | 1743 // The translated frame contains all of the register parameters |
| 1750 // plus the context. | 1744 // plus the context. |
| 1751 CHECK_EQ(translated_frame->height(), param_count + 1); | 1745 CHECK_EQ(translated_frame->height(), param_count + 1); |
| 1752 CHECK_GE(param_count, 0); | 1746 CHECK_GE(param_count, 0); |
| 1753 | 1747 |
| 1754 int height_in_bytes = kPointerSize * (param_count + stack_param_count) + | 1748 int height_in_bytes = kPointerSize * (param_count + stack_param_count); |
| 1755 sizeof(Arguments) + kPointerSize; | 1749 int fixed_frame_size = StubFailureTrampolineFrameConstants::kFixedFrameSize; |
| 1756 int fixed_frame_size = StandardFrameConstants::kFixedFrameSize; | |
| 1757 int input_frame_size = input_->GetFrameSize(); | 1750 int input_frame_size = input_->GetFrameSize(); |
| 1758 int output_frame_size = height_in_bytes + fixed_frame_size; | 1751 int output_frame_size = height_in_bytes + fixed_frame_size; |
| 1759 if (trace_scope_ != NULL) { | 1752 if (trace_scope_ != NULL) { |
| 1760 PrintF(trace_scope_->file(), | 1753 PrintF(trace_scope_->file(), |
| 1761 " translating %s => StubFailureTrampolineStub, height=%d\n", | 1754 " translating %s => StubFailureTrampolineStub, height=%d\n", |
| 1762 CodeStub::MajorName(static_cast<CodeStub::Major>(major_key)), | 1755 CodeStub::MajorName(static_cast<CodeStub::Major>(major_key)), |
| 1763 height_in_bytes); | 1756 height_in_bytes); |
| 1764 } | 1757 } |
| 1765 | 1758 |
| 1766 // The stub failure trampoline is a single frame. | 1759 // The stub failure trampoline is a single frame. |
| 1767 FrameDescription* output_frame = | 1760 FrameDescription* output_frame = |
| 1768 new (output_frame_size) FrameDescription(output_frame_size); | 1761 new (output_frame_size) FrameDescription(output_frame_size); |
| 1769 output_frame->SetFrameType(StackFrame::STUB_FAILURE_TRAMPOLINE); | 1762 output_frame->SetFrameType(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 1770 CHECK_EQ(frame_index, 0); | 1763 CHECK_EQ(frame_index, 0); |
| 1771 output_[frame_index] = output_frame; | 1764 output_[frame_index] = output_frame; |
| 1772 | 1765 |
| 1773 // The top address for the output frame can be computed from the input | 1766 // The top address for the output frame can be computed from the input |
| 1774 // frame pointer and the output frame's height. Subtract space for the | 1767 // frame pointer and the output frame's height. Subtract space for the |
| 1775 // context and function slots. | 1768 // context and function slots. |
| 1776 Register fp_reg = StubFailureTrampolineFrame::fp_register(); | 1769 Register fp_reg = StubFailureTrampolineFrame::fp_register(); |
| 1777 intptr_t top_address = input_->GetRegister(fp_reg.code()) - | 1770 intptr_t top_address = |
| 1778 StandardFrameConstants::kFixedFrameSizeFromFp - height_in_bytes; | 1771 input_->GetRegister(fp_reg.code()) - |
| 1772 StubFailureTrampolineFrameConstants::kFixedFrameSizeFromFp - |
| 1773 height_in_bytes; |
| 1779 output_frame->SetTop(top_address); | 1774 output_frame->SetTop(top_address); |
| 1780 | 1775 |
| 1781 // Read caller's PC (JSFunction continuation) from the input frame. | 1776 // Read caller's PC (JSFunction continuation) from the input frame. |
| 1782 unsigned input_frame_offset = input_frame_size - kPCOnStackSize; | 1777 unsigned input_frame_offset = input_frame_size - kPCOnStackSize; |
| 1783 unsigned output_frame_offset = output_frame_size - kFPOnStackSize; | 1778 unsigned output_frame_offset = output_frame_size - kFPOnStackSize; |
| 1784 intptr_t value = input_->GetFrameSlot(input_frame_offset); | 1779 intptr_t value = input_->GetFrameSlot(input_frame_offset); |
| 1785 output_frame->SetCallerPc(output_frame_offset, value); | 1780 output_frame->SetCallerPc(output_frame_offset, value); |
| 1786 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | 1781 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1787 "caller's pc\n"); | 1782 "caller's pc\n"); |
| 1788 | 1783 |
| 1789 // Read caller's FP from the input frame, and set this frame's FP. | 1784 // Read caller's FP from the input frame, and set this frame's FP. |
| 1790 input_frame_offset -= kFPOnStackSize; | 1785 input_frame_offset -= kFPOnStackSize; |
| 1791 value = input_->GetFrameSlot(input_frame_offset); | |
| 1792 output_frame_offset -= kFPOnStackSize; | 1786 output_frame_offset -= kFPOnStackSize; |
| 1793 output_frame->SetCallerFp(output_frame_offset, value); | 1787 intptr_t parent_frame_ptr = input_->GetFrameSlot(input_frame_offset); |
| 1788 output_frame->SetCallerFp(output_frame_offset, parent_frame_ptr); |
| 1794 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); | 1789 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); |
| 1795 output_frame->SetRegister(fp_reg.code(), frame_ptr); | 1790 output_frame->SetRegister(fp_reg.code(), frame_ptr); |
| 1796 output_frame->SetFp(frame_ptr); | 1791 output_frame->SetFp(frame_ptr); |
| 1797 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | 1792 DebugPrintOutputSlot(frame_ptr, frame_index, output_frame_offset, |
| 1798 "caller's fp\n"); | 1793 "caller's fp\n"); |
| 1799 | 1794 |
| 1800 if (FLAG_enable_embedded_constant_pool) { | 1795 if (FLAG_enable_embedded_constant_pool) { |
| 1801 // Read the caller's constant pool from the input frame. | 1796 // Read the caller's constant pool from the input frame. |
| 1802 input_frame_offset -= kPointerSize; | 1797 input_frame_offset -= kPointerSize; |
| 1803 value = input_->GetFrameSlot(input_frame_offset); | 1798 value = input_->GetFrameSlot(input_frame_offset); |
| 1804 output_frame_offset -= kPointerSize; | 1799 output_frame_offset -= kPointerSize; |
| 1805 output_frame->SetCallerConstantPool(output_frame_offset, value); | 1800 output_frame->SetCallerConstantPool(output_frame_offset, value); |
| 1806 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | 1801 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1807 "caller's constant_pool\n"); | 1802 "caller's constant_pool\n"); |
| 1808 } | 1803 } |
| 1809 | 1804 |
| 1810 // Remember where the context will need to be written back from the deopt | 1805 // The marker for the typed stack frame |
| 1811 // translation. | |
| 1812 output_frame_offset -= kPointerSize; | |
| 1813 unsigned context_frame_offset = output_frame_offset; | |
| 1814 | |
| 1815 // A marker value is used in place of the function. | |
| 1816 output_frame_offset -= kPointerSize; | 1806 output_frame_offset -= kPointerSize; |
| 1817 value = reinterpret_cast<intptr_t>( | 1807 value = reinterpret_cast<intptr_t>( |
| 1818 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); | 1808 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); |
| 1819 output_frame->SetFrameSlot(output_frame_offset, value); | 1809 output_frame->SetFrameSlot(output_frame_offset, value); |
| 1820 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | 1810 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1821 "function (stub failure sentinel)\n"); | 1811 "function (stub failure sentinel)\n"); |
| 1822 | 1812 |
| 1823 intptr_t caller_arg_count = stack_param_count; | 1813 intptr_t caller_arg_count = stack_param_count; |
| 1824 bool arg_count_known = !descriptor.stack_parameter_count().is_valid(); | 1814 bool arg_count_known = !descriptor.stack_parameter_count().is_valid(); |
| 1825 | 1815 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 .is(descriptor.stack_parameter_count())) { | 1856 .is(descriptor.stack_parameter_count())) { |
| 1867 arguments_length_offset = output_frame_offset; | 1857 arguments_length_offset = output_frame_offset; |
| 1868 } | 1858 } |
| 1869 } | 1859 } |
| 1870 | 1860 |
| 1871 Object* maybe_context = value_iterator->GetRawValue(); | 1861 Object* maybe_context = value_iterator->GetRawValue(); |
| 1872 CHECK(maybe_context->IsContext()); | 1862 CHECK(maybe_context->IsContext()); |
| 1873 Register context_reg = StubFailureTrampolineFrame::context_register(); | 1863 Register context_reg = StubFailureTrampolineFrame::context_register(); |
| 1874 value = reinterpret_cast<intptr_t>(maybe_context); | 1864 value = reinterpret_cast<intptr_t>(maybe_context); |
| 1875 output_frame->SetRegister(context_reg.code(), value); | 1865 output_frame->SetRegister(context_reg.code(), value); |
| 1876 output_frame->SetFrameSlot(context_frame_offset, value); | |
| 1877 DebugPrintOutputSlot(value, frame_index, context_frame_offset, "context\n"); | |
| 1878 ++value_iterator; | 1866 ++value_iterator; |
| 1879 | 1867 |
| 1880 // Copy constant stack parameters to the failure frame. If the number of stack | 1868 // Copy constant stack parameters to the failure frame. If the number of stack |
| 1881 // parameters is not known in the descriptor, the arguments object is the way | 1869 // parameters is not known in the descriptor, the arguments object is the way |
| 1882 // to access them. | 1870 // to access them. |
| 1883 for (int i = 0; i < stack_param_count; i++) { | 1871 for (int i = 0; i < stack_param_count; i++) { |
| 1884 output_frame_offset -= kPointerSize; | 1872 output_frame_offset -= kPointerSize; |
| 1885 Object** stack_parameter = reinterpret_cast<Object**>( | 1873 Object** stack_parameter = reinterpret_cast<Object**>( |
| 1886 frame_ptr + StandardFrameConstants::kCallerSPOffset + | 1874 frame_ptr + StandardFrameConstants::kCallerSPOffset + |
| 1887 (stack_param_count - i - 1) * kPointerSize); | 1875 (stack_param_count - i - 1) * kPointerSize); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2019 output_offset; | 2007 output_offset; |
| 2020 PrintF(trace_scope_->file(), | 2008 PrintF(trace_scope_->file(), |
| 2021 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s", | 2009 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s", |
| 2022 reinterpret_cast<intptr_t>(output_address), output_offset, value, | 2010 reinterpret_cast<intptr_t>(output_address), output_offset, value, |
| 2023 debug_hint_string == nullptr ? "" : debug_hint_string); | 2011 debug_hint_string == nullptr ? "" : debug_hint_string); |
| 2024 } | 2012 } |
| 2025 } | 2013 } |
| 2026 | 2014 |
| 2027 | 2015 |
| 2028 unsigned Deoptimizer::ComputeInputFrameSize() const { | 2016 unsigned Deoptimizer::ComputeInputFrameSize() const { |
| 2029 unsigned fixed_size = StandardFrameConstants::kFixedFrameSize; | 2017 unsigned fixed_size = (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) |
| 2030 if (!function_->IsSmi()) { | 2018 ? ComputeJavascriptFixedSize(function_->shared()) |
| 2031 fixed_size += ComputeIncomingArgumentSize(function_->shared()); | 2019 : TypedFrameConstants::kFixedFrameSize; |
| 2032 } else { | |
| 2033 CHECK_EQ(Smi::cast(function_), Smi::FromInt(StackFrame::STUB)); | |
| 2034 } | |
| 2035 // The fp-to-sp delta already takes the context, constant pool pointer and the | 2020 // The fp-to-sp delta already takes the context, constant pool pointer and the |
| 2036 // function into account so we have to avoid double counting them. | 2021 // function into account so we have to avoid double counting them. |
| 2037 unsigned result = fixed_size + fp_to_sp_delta_ - | 2022 unsigned result = fixed_size + fp_to_sp_delta_ - |
| 2038 StandardFrameConstants::kFixedFrameSizeFromFp; | 2023 ((compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) |
| 2024 ? StandardFrameConstants::kFixedFrameSizeFromFp |
| 2025 : TypedFrameConstants::kFixedFrameSizeFromFp); |
| 2039 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { | 2026 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { |
| 2040 unsigned stack_slots = compiled_code_->stack_slots(); | 2027 unsigned stack_slots = compiled_code_->stack_slots(); |
| 2041 unsigned outgoing_size = | 2028 unsigned outgoing_size = |
| 2042 ComputeOutgoingArgumentSize(compiled_code_, bailout_id_); | 2029 ComputeOutgoingArgumentSize(compiled_code_, bailout_id_); |
| 2043 CHECK(result == | 2030 CHECK(result == |
| 2044 fixed_size + (stack_slots * kPointerSize) - | 2031 fixed_size + (stack_slots * kPointerSize) - |
| 2045 StandardFrameConstants::kFixedFrameSize + outgoing_size); | 2032 StandardFrameConstants::kFixedFrameSize + outgoing_size); |
| 2046 } | 2033 } |
| 2047 return result; | 2034 return result; |
| 2048 } | 2035 } |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2355 int args_length) { | 2342 int args_length) { |
| 2356 buffer_->Add(ARGUMENTS_OBJECT, zone()); | 2343 buffer_->Add(ARGUMENTS_OBJECT, zone()); |
| 2357 buffer_->Add(args_known, zone()); | 2344 buffer_->Add(args_known, zone()); |
| 2358 buffer_->Add(args_index, zone()); | 2345 buffer_->Add(args_index, zone()); |
| 2359 buffer_->Add(args_length, zone()); | 2346 buffer_->Add(args_length, zone()); |
| 2360 } | 2347 } |
| 2361 | 2348 |
| 2362 | 2349 |
| 2363 void Translation::StoreJSFrameFunction() { | 2350 void Translation::StoreJSFrameFunction() { |
| 2364 StoreStackSlot((StandardFrameConstants::kCallerPCOffset - | 2351 StoreStackSlot((StandardFrameConstants::kCallerPCOffset - |
| 2365 StandardFrameConstants::kMarkerOffset) / | 2352 StandardFrameConstants::kFunctionOffset) / |
| 2366 kPointerSize); | 2353 kPointerSize); |
| 2367 } | 2354 } |
| 2368 | 2355 |
| 2369 int Translation::NumberOfOperandsFor(Opcode opcode) { | 2356 int Translation::NumberOfOperandsFor(Opcode opcode) { |
| 2370 switch (opcode) { | 2357 switch (opcode) { |
| 2371 case GETTER_STUB_FRAME: | 2358 case GETTER_STUB_FRAME: |
| 2372 case SETTER_STUB_FRAME: | 2359 case SETTER_STUB_FRAME: |
| 2373 case DUPLICATED_OBJECT: | 2360 case DUPLICATED_OBJECT: |
| 2374 case ARGUMENTS_OBJECT: | 2361 case ARGUMENTS_OBJECT: |
| 2375 case CAPTURED_OBJECT: | 2362 case CAPTURED_OBJECT: |
| (...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3756 CHECK(value_info->IsMaterializedObject()); | 3743 CHECK(value_info->IsMaterializedObject()); |
| 3757 | 3744 |
| 3758 value_info->value_ = | 3745 value_info->value_ = |
| 3759 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 3746 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
| 3760 } | 3747 } |
| 3761 } | 3748 } |
| 3762 } | 3749 } |
| 3763 | 3750 |
| 3764 } // namespace internal | 3751 } // namespace internal |
| 3765 } // namespace v8 | 3752 } // namespace v8 |
| OLD | NEW |