Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: src/deoptimizer.cc

Issue 1696043002: [runtime] Unify and simplify how frames are marked (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: All platforms Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 unsigned height = translated_frame->height(); 1326 unsigned height = translated_frame->height();
1327 unsigned height_in_bytes = height * kPointerSize; 1327 unsigned height_in_bytes = height * kPointerSize;
1328 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); 1328 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue());
1329 value_iterator++; 1329 value_iterator++;
1330 input_index++; 1330 input_index++;
1331 if (trace_scope_ != NULL) { 1331 if (trace_scope_ != NULL) {
1332 PrintF(trace_scope_->file(), 1332 PrintF(trace_scope_->file(),
1333 " translating arguments adaptor => height=%d\n", height_in_bytes); 1333 " translating arguments adaptor => height=%d\n", height_in_bytes);
1334 } 1334 }
1335 1335
1336 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize; 1336 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFixedFrameSize;
1337 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 1337 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
1338 1338
1339 // Allocate and store the output frame description. 1339 // Allocate and store the output frame description.
1340 int parameter_count = height; 1340 int parameter_count = height;
1341 FrameDescription* output_frame = new (output_frame_size) 1341 FrameDescription* output_frame = new (output_frame_size)
1342 FrameDescription(output_frame_size, parameter_count); 1342 FrameDescription(output_frame_size, parameter_count);
1343 output_frame->SetFrameType(StackFrame::ARGUMENTS_ADAPTOR); 1343 output_frame->SetFrameType(StackFrame::ARGUMENTS_ADAPTOR);
1344 1344
1345 // Arguments adaptor can not be topmost or bottommost. 1345 // Arguments adaptor can not be topmost or bottommost.
1346 CHECK(frame_index > 0 && frame_index < output_count_ - 1); 1346 CHECK(frame_index > 0 && frame_index < output_count_ - 1);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 unsigned height = translated_frame->height(); 1434 unsigned height = translated_frame->height();
1435 unsigned height_in_bytes = height * kPointerSize; 1435 unsigned height_in_bytes = height * kPointerSize;
1436 // Skip function. 1436 // Skip function.
1437 value_iterator++; 1437 value_iterator++;
1438 input_index++; 1438 input_index++;
1439 if (trace_scope_ != NULL) { 1439 if (trace_scope_ != NULL) {
1440 PrintF(trace_scope_->file(), 1440 PrintF(trace_scope_->file(),
1441 " translating construct stub => height=%d\n", height_in_bytes); 1441 " translating construct stub => height=%d\n", height_in_bytes);
1442 } 1442 }
1443 1443
1444 unsigned fixed_frame_size = ConstructFrameConstants::kFrameSize; 1444 unsigned fixed_frame_size = ConstructFrameConstants::kFixedFrameSize;
1445 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 1445 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
1446 1446
1447 // Allocate and store the output frame description. 1447 // Allocate and store the output frame description.
1448 FrameDescription* output_frame = 1448 FrameDescription* output_frame =
1449 new (output_frame_size) FrameDescription(output_frame_size); 1449 new (output_frame_size) FrameDescription(output_frame_size);
1450 output_frame->SetFrameType(StackFrame::CONSTRUCT); 1450 output_frame->SetFrameType(StackFrame::CONSTRUCT);
1451 1451
1452 // Construct stub can not be topmost or bottommost. 1452 // Construct stub can not be topmost or bottommost.
1453 DCHECK(frame_index > 0 && frame_index < output_count_ - 1); 1453 DCHECK(frame_index > 0 && frame_index < output_count_ - 1);
1454 DCHECK(output_[frame_index] == NULL); 1454 DCHECK(output_[frame_index] == NULL);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 1489
1490 if (FLAG_enable_embedded_constant_pool) { 1490 if (FLAG_enable_embedded_constant_pool) {
1491 // Read the caller's constant pool from the previous frame. 1491 // Read the caller's constant pool from the previous frame.
1492 output_offset -= kPointerSize; 1492 output_offset -= kPointerSize;
1493 value = output_[frame_index - 1]->GetConstantPool(); 1493 value = output_[frame_index - 1]->GetConstantPool();
1494 output_frame->SetCallerConstantPool(output_offset, value); 1494 output_frame->SetCallerConstantPool(output_offset, value);
1495 DebugPrintOutputSlot(value, frame_index, output_offset, 1495 DebugPrintOutputSlot(value, frame_index, output_offset,
1496 "caller's constant_pool\n"); 1496 "caller's constant_pool\n");
1497 } 1497 }
1498 1498
1499 // A marker value is used to mark the frame.
1500 output_offset -= kPointerSize;
1501 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT));
1502 output_frame->SetFrameSlot(output_offset, value);
1503 DebugPrintOutputSlot(value, frame_index, output_offset,
1504 "typed frame marker\n");
1505
1499 // The context can be gotten from the previous frame. 1506 // The context can be gotten from the previous frame.
1500 output_offset -= kPointerSize; 1507 output_offset -= kPointerSize;
1501 value = output_[frame_index - 1]->GetContext(); 1508 value = output_[frame_index - 1]->GetContext();
1502 output_frame->SetFrameSlot(output_offset, value); 1509 output_frame->SetFrameSlot(output_offset, value);
1503 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); 1510 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n");
1504 1511
1505 // A marker value is used in place of the function.
1506 output_offset -= kPointerSize;
1507 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT));
1508 output_frame->SetFrameSlot(output_offset, value);
1509 DebugPrintOutputSlot(value, frame_index, output_offset,
1510 "function (construct sentinel)\n");
1511
1512 // The output frame reflects a JSConstructStubGeneric frame.
1513 output_offset -= kPointerSize;
1514 value = reinterpret_cast<intptr_t>(construct_stub);
1515 output_frame->SetFrameSlot(output_offset, value);
1516 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n");
1517
1518 // The allocation site. 1512 // The allocation site.
1519 output_offset -= kPointerSize; 1513 output_offset -= kPointerSize;
1520 value = reinterpret_cast<intptr_t>(isolate_->heap()->undefined_value()); 1514 value = reinterpret_cast<intptr_t>(isolate_->heap()->undefined_value());
1521 output_frame->SetFrameSlot(output_offset, value); 1515 output_frame->SetFrameSlot(output_offset, value);
1522 DebugPrintOutputSlot(value, frame_index, output_offset, "allocation site\n"); 1516 DebugPrintOutputSlot(value, frame_index, output_offset, "allocation site\n");
1523 1517
1524 // Number of incoming arguments. 1518 // Number of incoming arguments.
1525 output_offset -= kPointerSize; 1519 output_offset -= kPointerSize;
1526 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); 1520 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1));
1527 output_frame->SetFrameSlot(output_offset, value); 1521 output_frame->SetFrameSlot(output_offset, value);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 // frame. This means that we have to use a height of 0. 1561 // frame. This means that we have to use a height of 0.
1568 unsigned height = 0; 1562 unsigned height = 0;
1569 unsigned height_in_bytes = height * kPointerSize; 1563 unsigned height_in_bytes = height * kPointerSize;
1570 const char* kind = is_setter_stub_frame ? "setter" : "getter"; 1564 const char* kind = is_setter_stub_frame ? "setter" : "getter";
1571 if (trace_scope_ != NULL) { 1565 if (trace_scope_ != NULL) {
1572 PrintF(trace_scope_->file(), 1566 PrintF(trace_scope_->file(),
1573 " translating %s stub => height=%u\n", kind, height_in_bytes); 1567 " translating %s stub => height=%u\n", kind, height_in_bytes);
1574 } 1568 }
1575 1569
1576 // We need 1 stack entry for the return address and enough entries for the 1570 // We need 1 stack entry for the return address and enough entries for the
1577 // StackFrame::INTERNAL (FP, context, frame type, code object and constant 1571 // StackFrame::INTERNAL (FP, frame type, context, code object and constant
1578 // pool (if enabled)- see MacroAssembler::EnterFrame). 1572 // pool (if enabled)- see MacroAssembler::EnterFrame).
1579 // For a setter stub frame we need one additional entry for the implicit 1573 // For a setter stub frame we need one additional entry for the implicit
1580 // return value, see StoreStubCompiler::CompileStoreViaSetter. 1574 // return value, see StoreStubCompiler::CompileStoreViaSetter.
1581 unsigned fixed_frame_entries = 1575 unsigned fixed_frame_entries =
1582 (StandardFrameConstants::kFixedFrameSize / kPointerSize) + 1 + 1576 (StandardFrameConstants::kFixedFrameSize / kPointerSize) + 1 +
1583 (is_setter_stub_frame ? 1 : 0); 1577 (is_setter_stub_frame ? 1 : 0);
1584 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; 1578 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize;
1585 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 1579 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
1586 1580
1587 // Allocate and store the output frame description. 1581 // Allocate and store the output frame description.
(...skipping 29 matching lines...) Expand all
1617 1611
1618 if (FLAG_enable_embedded_constant_pool) { 1612 if (FLAG_enable_embedded_constant_pool) {
1619 // Read the caller's constant pool from the previous frame. 1613 // Read the caller's constant pool from the previous frame.
1620 output_offset -= kPointerSize; 1614 output_offset -= kPointerSize;
1621 value = output_[frame_index - 1]->GetConstantPool(); 1615 value = output_[frame_index - 1]->GetConstantPool();
1622 output_frame->SetCallerConstantPool(output_offset, value); 1616 output_frame->SetCallerConstantPool(output_offset, value);
1623 DebugPrintOutputSlot(value, frame_index, output_offset, 1617 DebugPrintOutputSlot(value, frame_index, output_offset,
1624 "caller's constant_pool\n"); 1618 "caller's constant_pool\n");
1625 } 1619 }
1626 1620
1627 // The context can be gotten from the previous frame. 1621 // Set the frame type.
1628 output_offset -= kPointerSize;
1629 value = output_[frame_index - 1]->GetContext();
1630 output_frame->SetFrameSlot(output_offset, value);
1631 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n");
1632
1633 // A marker value is used in place of the function.
1634 output_offset -= kPointerSize; 1622 output_offset -= kPointerSize;
1635 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); 1623 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL));
1636 output_frame->SetFrameSlot(output_offset, value); 1624 output_frame->SetFrameSlot(output_offset, value);
1637 DebugPrintOutputSlot(value, frame_index, output_offset, "function "); 1625 DebugPrintOutputSlot(value, frame_index, output_offset, "frame type ");
1638 if (trace_scope_ != nullptr) { 1626 if (trace_scope_ != nullptr) {
1639 PrintF(trace_scope_->file(), "(%s sentinel)\n", kind); 1627 PrintF(trace_scope_->file(), "(%s sentinel)\n", kind);
1640 } 1628 }
1641 1629
1642 // Get Code object from accessor stub. 1630 // Get Code object from accessor stub.
1643 output_offset -= kPointerSize; 1631 output_offset -= kPointerSize;
1644 Builtins::Name name = is_setter_stub_frame ? 1632 Builtins::Name name = is_setter_stub_frame ?
1645 Builtins::kStoreIC_Setter_ForDeopt : 1633 Builtins::kStoreIC_Setter_ForDeopt :
1646 Builtins::kLoadIC_Getter_ForDeopt; 1634 Builtins::kLoadIC_Getter_ForDeopt;
1647 Code* accessor_stub = isolate_->builtins()->builtin(name); 1635 Code* accessor_stub = isolate_->builtins()->builtin(name);
1648 value = reinterpret_cast<intptr_t>(accessor_stub); 1636 value = reinterpret_cast<intptr_t>(accessor_stub);
1649 output_frame->SetFrameSlot(output_offset, value); 1637 output_frame->SetFrameSlot(output_offset, value);
1650 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n"); 1638 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n");
1651 1639
1640 // The context can be gotten from the previous frame.
1641 output_offset -= kPointerSize;
1642 value = output_[frame_index - 1]->GetContext();
1643 output_frame->SetFrameSlot(output_offset, value);
1644 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n");
1645
1652 // Skip receiver. 1646 // Skip receiver.
1653 value_iterator++; 1647 value_iterator++;
1654 input_index++; 1648 input_index++;
1655 1649
1656 if (is_setter_stub_frame) { 1650 if (is_setter_stub_frame) {
1657 // The implicit return value was part of the artificial setter stub 1651 // The implicit return value was part of the artificial setter stub
1658 // environment. 1652 // environment.
1659 output_offset -= kPointerSize; 1653 output_offset -= kPointerSize;
1660 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, 1654 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index,
1661 output_offset); 1655 output_offset);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 // and the standard stack frame slots. Include space for an argument 1720 // and the standard stack frame slots. Include space for an argument
1727 // object to the callee and optionally the space to pass the argument 1721 // object to the callee and optionally the space to pass the argument
1728 // object to the stub failure handler. 1722 // object to the stub failure handler.
1729 int param_count = descriptor.GetRegisterParameterCount(); 1723 int param_count = descriptor.GetRegisterParameterCount();
1730 int stack_param_count = descriptor.GetStackParameterCount(); 1724 int stack_param_count = descriptor.GetStackParameterCount();
1731 // The translated frame contains all of the register parameters 1725 // The translated frame contains all of the register parameters
1732 // plus the context. 1726 // plus the context.
1733 CHECK_EQ(translated_frame->height(), param_count + 1); 1727 CHECK_EQ(translated_frame->height(), param_count + 1);
1734 CHECK_GE(param_count, 0); 1728 CHECK_GE(param_count, 0);
1735 1729
1736 int height_in_bytes = kPointerSize * (param_count + stack_param_count) + 1730 int height_in_bytes = kPointerSize * (param_count + stack_param_count);
1737 sizeof(Arguments) + kPointerSize; 1731 int fixed_frame_size = StubFailureTrampolineFrameConstants::kFixedFrameSize;
1738 int fixed_frame_size = StandardFrameConstants::kFixedFrameSize;
1739 int input_frame_size = input_->GetFrameSize(); 1732 int input_frame_size = input_->GetFrameSize();
1740 int output_frame_size = height_in_bytes + fixed_frame_size; 1733 int output_frame_size = height_in_bytes + fixed_frame_size;
1741 if (trace_scope_ != NULL) { 1734 if (trace_scope_ != NULL) {
1742 PrintF(trace_scope_->file(), 1735 PrintF(trace_scope_->file(),
1743 " translating %s => StubFailureTrampolineStub, height=%d\n", 1736 " translating %s => StubFailureTrampolineStub, height=%d\n",
1744 CodeStub::MajorName(static_cast<CodeStub::Major>(major_key)), 1737 CodeStub::MajorName(static_cast<CodeStub::Major>(major_key)),
1745 height_in_bytes); 1738 height_in_bytes);
1746 } 1739 }
1747 1740
1748 // The stub failure trampoline is a single frame. 1741 // The stub failure trampoline is a single frame.
1749 FrameDescription* output_frame = 1742 FrameDescription* output_frame =
1750 new (output_frame_size) FrameDescription(output_frame_size); 1743 new (output_frame_size) FrameDescription(output_frame_size);
1751 output_frame->SetFrameType(StackFrame::STUB_FAILURE_TRAMPOLINE); 1744 output_frame->SetFrameType(StackFrame::STUB_FAILURE_TRAMPOLINE);
1752 CHECK_EQ(frame_index, 0); 1745 CHECK_EQ(frame_index, 0);
1753 output_[frame_index] = output_frame; 1746 output_[frame_index] = output_frame;
1754 1747
1755 // The top address for the output frame can be computed from the input 1748 // The top address for the output frame can be computed from the input
1756 // frame pointer and the output frame's height. Subtract space for the 1749 // frame pointer and the output frame's height. Subtract space for the
1757 // context and function slots. 1750 // context and function slots.
1758 Register fp_reg = StubFailureTrampolineFrame::fp_register(); 1751 Register fp_reg = StubFailureTrampolineFrame::fp_register();
1759 intptr_t top_address = input_->GetRegister(fp_reg.code()) - 1752 intptr_t top_address =
1760 StandardFrameConstants::kFixedFrameSizeFromFp - height_in_bytes; 1753 input_->GetRegister(fp_reg.code()) -
1754 StubFailureTrampolineFrameConstants::kFixedFrameSizeFromFp -
1755 height_in_bytes;
1761 output_frame->SetTop(top_address); 1756 output_frame->SetTop(top_address);
1762 1757
1763 // Read caller's PC (JSFunction continuation) from the input frame. 1758 // Read caller's PC (JSFunction continuation) from the input frame.
1764 unsigned input_frame_offset = input_frame_size - kPCOnStackSize; 1759 unsigned input_frame_offset = input_frame_size - kPCOnStackSize;
1765 unsigned output_frame_offset = output_frame_size - kFPOnStackSize; 1760 unsigned output_frame_offset = output_frame_size - kFPOnStackSize;
1766 intptr_t value = input_->GetFrameSlot(input_frame_offset); 1761 intptr_t value = input_->GetFrameSlot(input_frame_offset);
1767 output_frame->SetCallerPc(output_frame_offset, value); 1762 output_frame->SetCallerPc(output_frame_offset, value);
1768 DebugPrintOutputSlot(value, frame_index, output_frame_offset, 1763 DebugPrintOutputSlot(value, frame_index, output_frame_offset,
1769 "caller's pc\n"); 1764 "caller's pc\n");
1770 1765
1771 // Read caller's FP from the input frame, and set this frame's FP. 1766 // Read caller's FP from the input frame, and set this frame's FP.
1772 input_frame_offset -= kFPOnStackSize; 1767 input_frame_offset -= kFPOnStackSize;
1773 value = input_->GetFrameSlot(input_frame_offset);
1774 output_frame_offset -= kFPOnStackSize; 1768 output_frame_offset -= kFPOnStackSize;
1775 output_frame->SetCallerFp(output_frame_offset, value); 1769 intptr_t parent_frame_ptr = input_->GetFrameSlot(input_frame_offset);
1770 output_frame->SetCallerFp(output_frame_offset, parent_frame_ptr);
1776 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); 1771 intptr_t frame_ptr = input_->GetRegister(fp_reg.code());
1777 output_frame->SetRegister(fp_reg.code(), frame_ptr); 1772 output_frame->SetRegister(fp_reg.code(), frame_ptr);
1778 output_frame->SetFp(frame_ptr); 1773 output_frame->SetFp(frame_ptr);
1779 DebugPrintOutputSlot(value, frame_index, output_frame_offset, 1774 DebugPrintOutputSlot(frame_ptr, frame_index, output_frame_offset,
1780 "caller's fp\n"); 1775 "caller's fp\n");
1781 1776
1782 if (FLAG_enable_embedded_constant_pool) { 1777 if (FLAG_enable_embedded_constant_pool) {
1783 // Read the caller's constant pool from the input frame. 1778 // Read the caller's constant pool from the input frame.
1784 input_frame_offset -= kPointerSize; 1779 input_frame_offset -= kPointerSize;
1785 value = input_->GetFrameSlot(input_frame_offset); 1780 value = input_->GetFrameSlot(input_frame_offset);
1786 output_frame_offset -= kPointerSize; 1781 output_frame_offset -= kPointerSize;
1787 output_frame->SetCallerConstantPool(output_frame_offset, value); 1782 output_frame->SetCallerConstantPool(output_frame_offset, value);
1788 DebugPrintOutputSlot(value, frame_index, output_frame_offset, 1783 DebugPrintOutputSlot(value, frame_index, output_frame_offset,
1789 "caller's constant_pool\n"); 1784 "caller's constant_pool\n");
1790 } 1785 }
1791 1786
1792 // Remember where the context will need to be written back from the deopt 1787 // The marker for the typed stack frame
1793 // translation.
1794 output_frame_offset -= kPointerSize;
1795 unsigned context_frame_offset = output_frame_offset;
1796
1797 // A marker value is used in place of the function.
1798 output_frame_offset -= kPointerSize; 1788 output_frame_offset -= kPointerSize;
1799 value = reinterpret_cast<intptr_t>( 1789 value = reinterpret_cast<intptr_t>(
1800 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); 1790 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE));
1801 output_frame->SetFrameSlot(output_frame_offset, value); 1791 output_frame->SetFrameSlot(output_frame_offset, value);
1802 DebugPrintOutputSlot(value, frame_index, output_frame_offset, 1792 DebugPrintOutputSlot(value, frame_index, output_frame_offset,
1803 "function (stub failure sentinel)\n"); 1793 "function (stub failure sentinel)\n");
1804 1794
1805 intptr_t caller_arg_count = stack_param_count; 1795 intptr_t caller_arg_count = stack_param_count;
1806 bool arg_count_known = !descriptor.stack_parameter_count().is_valid(); 1796 bool arg_count_known = !descriptor.stack_parameter_count().is_valid();
1807 1797
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 .is(descriptor.stack_parameter_count())) { 1838 .is(descriptor.stack_parameter_count())) {
1849 arguments_length_offset = output_frame_offset; 1839 arguments_length_offset = output_frame_offset;
1850 } 1840 }
1851 } 1841 }
1852 1842
1853 Object* maybe_context = value_iterator->GetRawValue(); 1843 Object* maybe_context = value_iterator->GetRawValue();
1854 CHECK(maybe_context->IsContext()); 1844 CHECK(maybe_context->IsContext());
1855 Register context_reg = StubFailureTrampolineFrame::context_register(); 1845 Register context_reg = StubFailureTrampolineFrame::context_register();
1856 value = reinterpret_cast<intptr_t>(maybe_context); 1846 value = reinterpret_cast<intptr_t>(maybe_context);
1857 output_frame->SetRegister(context_reg.code(), value); 1847 output_frame->SetRegister(context_reg.code(), value);
1858 output_frame->SetFrameSlot(context_frame_offset, value);
1859 DebugPrintOutputSlot(value, frame_index, context_frame_offset, "context\n");
1860 ++value_iterator; 1848 ++value_iterator;
1861 1849
1862 // Copy constant stack parameters to the failure frame. If the number of stack 1850 // Copy constant stack parameters to the failure frame. If the number of stack
1863 // parameters is not known in the descriptor, the arguments object is the way 1851 // parameters is not known in the descriptor, the arguments object is the way
1864 // to access them. 1852 // to access them.
1865 for (int i = 0; i < stack_param_count; i++) { 1853 for (int i = 0; i < stack_param_count; i++) {
1866 output_frame_offset -= kPointerSize; 1854 output_frame_offset -= kPointerSize;
1867 Object** stack_parameter = reinterpret_cast<Object**>( 1855 Object** stack_parameter = reinterpret_cast<Object**>(
1868 frame_ptr + StandardFrameConstants::kCallerSPOffset + 1856 frame_ptr + StandardFrameConstants::kCallerSPOffset +
1869 (stack_param_count - i - 1) * kPointerSize); 1857 (stack_param_count - i - 1) * kPointerSize);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 output_offset; 1989 output_offset;
2002 PrintF(trace_scope_->file(), 1990 PrintF(trace_scope_->file(),
2003 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s", 1991 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s",
2004 reinterpret_cast<intptr_t>(output_address), output_offset, value, 1992 reinterpret_cast<intptr_t>(output_address), output_offset, value,
2005 debug_hint_string == nullptr ? "" : debug_hint_string); 1993 debug_hint_string == nullptr ? "" : debug_hint_string);
2006 } 1994 }
2007 } 1995 }
2008 1996
2009 1997
2010 unsigned Deoptimizer::ComputeInputFrameSize() const { 1998 unsigned Deoptimizer::ComputeInputFrameSize() const {
2011 unsigned fixed_size = StandardFrameConstants::kFixedFrameSize; 1999 unsigned fixed_size = (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION)
2012 if (!function_->IsSmi()) { 2000 ? ComputeJavascriptFixedSize(function_->shared())
2013 fixed_size += ComputeIncomingArgumentSize(function_->shared()); 2001 : TypedFrameConstants::kFixedFrameSize;
2014 } else {
2015 CHECK_EQ(Smi::cast(function_), Smi::FromInt(StackFrame::STUB));
2016 }
2017 // The fp-to-sp delta already takes the context, constant pool pointer and the 2002 // The fp-to-sp delta already takes the context, constant pool pointer and the
2018 // function into account so we have to avoid double counting them. 2003 // function into account so we have to avoid double counting them.
2019 unsigned result = fixed_size + fp_to_sp_delta_ - 2004 unsigned result = fixed_size + fp_to_sp_delta_ -
2020 StandardFrameConstants::kFixedFrameSizeFromFp; 2005 ((compiled_code_->kind() == Code::OPTIMIZED_FUNCTION)
2006 ? StandardFrameConstants::kFixedFrameSizeFromFp
2007 : TypedFrameConstants::kFixedFrameSizeFromFp);
2021 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { 2008 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
2022 unsigned stack_slots = compiled_code_->stack_slots(); 2009 unsigned stack_slots = compiled_code_->stack_slots();
2023 unsigned outgoing_size = 2010 unsigned outgoing_size =
2024 ComputeOutgoingArgumentSize(compiled_code_, bailout_id_); 2011 ComputeOutgoingArgumentSize(compiled_code_, bailout_id_);
2025 CHECK(result == 2012 CHECK(result ==
2026 fixed_size + (stack_slots * kPointerSize) - 2013 fixed_size + (stack_slots * kPointerSize) -
2027 StandardFrameConstants::kFixedFrameSize + outgoing_size); 2014 StandardFrameConstants::kFixedFrameSize + outgoing_size);
2028 } 2015 }
2029 return result; 2016 return result;
2030 } 2017 }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 int args_length) { 2324 int args_length) {
2338 buffer_->Add(ARGUMENTS_OBJECT, zone()); 2325 buffer_->Add(ARGUMENTS_OBJECT, zone());
2339 buffer_->Add(args_known, zone()); 2326 buffer_->Add(args_known, zone());
2340 buffer_->Add(args_index, zone()); 2327 buffer_->Add(args_index, zone());
2341 buffer_->Add(args_length, zone()); 2328 buffer_->Add(args_length, zone());
2342 } 2329 }
2343 2330
2344 2331
2345 void Translation::StoreJSFrameFunction() { 2332 void Translation::StoreJSFrameFunction() {
2346 StoreStackSlot((StandardFrameConstants::kCallerPCOffset - 2333 StoreStackSlot((StandardFrameConstants::kCallerPCOffset -
2347 StandardFrameConstants::kMarkerOffset) / 2334 StandardFrameConstants::kFunctionOffset) /
2348 kPointerSize); 2335 kPointerSize);
2349 } 2336 }
2350 2337
2351 int Translation::NumberOfOperandsFor(Opcode opcode) { 2338 int Translation::NumberOfOperandsFor(Opcode opcode) {
2352 switch (opcode) { 2339 switch (opcode) {
2353 case GETTER_STUB_FRAME: 2340 case GETTER_STUB_FRAME:
2354 case SETTER_STUB_FRAME: 2341 case SETTER_STUB_FRAME:
2355 case DUPLICATED_OBJECT: 2342 case DUPLICATED_OBJECT:
2356 case ARGUMENTS_OBJECT: 2343 case ARGUMENTS_OBJECT:
2357 case CAPTURED_OBJECT: 2344 case CAPTURED_OBJECT:
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
3738 CHECK(value_info->IsMaterializedObject()); 3725 CHECK(value_info->IsMaterializedObject());
3739 3726
3740 value_info->value_ = 3727 value_info->value_ =
3741 Handle<Object>(previously_materialized_objects->get(i), isolate_); 3728 Handle<Object>(previously_materialized_objects->get(i), isolate_);
3742 } 3729 }
3743 } 3730 }
3744 } 3731 }
3745 3732
3746 } // namespace internal 3733 } // namespace internal
3747 } // namespace v8 3734 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698