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

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

Issue 10442015: Rollback of r11638, r11636 on trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 7 months 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/mips/codegen-mips.cc ('k') | src/mips/ic-mips.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 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1704 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1705 Comment cmnt(masm_, "[ ArrayLiteral"); 1705 Comment cmnt(masm_, "[ ArrayLiteral");
1706 1706
1707 ZoneList<Expression*>* subexprs = expr->values(); 1707 ZoneList<Expression*>* subexprs = expr->values();
1708 int length = subexprs->length(); 1708 int length = subexprs->length();
1709 1709
1710 Handle<FixedArray> constant_elements = expr->constant_elements(); 1710 Handle<FixedArray> constant_elements = expr->constant_elements();
1711 ASSERT_EQ(2, constant_elements->length()); 1711 ASSERT_EQ(2, constant_elements->length());
1712 ElementsKind constant_elements_kind = 1712 ElementsKind constant_elements_kind =
1713 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1713 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1714 bool has_fast_elements = 1714 bool has_fast_elements = constant_elements_kind == FAST_ELEMENTS;
1715 IsFastObjectElementsKind(constant_elements_kind);
1716 Handle<FixedArrayBase> constant_elements_values( 1715 Handle<FixedArrayBase> constant_elements_values(
1717 FixedArrayBase::cast(constant_elements->get(1))); 1716 FixedArrayBase::cast(constant_elements->get(1)));
1718 1717
1719 __ mov(a0, result_register()); 1718 __ mov(a0, result_register());
1720 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1719 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1721 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); 1720 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
1722 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); 1721 __ li(a2, Operand(Smi::FromInt(expr->literal_index())));
1723 __ li(a1, Operand(constant_elements)); 1722 __ li(a1, Operand(constant_elements));
1724 __ Push(a3, a2, a1); 1723 __ Push(a3, a2, a1);
1725 if (has_fast_elements && constant_elements_values->map() == 1724 if (has_fast_elements && constant_elements_values->map() ==
1726 isolate()->heap()->fixed_cow_array_map()) { 1725 isolate()->heap()->fixed_cow_array_map()) {
1727 FastCloneShallowArrayStub stub( 1726 FastCloneShallowArrayStub stub(
1728 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length); 1727 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length);
1729 __ CallStub(&stub); 1728 __ CallStub(&stub);
1730 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1729 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(),
1731 1, a1, a2); 1730 1, a1, a2);
1732 } else if (expr->depth() > 1) { 1731 } else if (expr->depth() > 1) {
1733 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1732 __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
1734 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1733 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1735 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); 1734 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3);
1736 } else { 1735 } else {
1737 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || 1736 ASSERT(constant_elements_kind == FAST_ELEMENTS ||
1737 constant_elements_kind == FAST_SMI_ONLY_ELEMENTS ||
1738 FLAG_smi_only_arrays); 1738 FLAG_smi_only_arrays);
1739 FastCloneShallowArrayStub::Mode mode = has_fast_elements 1739 FastCloneShallowArrayStub::Mode mode = has_fast_elements
1740 ? FastCloneShallowArrayStub::CLONE_ELEMENTS 1740 ? FastCloneShallowArrayStub::CLONE_ELEMENTS
1741 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; 1741 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1742 FastCloneShallowArrayStub stub(mode, length); 1742 FastCloneShallowArrayStub stub(mode, length);
1743 __ CallStub(&stub); 1743 __ CallStub(&stub);
1744 } 1744 }
1745 1745
1746 bool result_saved = false; // Is the result saved to the stack? 1746 bool result_saved = false; // Is the result saved to the stack?
1747 1747
1748 // Emit code to evaluate all the non-constant subexpressions and to store 1748 // Emit code to evaluate all the non-constant subexpressions and to store
1749 // them into the newly cloned array. 1749 // them into the newly cloned array.
1750 for (int i = 0; i < length; i++) { 1750 for (int i = 0; i < length; i++) {
1751 Expression* subexpr = subexprs->at(i); 1751 Expression* subexpr = subexprs->at(i);
1752 // If the subexpression is a literal or a simple materialized literal it 1752 // If the subexpression is a literal or a simple materialized literal it
1753 // is already set in the cloned array. 1753 // is already set in the cloned array.
1754 if (subexpr->AsLiteral() != NULL || 1754 if (subexpr->AsLiteral() != NULL ||
1755 CompileTimeValue::IsCompileTimeValue(subexpr)) { 1755 CompileTimeValue::IsCompileTimeValue(subexpr)) {
1756 continue; 1756 continue;
1757 } 1757 }
1758 1758
1759 if (!result_saved) { 1759 if (!result_saved) {
1760 __ push(v0); 1760 __ push(v0);
1761 result_saved = true; 1761 result_saved = true;
1762 } 1762 }
1763 1763
1764 VisitForAccumulatorValue(subexpr); 1764 VisitForAccumulatorValue(subexpr);
1765 1765
1766 if (IsFastObjectElementsKind(constant_elements_kind)) { 1766 if (constant_elements_kind == FAST_ELEMENTS) {
1767 int offset = FixedArray::kHeaderSize + (i * kPointerSize); 1767 int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1768 __ lw(t2, MemOperand(sp)); // Copy of array literal. 1768 __ lw(t2, MemOperand(sp)); // Copy of array literal.
1769 __ lw(a1, FieldMemOperand(t2, JSObject::kElementsOffset)); 1769 __ lw(a1, FieldMemOperand(t2, JSObject::kElementsOffset));
1770 __ sw(result_register(), FieldMemOperand(a1, offset)); 1770 __ sw(result_register(), FieldMemOperand(a1, offset));
1771 // Update the write barrier for the array store. 1771 // Update the write barrier for the array store.
1772 __ RecordWriteField(a1, offset, result_register(), a2, 1772 __ RecordWriteField(a1, offset, result_register(), a2,
1773 kRAHasBeenSaved, kDontSaveFPRegs, 1773 kRAHasBeenSaved, kDontSaveFPRegs,
1774 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK); 1774 EMIT_REMEMBERED_SET, INLINE_SMI_CHECK);
1775 } else { 1775 } else {
1776 __ lw(a1, MemOperand(sp)); // Copy of array literal. 1776 __ lw(a1, MemOperand(sp)); // Copy of array literal.
(...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after
4572 *context_length = 0; 4572 *context_length = 0;
4573 return previous_; 4573 return previous_;
4574 } 4574 }
4575 4575
4576 4576
4577 #undef __ 4577 #undef __
4578 4578
4579 } } // namespace v8::internal 4579 } } // namespace v8::internal
4580 4580
4581 #endif // V8_TARGET_ARCH_MIPS 4581 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/codegen-mips.cc ('k') | src/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698