| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 for (int i = 0; i < length; i++) { | 1805 for (int i = 0; i < length; i++) { |
| 1806 Expression* subexpr = subexprs->at(i); | 1806 Expression* subexpr = subexprs->at(i); |
| 1807 // If the subexpression is a literal or a simple materialized literal it | 1807 // If the subexpression is a literal or a simple materialized literal it |
| 1808 // is already set in the cloned array. | 1808 // is already set in the cloned array. |
| 1809 if (subexpr->AsLiteral() != NULL || | 1809 if (subexpr->AsLiteral() != NULL || |
| 1810 CompileTimeValue::IsCompileTimeValue(subexpr)) { | 1810 CompileTimeValue::IsCompileTimeValue(subexpr)) { |
| 1811 continue; | 1811 continue; |
| 1812 } | 1812 } |
| 1813 | 1813 |
| 1814 if (!result_saved) { | 1814 if (!result_saved) { |
| 1815 __ push(rax); | 1815 __ push(rax); // array literal |
| 1816 __ Push(Smi::FromInt(expr->literal_index())); |
| 1816 result_saved = true; | 1817 result_saved = true; |
| 1817 } | 1818 } |
| 1818 VisitForAccumulatorValue(subexpr); | 1819 VisitForAccumulatorValue(subexpr); |
| 1819 | 1820 |
| 1820 if (IsFastObjectElementsKind(constant_elements_kind)) { | 1821 if (IsFastObjectElementsKind(constant_elements_kind)) { |
| 1821 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they | 1822 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they |
| 1822 // cannot transition and don't need to call the runtime stub. | 1823 // cannot transition and don't need to call the runtime stub. |
| 1823 int offset = FixedArray::kHeaderSize + (i * kPointerSize); | 1824 int offset = FixedArray::kHeaderSize + (i * kPointerSize); |
| 1824 __ movq(rbx, Operand(rsp, 0)); // Copy of array literal. | 1825 __ movq(rbx, Operand(rsp, kPointerSize)); // Copy of array literal. |
| 1825 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); | 1826 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); |
| 1826 // Store the subexpression value in the array's elements. | 1827 // Store the subexpression value in the array's elements. |
| 1827 __ movq(FieldOperand(rbx, offset), result_register()); | 1828 __ movq(FieldOperand(rbx, offset), result_register()); |
| 1828 // Update the write barrier for the array store. | 1829 // Update the write barrier for the array store. |
| 1829 __ RecordWriteField(rbx, offset, result_register(), rcx, | 1830 __ RecordWriteField(rbx, offset, result_register(), rcx, |
| 1830 kDontSaveFPRegs, | 1831 kDontSaveFPRegs, |
| 1831 EMIT_REMEMBERED_SET, | 1832 EMIT_REMEMBERED_SET, |
| 1832 INLINE_SMI_CHECK); | 1833 INLINE_SMI_CHECK); |
| 1833 } else { | 1834 } else { |
| 1834 // Store the subexpression value in the array's elements. | 1835 // Store the subexpression value in the array's elements. |
| 1835 __ movq(rbx, Operand(rsp, 0)); // Copy of array literal. | |
| 1836 __ movq(rdi, FieldOperand(rbx, JSObject::kMapOffset)); | |
| 1837 __ Move(rcx, Smi::FromInt(i)); | 1836 __ Move(rcx, Smi::FromInt(i)); |
| 1838 __ Move(rdx, Smi::FromInt(expr->literal_index())); | |
| 1839 StoreArrayLiteralElementStub stub; | 1837 StoreArrayLiteralElementStub stub; |
| 1840 __ CallStub(&stub); | 1838 __ CallStub(&stub); |
| 1841 } | 1839 } |
| 1842 | 1840 |
| 1843 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); | 1841 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); |
| 1844 } | 1842 } |
| 1845 | 1843 |
| 1846 if (result_saved) { | 1844 if (result_saved) { |
| 1845 __ addq(rsp, Immediate(kPointerSize)); // literal index |
| 1847 context()->PlugTOS(); | 1846 context()->PlugTOS(); |
| 1848 } else { | 1847 } else { |
| 1849 context()->Plug(rax); | 1848 context()->Plug(rax); |
| 1850 } | 1849 } |
| 1851 } | 1850 } |
| 1852 | 1851 |
| 1853 | 1852 |
| 1854 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 1853 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
| 1855 Comment cmnt(masm_, "[ Assignment"); | 1854 Comment cmnt(masm_, "[ Assignment"); |
| 1856 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | 1855 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' |
| (...skipping 3024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4881 *context_length = 0; | 4880 *context_length = 0; |
| 4882 return previous_; | 4881 return previous_; |
| 4883 } | 4882 } |
| 4884 | 4883 |
| 4885 | 4884 |
| 4886 #undef __ | 4885 #undef __ |
| 4887 | 4886 |
| 4888 } } // namespace v8::internal | 4887 } } // namespace v8::internal |
| 4889 | 4888 |
| 4890 #endif // V8_TARGET_ARCH_X64 | 4889 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |