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

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

Issue 78493002: MaterializedLiteral expressions need to cache expression depth. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Updated with feedback from Ulan. Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | 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 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 __ push(a1); 1638 __ push(a1);
1639 } else { 1639 } else {
1640 VisitForStackValue(expression); 1640 VisitForStackValue(expression);
1641 } 1641 }
1642 } 1642 }
1643 1643
1644 1644
1645 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1645 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1646 Comment cmnt(masm_, "[ ObjectLiteral"); 1646 Comment cmnt(masm_, "[ ObjectLiteral");
1647 1647
1648 int depth = 1; 1648 expr->BuildConstantProperties(isolate());
1649 expr->BuildConstantProperties(isolate(), &depth);
1650 Handle<FixedArray> constant_properties = expr->constant_properties(); 1649 Handle<FixedArray> constant_properties = expr->constant_properties();
1651 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1650 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1652 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 1651 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
1653 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); 1652 __ li(a2, Operand(Smi::FromInt(expr->literal_index())));
1654 __ li(a1, Operand(constant_properties)); 1653 __ li(a1, Operand(constant_properties));
1655 int flags = expr->fast_elements() 1654 int flags = expr->fast_elements()
1656 ? ObjectLiteral::kFastElements 1655 ? ObjectLiteral::kFastElements
1657 : ObjectLiteral::kNoFlags; 1656 : ObjectLiteral::kNoFlags;
1658 flags |= expr->has_function() 1657 flags |= expr->has_function()
1659 ? ObjectLiteral::kHasFunction 1658 ? ObjectLiteral::kHasFunction
1660 : ObjectLiteral::kNoFlags; 1659 : ObjectLiteral::kNoFlags;
1661 __ li(a0, Operand(Smi::FromInt(flags))); 1660 __ li(a0, Operand(Smi::FromInt(flags)));
1662 int properties_count = constant_properties->length() / 2; 1661 int properties_count = constant_properties->length() / 2;
1663 if ((FLAG_track_double_fields && expr->may_store_doubles()) || 1662 if ((FLAG_track_double_fields && expr->may_store_doubles()) ||
1664 depth > 1 || Serializer::enabled() || 1663 expr->depth() > 1 || Serializer::enabled() ||
1665 flags != ObjectLiteral::kFastElements || 1664 flags != ObjectLiteral::kFastElements ||
1666 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 1665 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1667 __ Push(a3, a2, a1, a0); 1666 __ Push(a3, a2, a1, a0);
1668 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1667 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1669 } else { 1668 } else {
1670 FastCloneShallowObjectStub stub(properties_count); 1669 FastCloneShallowObjectStub stub(properties_count);
1671 __ CallStub(&stub); 1670 __ CallStub(&stub);
1672 } 1671 }
1673 1672
1674 // If result_saved is true the result is on top of the stack. If 1673 // If result_saved is true the result is on top of the stack. If
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 context()->PlugTOS(); 1772 context()->PlugTOS();
1774 } else { 1773 } else {
1775 context()->Plug(v0); 1774 context()->Plug(v0);
1776 } 1775 }
1777 } 1776 }
1778 1777
1779 1778
1780 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1779 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1781 Comment cmnt(masm_, "[ ArrayLiteral"); 1780 Comment cmnt(masm_, "[ ArrayLiteral");
1782 1781
1783 int depth = 1; 1782 expr->BuildConstantElements(isolate());
1784 expr->BuildConstantElements(isolate(), &depth);
1785 ZoneList<Expression*>* subexprs = expr->values(); 1783 ZoneList<Expression*>* subexprs = expr->values();
1786 int length = subexprs->length(); 1784 int length = subexprs->length();
1787 1785
1788 Handle<FixedArray> constant_elements = expr->constant_elements(); 1786 Handle<FixedArray> constant_elements = expr->constant_elements();
1789 ASSERT_EQ(2, constant_elements->length()); 1787 ASSERT_EQ(2, constant_elements->length());
1790 ElementsKind constant_elements_kind = 1788 ElementsKind constant_elements_kind =
1791 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1789 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1792 bool has_fast_elements = 1790 bool has_fast_elements =
1793 IsFastObjectElementsKind(constant_elements_kind); 1791 IsFastObjectElementsKind(constant_elements_kind);
1794 Handle<FixedArrayBase> constant_elements_values( 1792 Handle<FixedArrayBase> constant_elements_values(
1795 FixedArrayBase::cast(constant_elements->get(1))); 1793 FixedArrayBase::cast(constant_elements->get(1)));
1796 1794
1797 __ mov(a0, result_register()); 1795 __ mov(a0, result_register());
1798 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1796 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1799 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 1797 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
1800 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); 1798 __ li(a2, Operand(Smi::FromInt(expr->literal_index())));
1801 __ li(a1, Operand(constant_elements)); 1799 __ li(a1, Operand(constant_elements));
1802 if (has_fast_elements && constant_elements_values->map() == 1800 if (has_fast_elements && constant_elements_values->map() ==
1803 isolate()->heap()->fixed_cow_array_map()) { 1801 isolate()->heap()->fixed_cow_array_map()) {
1804 FastCloneShallowArrayStub stub( 1802 FastCloneShallowArrayStub stub(
1805 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, 1803 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1806 DONT_TRACK_ALLOCATION_SITE, 1804 DONT_TRACK_ALLOCATION_SITE,
1807 length); 1805 length);
1808 __ CallStub(&stub); 1806 __ CallStub(&stub);
1809 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1807 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(),
1810 1, a1, a2); 1808 1, a1, a2);
1811 } else if (depth > 1 || Serializer::enabled() || 1809 } else if (expr->depth() > 1 || Serializer::enabled() ||
1812 length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1810 length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1813 __ Push(a3, a2, a1); 1811 __ Push(a3, a2, a1);
1814 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1812 __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
1815 } else { 1813 } else {
1816 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || 1814 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1817 FLAG_smi_only_arrays); 1815 FLAG_smi_only_arrays);
1818 FastCloneShallowArrayStub::Mode mode = 1816 FastCloneShallowArrayStub::Mode mode =
1819 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; 1817 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1820 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites 1818 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
1821 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; 1819 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
(...skipping 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after
5009 Assembler::target_address_at(pc_immediate_load_address)) == 5007 Assembler::target_address_at(pc_immediate_load_address)) ==
5010 reinterpret_cast<uint32_t>( 5008 reinterpret_cast<uint32_t>(
5011 isolate->builtins()->OsrAfterStackCheck()->entry())); 5009 isolate->builtins()->OsrAfterStackCheck()->entry()));
5012 return OSR_AFTER_STACK_CHECK; 5010 return OSR_AFTER_STACK_CHECK;
5013 } 5011 }
5014 5012
5015 5013
5016 } } // namespace v8::internal 5014 } } // namespace v8::internal
5017 5015
5018 #endif // V8_TARGET_ARCH_MIPS 5016 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698