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/ia32/full-codegen-ia32.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/ia32/codegen-ia32.cc ('k') | src/ia32/ic-ia32.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 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 1642
1643 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1643 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1644 Comment cmnt(masm_, "[ ArrayLiteral"); 1644 Comment cmnt(masm_, "[ ArrayLiteral");
1645 1645
1646 ZoneList<Expression*>* subexprs = expr->values(); 1646 ZoneList<Expression*>* subexprs = expr->values();
1647 int length = subexprs->length(); 1647 int length = subexprs->length();
1648 Handle<FixedArray> constant_elements = expr->constant_elements(); 1648 Handle<FixedArray> constant_elements = expr->constant_elements();
1649 ASSERT_EQ(2, constant_elements->length()); 1649 ASSERT_EQ(2, constant_elements->length());
1650 ElementsKind constant_elements_kind = 1650 ElementsKind constant_elements_kind =
1651 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1651 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1652 bool has_constant_fast_elements = 1652 bool has_constant_fast_elements = constant_elements_kind == FAST_ELEMENTS;
1653 IsFastObjectElementsKind(constant_elements_kind);
1654 Handle<FixedArrayBase> constant_elements_values( 1653 Handle<FixedArrayBase> constant_elements_values(
1655 FixedArrayBase::cast(constant_elements->get(1))); 1654 FixedArrayBase::cast(constant_elements->get(1)));
1656 1655
1657 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1656 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1658 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1657 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
1659 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1658 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1660 __ push(Immediate(constant_elements)); 1659 __ push(Immediate(constant_elements));
1661 Heap* heap = isolate()->heap(); 1660 Heap* heap = isolate()->heap();
1662 if (has_constant_fast_elements && 1661 if (has_constant_fast_elements &&
1663 constant_elements_values->map() == heap->fixed_cow_array_map()) { 1662 constant_elements_values->map() == heap->fixed_cow_array_map()) {
1664 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot 1663 // If the elements are already FAST_ELEMENTS, the boilerplate cannot
1665 // change, so it's possible to specialize the stub in advance. 1664 // change, so it's possible to specialize the stub in advance.
1666 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); 1665 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
1667 FastCloneShallowArrayStub stub( 1666 FastCloneShallowArrayStub stub(
1668 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, 1667 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1669 length); 1668 length);
1670 __ CallStub(&stub); 1669 __ CallStub(&stub);
1671 } else if (expr->depth() > 1) { 1670 } else if (expr->depth() > 1) {
1672 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1671 __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
1673 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1672 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1674 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); 1673 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3);
1675 } else { 1674 } else {
1676 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || 1675 ASSERT(constant_elements_kind == FAST_ELEMENTS ||
1676 constant_elements_kind == FAST_SMI_ONLY_ELEMENTS ||
1677 FLAG_smi_only_arrays); 1677 FLAG_smi_only_arrays);
1678 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot 1678 // If the elements are already FAST_ELEMENTS, the boilerplate cannot
1679 // change, so it's possible to specialize the stub in advance. 1679 // change, so it's possible to specialize the stub in advance.
1680 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements 1680 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements
1681 ? FastCloneShallowArrayStub::CLONE_ELEMENTS 1681 ? FastCloneShallowArrayStub::CLONE_ELEMENTS
1682 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; 1682 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1683 FastCloneShallowArrayStub stub(mode, length); 1683 FastCloneShallowArrayStub stub(mode, length);
1684 __ CallStub(&stub); 1684 __ CallStub(&stub);
1685 } 1685 }
1686 1686
1687 bool result_saved = false; // Is the result saved to the stack? 1687 bool result_saved = false; // Is the result saved to the stack?
1688 1688
1689 // Emit code to evaluate all the non-constant subexpressions and to store 1689 // Emit code to evaluate all the non-constant subexpressions and to store
1690 // them into the newly cloned array. 1690 // them into the newly cloned array.
1691 for (int i = 0; i < length; i++) { 1691 for (int i = 0; i < length; i++) {
1692 Expression* subexpr = subexprs->at(i); 1692 Expression* subexpr = subexprs->at(i);
1693 // If the subexpression is a literal or a simple materialized literal it 1693 // If the subexpression is a literal or a simple materialized literal it
1694 // is already set in the cloned array. 1694 // is already set in the cloned array.
1695 if (subexpr->AsLiteral() != NULL || 1695 if (subexpr->AsLiteral() != NULL ||
1696 CompileTimeValue::IsCompileTimeValue(subexpr)) { 1696 CompileTimeValue::IsCompileTimeValue(subexpr)) {
1697 continue; 1697 continue;
1698 } 1698 }
1699 1699
1700 if (!result_saved) { 1700 if (!result_saved) {
1701 __ push(eax); 1701 __ push(eax);
1702 result_saved = true; 1702 result_saved = true;
1703 } 1703 }
1704 VisitForAccumulatorValue(subexpr); 1704 VisitForAccumulatorValue(subexpr);
1705 1705
1706 if (IsFastObjectElementsKind(constant_elements_kind)) { 1706 if (constant_elements_kind == FAST_ELEMENTS) {
1707 // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they 1707 // Fast-case array literal with ElementsKind of FAST_ELEMENTS, they cannot
1708 // cannot transition and don't need to call the runtime stub. 1708 // transition and don't need to call the runtime stub.
1709 int offset = FixedArray::kHeaderSize + (i * kPointerSize); 1709 int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1710 __ mov(ebx, Operand(esp, 0)); // Copy of array literal. 1710 __ mov(ebx, Operand(esp, 0)); // Copy of array literal.
1711 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); 1711 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset));
1712 // Store the subexpression value in the array's elements. 1712 // Store the subexpression value in the array's elements.
1713 __ mov(FieldOperand(ebx, offset), result_register()); 1713 __ mov(FieldOperand(ebx, offset), result_register());
1714 // Update the write barrier for the array store. 1714 // Update the write barrier for the array store.
1715 __ RecordWriteField(ebx, offset, result_register(), ecx, 1715 __ RecordWriteField(ebx, offset, result_register(), ecx,
1716 kDontSaveFPRegs, 1716 kDontSaveFPRegs,
1717 EMIT_REMEMBERED_SET, 1717 EMIT_REMEMBERED_SET,
1718 INLINE_SMI_CHECK); 1718 INLINE_SMI_CHECK);
(...skipping 2799 matching lines...) Expand 10 before | Expand all | Expand 10 after
4518 *context_length = 0; 4518 *context_length = 0;
4519 return previous_; 4519 return previous_;
4520 } 4520 }
4521 4521
4522 4522
4523 #undef __ 4523 #undef __
4524 4524
4525 } } // namespace v8::internal 4525 } } // namespace v8::internal
4526 4526
4527 #endif // V8_TARGET_ARCH_IA32 4527 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698