| 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 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 | 1789 |
| 1790 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1790 Handle<FixedArray> constant_elements = expr->constant_elements(); |
| 1791 ASSERT_EQ(2, constant_elements->length()); | 1791 ASSERT_EQ(2, constant_elements->length()); |
| 1792 ElementsKind constant_elements_kind = | 1792 ElementsKind constant_elements_kind = |
| 1793 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1793 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
| 1794 bool has_fast_elements = | 1794 bool has_fast_elements = |
| 1795 IsFastObjectElementsKind(constant_elements_kind); | 1795 IsFastObjectElementsKind(constant_elements_kind); |
| 1796 Handle<FixedArrayBase> constant_elements_values( | 1796 Handle<FixedArrayBase> constant_elements_values( |
| 1797 FixedArrayBase::cast(constant_elements->get(1))); | 1797 FixedArrayBase::cast(constant_elements->get(1))); |
| 1798 | 1798 |
| 1799 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
| 1800 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
| 1801 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
| 1802 // If the only customer of allocation sites is transitioning, then |
| 1803 // we can turn it off if we don't have anywhere else to transition to. |
| 1804 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1805 } |
| 1806 |
| 1799 __ mov(a0, result_register()); | 1807 __ mov(a0, result_register()); |
| 1800 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1808 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1801 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); | 1809 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); |
| 1802 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); | 1810 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); |
| 1803 __ li(a1, Operand(constant_elements)); | 1811 __ li(a1, Operand(constant_elements)); |
| 1804 if (has_fast_elements && constant_elements_values->map() == | 1812 if (has_fast_elements && constant_elements_values->map() == |
| 1805 isolate()->heap()->fixed_cow_array_map()) { | 1813 isolate()->heap()->fixed_cow_array_map()) { |
| 1806 FastCloneShallowArrayStub stub( | 1814 FastCloneShallowArrayStub stub( |
| 1807 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1815 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1808 DONT_TRACK_ALLOCATION_SITE, | 1816 allocation_site_mode, |
| 1809 length); | 1817 length); |
| 1810 __ CallStub(&stub); | 1818 __ CallStub(&stub); |
| 1811 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), | 1819 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), |
| 1812 1, a1, a2); | 1820 1, a1, a2); |
| 1813 } else if (expr->depth() > 1 || Serializer::enabled() || | 1821 } else if (expr->depth() > 1 || Serializer::enabled() || |
| 1814 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1822 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 1815 __ li(a0, Operand(Smi::FromInt(flags))); | 1823 __ li(a0, Operand(Smi::FromInt(flags))); |
| 1816 __ Push(a3, a2, a1, a0); | 1824 __ Push(a3, a2, a1, a0); |
| 1817 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); | 1825 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
| 1818 } else { | 1826 } else { |
| 1819 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1827 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
| 1820 FLAG_smi_only_arrays); | 1828 FLAG_smi_only_arrays); |
| 1821 FastCloneShallowArrayStub::Mode mode = | 1829 FastCloneShallowArrayStub::Mode mode = |
| 1822 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1830 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1823 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | |
| 1824 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | |
| 1825 | 1831 |
| 1826 if (has_fast_elements) { | 1832 if (has_fast_elements) { |
| 1827 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | 1833 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 1828 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | |
| 1829 } | 1834 } |
| 1830 | 1835 |
| 1831 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 1836 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 1832 __ CallStub(&stub); | 1837 __ CallStub(&stub); |
| 1833 } | 1838 } |
| 1834 | 1839 |
| 1835 bool result_saved = false; // Is the result saved to the stack? | 1840 bool result_saved = false; // Is the result saved to the stack? |
| 1836 | 1841 |
| 1837 // Emit code to evaluate all the non-constant subexpressions and to store | 1842 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1838 // them into the newly cloned array. | 1843 // them into the newly cloned array. |
| (...skipping 3131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4970 Assembler::target_address_at(pc_immediate_load_address)) == | 4975 Assembler::target_address_at(pc_immediate_load_address)) == |
| 4971 reinterpret_cast<uint32_t>( | 4976 reinterpret_cast<uint32_t>( |
| 4972 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4977 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4973 return OSR_AFTER_STACK_CHECK; | 4978 return OSR_AFTER_STACK_CHECK; |
| 4974 } | 4979 } |
| 4975 | 4980 |
| 4976 | 4981 |
| 4977 } } // namespace v8::internal | 4982 } } // namespace v8::internal |
| 4978 | 4983 |
| 4979 #endif // V8_TARGET_ARCH_MIPS | 4984 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |