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