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

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 85633004: MIPS: A performance regression in array literal creation was caused by refactoring. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 7 years 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
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 } else { 1773 } else {
1774 context()->Plug(v0); 1774 context()->Plug(v0);
1775 } 1775 }
1776 } 1776 }
1777 1777
1778 1778
1779 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1779 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1780 Comment cmnt(masm_, "[ ArrayLiteral"); 1780 Comment cmnt(masm_, "[ ArrayLiteral");
1781 1781
1782 expr->BuildConstantElements(isolate()); 1782 expr->BuildConstantElements(isolate());
1783 int flags = expr->depth() == 1
1784 ? ArrayLiteral::kShallowElements
1785 : ArrayLiteral::kNoFlags;
1786
1783 ZoneList<Expression*>* subexprs = expr->values(); 1787 ZoneList<Expression*>* subexprs = expr->values();
1784 int length = subexprs->length(); 1788 int length = subexprs->length();
1785 1789
1786 Handle<FixedArray> constant_elements = expr->constant_elements(); 1790 Handle<FixedArray> constant_elements = expr->constant_elements();
1787 ASSERT_EQ(2, constant_elements->length()); 1791 ASSERT_EQ(2, constant_elements->length());
1788 ElementsKind constant_elements_kind = 1792 ElementsKind constant_elements_kind =
1789 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1793 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1790 bool has_fast_elements = 1794 bool has_fast_elements =
1791 IsFastObjectElementsKind(constant_elements_kind); 1795 IsFastObjectElementsKind(constant_elements_kind);
1792 Handle<FixedArrayBase> constant_elements_values( 1796 Handle<FixedArrayBase> constant_elements_values(
1793 FixedArrayBase::cast(constant_elements->get(1))); 1797 FixedArrayBase::cast(constant_elements->get(1)));
1794 1798
1795 __ mov(a0, result_register()); 1799 __ mov(a0, result_register());
1796 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1800 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1797 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 1801 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
1798 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); 1802 __ li(a2, Operand(Smi::FromInt(expr->literal_index())));
1799 __ li(a1, Operand(constant_elements)); 1803 __ li(a1, Operand(constant_elements));
1800 if (has_fast_elements && constant_elements_values->map() == 1804 if (has_fast_elements && constant_elements_values->map() ==
1801 isolate()->heap()->fixed_cow_array_map()) { 1805 isolate()->heap()->fixed_cow_array_map()) {
1802 FastCloneShallowArrayStub stub( 1806 FastCloneShallowArrayStub stub(
1803 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, 1807 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1804 DONT_TRACK_ALLOCATION_SITE, 1808 DONT_TRACK_ALLOCATION_SITE,
1805 length); 1809 length);
1806 __ CallStub(&stub); 1810 __ CallStub(&stub);
1807 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1811 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(),
1808 1, a1, a2); 1812 1, a1, a2);
1809 } else if (expr->depth() > 1 || Serializer::enabled() || 1813 } else if (expr->depth() > 1 || Serializer::enabled() ||
1810 length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1814 length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1811 __ Push(a3, a2, a1); 1815 __ li(a0, Operand(Smi::FromInt(flags)));
1812 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1816 __ Push(a3, a2, a1, a0);
1817 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1813 } else { 1818 } else {
1814 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || 1819 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1815 FLAG_smi_only_arrays); 1820 FLAG_smi_only_arrays);
1816 FastCloneShallowArrayStub::Mode mode = 1821 FastCloneShallowArrayStub::Mode mode =
1817 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; 1822 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1818 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites 1823 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
1819 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; 1824 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
1820 1825
1821 if (has_fast_elements) { 1826 if (has_fast_elements) {
1822 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; 1827 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
(...skipping 3142 matching lines...) Expand 10 before | Expand all | Expand 10 after
4965 Assembler::target_address_at(pc_immediate_load_address)) == 4970 Assembler::target_address_at(pc_immediate_load_address)) ==
4966 reinterpret_cast<uint32_t>( 4971 reinterpret_cast<uint32_t>(
4967 isolate->builtins()->OsrAfterStackCheck()->entry())); 4972 isolate->builtins()->OsrAfterStackCheck()->entry()));
4968 return OSR_AFTER_STACK_CHECK; 4973 return OSR_AFTER_STACK_CHECK;
4969 } 4974 }
4970 4975
4971 4976
4972 } } // namespace v8::internal 4977 } } // namespace v8::internal
4973 4978
4974 #endif // V8_TARGET_ARCH_MIPS 4979 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698