| 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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 unsigned height = translated_frame->height(); | 1315 unsigned height = translated_frame->height(); |
| 1316 unsigned height_in_bytes = height * kPointerSize; | 1316 unsigned height_in_bytes = height * kPointerSize; |
| 1317 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); | 1317 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); |
| 1318 value_iterator++; | 1318 value_iterator++; |
| 1319 input_index++; | 1319 input_index++; |
| 1320 if (trace_scope_ != NULL) { | 1320 if (trace_scope_ != NULL) { |
| 1321 PrintF(trace_scope_->file(), | 1321 PrintF(trace_scope_->file(), |
| 1322 " translating arguments adaptor => height=%d\n", height_in_bytes); | 1322 " translating arguments adaptor => height=%d\n", height_in_bytes); |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize; | 1325 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFixedFrameSize; |
| 1326 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1326 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 1327 | 1327 |
| 1328 // Allocate and store the output frame description. | 1328 // Allocate and store the output frame description. |
| 1329 int parameter_count = height; | 1329 int parameter_count = height; |
| 1330 FrameDescription* output_frame = new (output_frame_size) | 1330 FrameDescription* output_frame = new (output_frame_size) |
| 1331 FrameDescription(output_frame_size, parameter_count); | 1331 FrameDescription(output_frame_size, parameter_count); |
| 1332 output_frame->SetFrameType(StackFrame::ARGUMENTS_ADAPTOR); | 1332 output_frame->SetFrameType(StackFrame::ARGUMENTS_ADAPTOR); |
| 1333 | 1333 |
| 1334 // Arguments adaptor can not be topmost or bottommost. | 1334 // Arguments adaptor can not be topmost or bottommost. |
| 1335 CHECK(frame_index > 0 && frame_index < output_count_ - 1); | 1335 CHECK(frame_index > 0 && frame_index < output_count_ - 1); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 unsigned height = translated_frame->height(); | 1423 unsigned height = translated_frame->height(); |
| 1424 unsigned height_in_bytes = height * kPointerSize; | 1424 unsigned height_in_bytes = height * kPointerSize; |
| 1425 // Skip function. | 1425 // Skip function. |
| 1426 value_iterator++; | 1426 value_iterator++; |
| 1427 input_index++; | 1427 input_index++; |
| 1428 if (trace_scope_ != NULL) { | 1428 if (trace_scope_ != NULL) { |
| 1429 PrintF(trace_scope_->file(), | 1429 PrintF(trace_scope_->file(), |
| 1430 " translating construct stub => height=%d\n", height_in_bytes); | 1430 " translating construct stub => height=%d\n", height_in_bytes); |
| 1431 } | 1431 } |
| 1432 | 1432 |
| 1433 unsigned fixed_frame_size = ConstructFrameConstants::kFrameSize; | 1433 unsigned fixed_frame_size = ConstructFrameConstants::kFixedFrameSize; |
| 1434 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1434 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 1435 | 1435 |
| 1436 // Allocate and store the output frame description. | 1436 // Allocate and store the output frame description. |
| 1437 FrameDescription* output_frame = | 1437 FrameDescription* output_frame = |
| 1438 new (output_frame_size) FrameDescription(output_frame_size); | 1438 new (output_frame_size) FrameDescription(output_frame_size); |
| 1439 output_frame->SetFrameType(StackFrame::CONSTRUCT); | 1439 output_frame->SetFrameType(StackFrame::CONSTRUCT); |
| 1440 | 1440 |
| 1441 // Construct stub can not be topmost or bottommost. | 1441 // Construct stub can not be topmost or bottommost. |
| 1442 DCHECK(frame_index > 0 && frame_index < output_count_ - 1); | 1442 DCHECK(frame_index > 0 && frame_index < output_count_ - 1); |
| 1443 DCHECK(output_[frame_index] == NULL); | 1443 DCHECK(output_[frame_index] == NULL); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 | 1478 |
| 1479 if (FLAG_enable_embedded_constant_pool) { | 1479 if (FLAG_enable_embedded_constant_pool) { |
| 1480 // Read the caller's constant pool from the previous frame. | 1480 // Read the caller's constant pool from the previous frame. |
| 1481 output_offset -= kPointerSize; | 1481 output_offset -= kPointerSize; |
| 1482 value = output_[frame_index - 1]->GetConstantPool(); | 1482 value = output_[frame_index - 1]->GetConstantPool(); |
| 1483 output_frame->SetCallerConstantPool(output_offset, value); | 1483 output_frame->SetCallerConstantPool(output_offset, value); |
| 1484 DebugPrintOutputSlot(value, frame_index, output_offset, | 1484 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1485 "caller's constant_pool\n"); | 1485 "caller's constant_pool\n"); |
| 1486 } | 1486 } |
| 1487 | 1487 |
| 1488 // A marker value is used to mark the frame. |
| 1489 output_offset -= kPointerSize; |
| 1490 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); |
| 1491 output_frame->SetFrameSlot(output_offset, value); |
| 1492 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1493 "typed frame marker\n"); |
| 1494 |
| 1488 // The context can be gotten from the previous frame. | 1495 // The context can be gotten from the previous frame. |
| 1489 output_offset -= kPointerSize; | 1496 output_offset -= kPointerSize; |
| 1490 value = output_[frame_index - 1]->GetContext(); | 1497 value = output_[frame_index - 1]->GetContext(); |
| 1491 output_frame->SetFrameSlot(output_offset, value); | 1498 output_frame->SetFrameSlot(output_offset, value); |
| 1492 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); | 1499 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); |
| 1493 | 1500 |
| 1494 // A marker value is used in place of the function. | |
| 1495 output_offset -= kPointerSize; | |
| 1496 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); | |
| 1497 output_frame->SetFrameSlot(output_offset, value); | |
| 1498 DebugPrintOutputSlot(value, frame_index, output_offset, | |
| 1499 "function (construct sentinel)\n"); | |
| 1500 | |
| 1501 // The output frame reflects a JSConstructStubGeneric frame. | |
| 1502 output_offset -= kPointerSize; | |
| 1503 value = reinterpret_cast<intptr_t>(construct_stub); | |
| 1504 output_frame->SetFrameSlot(output_offset, value); | |
| 1505 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n"); | |
| 1506 | |
| 1507 // The allocation site. | 1501 // The allocation site. |
| 1508 output_offset -= kPointerSize; | 1502 output_offset -= kPointerSize; |
| 1509 value = reinterpret_cast<intptr_t>(isolate_->heap()->undefined_value()); | 1503 value = reinterpret_cast<intptr_t>(isolate_->heap()->undefined_value()); |
| 1510 output_frame->SetFrameSlot(output_offset, value); | 1504 output_frame->SetFrameSlot(output_offset, value); |
| 1511 DebugPrintOutputSlot(value, frame_index, output_offset, "allocation site\n"); | 1505 DebugPrintOutputSlot(value, frame_index, output_offset, "allocation site\n"); |
| 1512 | 1506 |
| 1513 // Number of incoming arguments. | 1507 // Number of incoming arguments. |
| 1514 output_offset -= kPointerSize; | 1508 output_offset -= kPointerSize; |
| 1515 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); | 1509 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); |
| 1516 output_frame->SetFrameSlot(output_offset, value); | 1510 output_frame->SetFrameSlot(output_offset, value); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 // frame. This means that we have to use a height of 0. | 1550 // frame. This means that we have to use a height of 0. |
| 1557 unsigned height = 0; | 1551 unsigned height = 0; |
| 1558 unsigned height_in_bytes = height * kPointerSize; | 1552 unsigned height_in_bytes = height * kPointerSize; |
| 1559 const char* kind = is_setter_stub_frame ? "setter" : "getter"; | 1553 const char* kind = is_setter_stub_frame ? "setter" : "getter"; |
| 1560 if (trace_scope_ != NULL) { | 1554 if (trace_scope_ != NULL) { |
| 1561 PrintF(trace_scope_->file(), | 1555 PrintF(trace_scope_->file(), |
| 1562 " translating %s stub => height=%u\n", kind, height_in_bytes); | 1556 " translating %s stub => height=%u\n", kind, height_in_bytes); |
| 1563 } | 1557 } |
| 1564 | 1558 |
| 1565 // We need 1 stack entry for the return address and enough entries for the | 1559 // We need 1 stack entry for the return address and enough entries for the |
| 1566 // StackFrame::INTERNAL (FP, context, frame type, code object and constant | 1560 // StackFrame::INTERNAL (FP, frame type, context, code object and constant |
| 1567 // pool (if enabled)- see MacroAssembler::EnterFrame). | 1561 // pool (if enabled)- see MacroAssembler::EnterFrame). |
| 1568 // For a setter stub frame we need one additional entry for the implicit | 1562 // For a setter stub frame we need one additional entry for the implicit |
| 1569 // return value, see StoreStubCompiler::CompileStoreViaSetter. | 1563 // return value, see StoreStubCompiler::CompileStoreViaSetter. |
| 1570 unsigned fixed_frame_entries = | 1564 unsigned fixed_frame_entries = |
| 1571 (StandardFrameConstants::kFixedFrameSize / kPointerSize) + 1 + | 1565 (StandardFrameConstants::kFixedFrameSize / kPointerSize) + 1 + |
| 1572 (is_setter_stub_frame ? 1 : 0); | 1566 (is_setter_stub_frame ? 1 : 0); |
| 1573 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; | 1567 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; |
| 1574 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1568 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 1575 | 1569 |
| 1576 // Allocate and store the output frame description. | 1570 // Allocate and store the output frame description. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1606 | 1600 |
| 1607 if (FLAG_enable_embedded_constant_pool) { | 1601 if (FLAG_enable_embedded_constant_pool) { |
| 1608 // Read the caller's constant pool from the previous frame. | 1602 // Read the caller's constant pool from the previous frame. |
| 1609 output_offset -= kPointerSize; | 1603 output_offset -= kPointerSize; |
| 1610 value = output_[frame_index - 1]->GetConstantPool(); | 1604 value = output_[frame_index - 1]->GetConstantPool(); |
| 1611 output_frame->SetCallerConstantPool(output_offset, value); | 1605 output_frame->SetCallerConstantPool(output_offset, value); |
| 1612 DebugPrintOutputSlot(value, frame_index, output_offset, | 1606 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1613 "caller's constant_pool\n"); | 1607 "caller's constant_pool\n"); |
| 1614 } | 1608 } |
| 1615 | 1609 |
| 1616 // The context can be gotten from the previous frame. | 1610 // Set the frame type. |
| 1617 output_offset -= kPointerSize; | |
| 1618 value = output_[frame_index - 1]->GetContext(); | |
| 1619 output_frame->SetFrameSlot(output_offset, value); | |
| 1620 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); | |
| 1621 | |
| 1622 // A marker value is used in place of the function. | |
| 1623 output_offset -= kPointerSize; | 1611 output_offset -= kPointerSize; |
| 1624 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); | 1612 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); |
| 1625 output_frame->SetFrameSlot(output_offset, value); | 1613 output_frame->SetFrameSlot(output_offset, value); |
| 1626 DebugPrintOutputSlot(value, frame_index, output_offset, "function "); | 1614 DebugPrintOutputSlot(value, frame_index, output_offset, "frame type "); |
| 1627 if (trace_scope_ != nullptr) { | 1615 if (trace_scope_ != nullptr) { |
| 1628 PrintF(trace_scope_->file(), "(%s sentinel)\n", kind); | 1616 PrintF(trace_scope_->file(), "(%s sentinel)\n", kind); |
| 1629 } | 1617 } |
| 1630 | 1618 |
| 1631 // Get Code object from accessor stub. | 1619 // Get Code object from accessor stub. |
| 1632 output_offset -= kPointerSize; | 1620 output_offset -= kPointerSize; |
| 1633 Builtins::Name name = is_setter_stub_frame ? | 1621 Builtins::Name name = is_setter_stub_frame ? |
| 1634 Builtins::kStoreIC_Setter_ForDeopt : | 1622 Builtins::kStoreIC_Setter_ForDeopt : |
| 1635 Builtins::kLoadIC_Getter_ForDeopt; | 1623 Builtins::kLoadIC_Getter_ForDeopt; |
| 1636 Code* accessor_stub = isolate_->builtins()->builtin(name); | 1624 Code* accessor_stub = isolate_->builtins()->builtin(name); |
| 1637 value = reinterpret_cast<intptr_t>(accessor_stub); | 1625 value = reinterpret_cast<intptr_t>(accessor_stub); |
| 1638 output_frame->SetFrameSlot(output_offset, value); | 1626 output_frame->SetFrameSlot(output_offset, value); |
| 1639 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n"); | 1627 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n"); |
| 1640 | 1628 |
| 1629 // The context can be gotten from the previous frame. |
| 1630 output_offset -= kPointerSize; |
| 1631 value = output_[frame_index - 1]->GetContext(); |
| 1632 output_frame->SetFrameSlot(output_offset, value); |
| 1633 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); |
| 1634 |
| 1641 // Skip receiver. | 1635 // Skip receiver. |
| 1642 value_iterator++; | 1636 value_iterator++; |
| 1643 input_index++; | 1637 input_index++; |
| 1644 | 1638 |
| 1645 if (is_setter_stub_frame) { | 1639 if (is_setter_stub_frame) { |
| 1646 // The implicit return value was part of the artificial setter stub | 1640 // The implicit return value was part of the artificial setter stub |
| 1647 // environment. | 1641 // environment. |
| 1648 output_offset -= kPointerSize; | 1642 output_offset -= kPointerSize; |
| 1649 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, | 1643 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 1650 output_offset); | 1644 output_offset); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 // and the standard stack frame slots. Include space for an argument | 1709 // and the standard stack frame slots. Include space for an argument |
| 1716 // object to the callee and optionally the space to pass the argument | 1710 // object to the callee and optionally the space to pass the argument |
| 1717 // object to the stub failure handler. | 1711 // object to the stub failure handler. |
| 1718 int param_count = descriptor.GetRegisterParameterCount(); | 1712 int param_count = descriptor.GetRegisterParameterCount(); |
| 1719 int stack_param_count = descriptor.GetStackParameterCount(); | 1713 int stack_param_count = descriptor.GetStackParameterCount(); |
| 1720 // The translated frame contains all of the register parameters | 1714 // The translated frame contains all of the register parameters |
| 1721 // plus the context. | 1715 // plus the context. |
| 1722 CHECK_EQ(translated_frame->height(), param_count + 1); | 1716 CHECK_EQ(translated_frame->height(), param_count + 1); |
| 1723 CHECK_GE(param_count, 0); | 1717 CHECK_GE(param_count, 0); |
| 1724 | 1718 |
| 1725 int height_in_bytes = kPointerSize * (param_count + stack_param_count) + | 1719 int height_in_bytes = kPointerSize * (param_count + stack_param_count); |
| 1726 sizeof(Arguments) + kPointerSize; | 1720 int fixed_frame_size = StubFailureTrampolineFrameConstants::kFixedFrameSize; |
| 1727 int fixed_frame_size = StandardFrameConstants::kFixedFrameSize; | |
| 1728 int output_frame_size = height_in_bytes + fixed_frame_size; | 1721 int output_frame_size = height_in_bytes + fixed_frame_size; |
| 1729 if (trace_scope_ != NULL) { | 1722 if (trace_scope_ != NULL) { |
| 1730 PrintF(trace_scope_->file(), | 1723 PrintF(trace_scope_->file(), |
| 1731 " translating %s => StubFailureTrampolineStub, height=%d\n", | 1724 " translating %s => StubFailureTrampolineStub, height=%d\n", |
| 1732 CodeStub::MajorName(static_cast<CodeStub::Major>(major_key)), | 1725 CodeStub::MajorName(static_cast<CodeStub::Major>(major_key)), |
| 1733 height_in_bytes); | 1726 height_in_bytes); |
| 1734 } | 1727 } |
| 1735 | 1728 |
| 1736 // The stub failure trampoline is a single frame. | 1729 // The stub failure trampoline is a single frame. |
| 1737 FrameDescription* output_frame = | 1730 FrameDescription* output_frame = |
| 1738 new (output_frame_size) FrameDescription(output_frame_size); | 1731 new (output_frame_size) FrameDescription(output_frame_size); |
| 1739 output_frame->SetFrameType(StackFrame::STUB_FAILURE_TRAMPOLINE); | 1732 output_frame->SetFrameType(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 1740 CHECK_EQ(frame_index, 0); | 1733 CHECK_EQ(frame_index, 0); |
| 1741 output_[frame_index] = output_frame; | 1734 output_[frame_index] = output_frame; |
| 1742 | 1735 |
| 1743 // The top address for the output frame can be computed from the input | 1736 // The top address for the output frame can be computed from the input |
| 1744 // frame pointer and the output frame's height. Subtract space for the | 1737 // frame pointer and the output frame's height. Subtract space for the |
| 1745 // context and function slots. | 1738 // context and function slots. |
| 1746 Register fp_reg = StubFailureTrampolineFrame::fp_register(); | 1739 Register fp_reg = StubFailureTrampolineFrame::fp_register(); |
| 1747 intptr_t top_address = stack_fp_ - // input_->GetRegister(fp_reg.code()) - | 1740 intptr_t top_address = |
| 1748 StandardFrameConstants::kFixedFrameSizeFromFp - | 1741 stack_fp_ - // input_->GetRegister(fp_reg.code()) - |
| 1749 height_in_bytes; | 1742 StubFailureTrampolineFrameConstants::kFixedFrameSizeFromFp - |
| 1743 height_in_bytes; |
| 1750 output_frame->SetTop(top_address); | 1744 output_frame->SetTop(top_address); |
| 1751 | 1745 |
| 1752 // Set caller's PC (JSFunction continuation). | 1746 // Set caller's PC (JSFunction continuation). |
| 1753 unsigned output_frame_offset = output_frame_size - kFPOnStackSize; | 1747 unsigned output_frame_offset = output_frame_size - kFPOnStackSize; |
| 1754 intptr_t value = caller_pc_; | 1748 intptr_t value = caller_pc_; |
| 1755 output_frame->SetCallerPc(output_frame_offset, value); | 1749 output_frame->SetCallerPc(output_frame_offset, value); |
| 1756 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | 1750 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1757 "caller's pc\n"); | 1751 "caller's pc\n"); |
| 1758 | 1752 |
| 1759 // Set caller's FP from the input frame, and set this frame's FP. | 1753 // Read caller's FP from the input frame, and set this frame's FP. |
| 1760 value = caller_fp_; | 1754 value = caller_fp_; |
| 1761 output_frame_offset -= kFPOnStackSize; | 1755 output_frame_offset -= kFPOnStackSize; |
| 1762 output_frame->SetCallerFp(output_frame_offset, value); | 1756 output_frame->SetCallerFp(output_frame_offset, value); |
| 1763 intptr_t frame_ptr = stack_fp_; | 1757 intptr_t frame_ptr = stack_fp_; |
| 1764 output_frame->SetRegister(fp_reg.code(), frame_ptr); | 1758 output_frame->SetRegister(fp_reg.code(), frame_ptr); |
| 1765 output_frame->SetFp(frame_ptr); | 1759 output_frame->SetFp(frame_ptr); |
| 1766 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | 1760 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1767 "caller's fp\n"); | 1761 "caller's fp\n"); |
| 1768 | 1762 |
| 1769 if (FLAG_enable_embedded_constant_pool) { | 1763 if (FLAG_enable_embedded_constant_pool) { |
| 1770 // Read the caller's constant pool from the input frame. | 1764 // Read the caller's constant pool from the input frame. |
| 1771 value = caller_constant_pool_; | 1765 value = caller_constant_pool_; |
| 1772 output_frame_offset -= kPointerSize; | 1766 output_frame_offset -= kPointerSize; |
| 1773 output_frame->SetCallerConstantPool(output_frame_offset, value); | 1767 output_frame->SetCallerConstantPool(output_frame_offset, value); |
| 1774 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | 1768 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1775 "caller's constant_pool\n"); | 1769 "caller's constant_pool\n"); |
| 1776 } | 1770 } |
| 1777 | 1771 |
| 1778 // Remember where the context will need to be written back from the deopt | 1772 // The marker for the typed stack frame |
| 1779 // translation. | |
| 1780 output_frame_offset -= kPointerSize; | |
| 1781 unsigned context_frame_offset = output_frame_offset; | |
| 1782 | |
| 1783 // A marker value is used in place of the function. | |
| 1784 output_frame_offset -= kPointerSize; | 1773 output_frame_offset -= kPointerSize; |
| 1785 value = reinterpret_cast<intptr_t>( | 1774 value = reinterpret_cast<intptr_t>( |
| 1786 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); | 1775 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); |
| 1787 output_frame->SetFrameSlot(output_frame_offset, value); | 1776 output_frame->SetFrameSlot(output_frame_offset, value); |
| 1788 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | 1777 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1789 "function (stub failure sentinel)\n"); | 1778 "function (stub failure sentinel)\n"); |
| 1790 | 1779 |
| 1791 intptr_t caller_arg_count = stack_param_count; | 1780 intptr_t caller_arg_count = stack_param_count; |
| 1792 bool arg_count_known = !descriptor.stack_parameter_count().is_valid(); | 1781 bool arg_count_known = !descriptor.stack_parameter_count().is_valid(); |
| 1793 | 1782 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 .is(descriptor.stack_parameter_count())) { | 1823 .is(descriptor.stack_parameter_count())) { |
| 1835 arguments_length_offset = output_frame_offset; | 1824 arguments_length_offset = output_frame_offset; |
| 1836 } | 1825 } |
| 1837 } | 1826 } |
| 1838 | 1827 |
| 1839 Object* maybe_context = value_iterator->GetRawValue(); | 1828 Object* maybe_context = value_iterator->GetRawValue(); |
| 1840 CHECK(maybe_context->IsContext()); | 1829 CHECK(maybe_context->IsContext()); |
| 1841 Register context_reg = StubFailureTrampolineFrame::context_register(); | 1830 Register context_reg = StubFailureTrampolineFrame::context_register(); |
| 1842 value = reinterpret_cast<intptr_t>(maybe_context); | 1831 value = reinterpret_cast<intptr_t>(maybe_context); |
| 1843 output_frame->SetRegister(context_reg.code(), value); | 1832 output_frame->SetRegister(context_reg.code(), value); |
| 1844 output_frame->SetFrameSlot(context_frame_offset, value); | |
| 1845 DebugPrintOutputSlot(value, frame_index, context_frame_offset, "context\n"); | |
| 1846 ++value_iterator; | 1833 ++value_iterator; |
| 1847 | 1834 |
| 1848 // Copy constant stack parameters to the failure frame. If the number of stack | 1835 // Copy constant stack parameters to the failure frame. If the number of stack |
| 1849 // parameters is not known in the descriptor, the arguments object is the way | 1836 // parameters is not known in the descriptor, the arguments object is the way |
| 1850 // to access them. | 1837 // to access them. |
| 1851 for (int i = 0; i < stack_param_count; i++) { | 1838 for (int i = 0; i < stack_param_count; i++) { |
| 1852 output_frame_offset -= kPointerSize; | 1839 output_frame_offset -= kPointerSize; |
| 1853 Object** stack_parameter = reinterpret_cast<Object**>( | 1840 Object** stack_parameter = reinterpret_cast<Object**>( |
| 1854 frame_ptr + StandardFrameConstants::kCallerSPOffset + | 1841 frame_ptr + StandardFrameConstants::kCallerSPOffset + |
| 1855 (stack_param_count - i - 1) * kPointerSize); | 1842 (stack_param_count - i - 1) * kPointerSize); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1986 reinterpret_cast<Address>(output_[frame_index]->GetTop()) + | 1973 reinterpret_cast<Address>(output_[frame_index]->GetTop()) + |
| 1987 output_offset; | 1974 output_offset; |
| 1988 PrintF(trace_scope_->file(), | 1975 PrintF(trace_scope_->file(), |
| 1989 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s", | 1976 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s", |
| 1990 reinterpret_cast<intptr_t>(output_address), output_offset, value, | 1977 reinterpret_cast<intptr_t>(output_address), output_offset, value, |
| 1991 debug_hint_string == nullptr ? "" : debug_hint_string); | 1978 debug_hint_string == nullptr ? "" : debug_hint_string); |
| 1992 } | 1979 } |
| 1993 } | 1980 } |
| 1994 | 1981 |
| 1995 unsigned Deoptimizer::ComputeInputFrameAboveFpFixedSize() const { | 1982 unsigned Deoptimizer::ComputeInputFrameAboveFpFixedSize() const { |
| 1996 unsigned fixed_size = StandardFrameConstants::kFixedFrameSizeAboveFp; | 1983 unsigned fixed_size = CommonFrameConstants::kFixedFrameSizeAboveFp; |
| 1997 if (!function_->IsSmi()) { | 1984 if (!function_->IsSmi()) { |
| 1998 fixed_size += ComputeIncomingArgumentSize(function_->shared()); | 1985 fixed_size += ComputeIncomingArgumentSize(function_->shared()); |
| 1999 } else { | |
| 2000 CHECK_EQ(Smi::cast(function_), Smi::FromInt(StackFrame::STUB)); | |
| 2001 } | 1986 } |
| 2002 return fixed_size; | 1987 return fixed_size; |
| 2003 } | 1988 } |
| 2004 | 1989 |
| 2005 unsigned Deoptimizer::ComputeInputFrameSize() const { | 1990 unsigned Deoptimizer::ComputeInputFrameSize() const { |
| 2006 // The fp-to-sp delta already takes the context, constant pool pointer and the | 1991 // The fp-to-sp delta already takes the context, constant pool pointer and the |
| 2007 // function into account so we have to avoid double counting them. | 1992 // function into account so we have to avoid double counting them. |
| 2008 unsigned fixed_size_from_fp = ComputeInputFrameAboveFpFixedSize(); | 1993 unsigned fixed_size_from_fp = ComputeInputFrameAboveFpFixedSize(); |
| 2009 unsigned result = fixed_size_from_fp + fp_to_sp_delta_; | 1994 unsigned result = fixed_size_from_fp + fp_to_sp_delta_; |
| 2010 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { | 1995 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { |
| 2011 unsigned stack_slots = compiled_code_->stack_slots(); | 1996 unsigned stack_slots = compiled_code_->stack_slots(); |
| 2012 unsigned outgoing_size = | 1997 unsigned outgoing_size = |
| 2013 ComputeOutgoingArgumentSize(compiled_code_, bailout_id_); | 1998 ComputeOutgoingArgumentSize(compiled_code_, bailout_id_); |
| 2014 CHECK(result == | 1999 CHECK(result == |
| 2015 fixed_size_from_fp + (stack_slots * kPointerSize) - | 2000 fixed_size_from_fp + (stack_slots * kPointerSize) - |
| 2016 StandardFrameConstants::kFixedFrameSizeAboveFp + outgoing_size); | 2001 CommonFrameConstants::kFixedFrameSizeAboveFp + outgoing_size); |
| 2017 } | 2002 } |
| 2018 return result; | 2003 return result; |
| 2019 } | 2004 } |
| 2020 | 2005 |
| 2021 // static | 2006 // static |
| 2022 unsigned Deoptimizer::ComputeJavascriptFixedSize(SharedFunctionInfo* shared) { | 2007 unsigned Deoptimizer::ComputeJavascriptFixedSize(SharedFunctionInfo* shared) { |
| 2023 // The fixed part of the frame consists of the return address, frame | 2008 // The fixed part of the frame consists of the return address, frame |
| 2024 // pointer, function, context, and all the incoming arguments. | 2009 // pointer, function, context, and all the incoming arguments. |
| 2025 return ComputeIncomingArgumentSize(shared) + | 2010 return ComputeIncomingArgumentSize(shared) + |
| 2026 StandardFrameConstants::kFixedFrameSize; | 2011 StandardFrameConstants::kFixedFrameSize; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2326 int args_length) { | 2311 int args_length) { |
| 2327 buffer_->Add(ARGUMENTS_OBJECT, zone()); | 2312 buffer_->Add(ARGUMENTS_OBJECT, zone()); |
| 2328 buffer_->Add(args_known, zone()); | 2313 buffer_->Add(args_known, zone()); |
| 2329 buffer_->Add(args_index, zone()); | 2314 buffer_->Add(args_index, zone()); |
| 2330 buffer_->Add(args_length, zone()); | 2315 buffer_->Add(args_length, zone()); |
| 2331 } | 2316 } |
| 2332 | 2317 |
| 2333 | 2318 |
| 2334 void Translation::StoreJSFrameFunction() { | 2319 void Translation::StoreJSFrameFunction() { |
| 2335 StoreStackSlot((StandardFrameConstants::kCallerPCOffset - | 2320 StoreStackSlot((StandardFrameConstants::kCallerPCOffset - |
| 2336 StandardFrameConstants::kMarkerOffset) / | 2321 StandardFrameConstants::kFunctionOffset) / |
| 2337 kPointerSize); | 2322 kPointerSize); |
| 2338 } | 2323 } |
| 2339 | 2324 |
| 2340 int Translation::NumberOfOperandsFor(Opcode opcode) { | 2325 int Translation::NumberOfOperandsFor(Opcode opcode) { |
| 2341 switch (opcode) { | 2326 switch (opcode) { |
| 2342 case GETTER_STUB_FRAME: | 2327 case GETTER_STUB_FRAME: |
| 2343 case SETTER_STUB_FRAME: | 2328 case SETTER_STUB_FRAME: |
| 2344 case DUPLICATED_OBJECT: | 2329 case DUPLICATED_OBJECT: |
| 2345 case ARGUMENTS_OBJECT: | 2330 case ARGUMENTS_OBJECT: |
| 2346 case CAPTURED_OBJECT: | 2331 case CAPTURED_OBJECT: |
| (...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3727 CHECK(value_info->IsMaterializedObject()); | 3712 CHECK(value_info->IsMaterializedObject()); |
| 3728 | 3713 |
| 3729 value_info->value_ = | 3714 value_info->value_ = |
| 3730 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 3715 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
| 3731 } | 3716 } |
| 3732 } | 3717 } |
| 3733 } | 3718 } |
| 3734 | 3719 |
| 3735 } // namespace internal | 3720 } // namespace internal |
| 3736 } // namespace v8 | 3721 } // namespace v8 |
| OLD | NEW |