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

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

Issue 352173004: Relax object literal checking to follow ES6 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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/preparser.h ('k') | test/cctest/test-parsing.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 for (int i = 0; i < expr->properties()->length(); i++) { 1651 for (int i = 0; i < expr->properties()->length(); i++) {
1652 ObjectLiteral::Property* property = expr->properties()->at(i); 1652 ObjectLiteral::Property* property = expr->properties()->at(i);
1653 if (property->IsCompileTimeValue()) continue; 1653 if (property->IsCompileTimeValue()) continue;
1654 1654
1655 Literal* key = property->key(); 1655 Literal* key = property->key();
1656 Expression* value = property->value(); 1656 Expression* value = property->value();
1657 if (!result_saved) { 1657 if (!result_saved) {
1658 __ Push(rax); // Save result on the stack 1658 __ Push(rax); // Save result on the stack
1659 result_saved = true; 1659 result_saved = true;
1660 } 1660 }
1661 switch (property->kind()) { 1661 if (!property->emit_store()) {
1662 case ObjectLiteral::Property::CONSTANT: 1662 VisitForEffect(value);
1663 UNREACHABLE(); 1663 } else {
1664 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1664 switch (property->kind()) {
1665 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); 1665 case ObjectLiteral::Property::CONSTANT:
1666 // Fall through. 1666 UNREACHABLE();
1667 case ObjectLiteral::Property::COMPUTED: 1667 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1668 if (key->value()->IsInternalizedString()) { 1668 ASSERT(!CompileTimeValue::IsCompileTimeValue(value));
1669 if (property->emit_store()) { 1669 // Fall through.
1670 case ObjectLiteral::Property::COMPUTED:
1671 if (key->value()->IsInternalizedString()) {
1670 VisitForAccumulatorValue(value); 1672 VisitForAccumulatorValue(value);
1671 __ Move(rcx, key->value()); 1673 __ Move(rcx, key->value());
1672 __ movp(rdx, Operand(rsp, 0)); 1674 __ movp(rdx, Operand(rsp, 0));
1673 CallStoreIC(key->LiteralFeedbackId()); 1675 CallStoreIC(key->LiteralFeedbackId());
1674 PrepareForBailoutForId(key->id(), NO_REGISTERS); 1676 PrepareForBailoutForId(key->id(), NO_REGISTERS);
1675 } else { 1677 } else {
1676 VisitForEffect(value); 1678 __ Push(Operand(rsp, 0)); // Duplicate receiver.
1679 VisitForStackValue(key);
1680 VisitForStackValue(value);
1681 __ Push(Smi::FromInt(NONE)); // PropertyAttributes
1682 __ CallRuntime(Runtime::kSetProperty, 4);
1677 } 1683 }
1678 break; 1684 break;
1679 } 1685 case ObjectLiteral::Property::PROTOTYPE:
1680 __ Push(Operand(rsp, 0)); // Duplicate receiver. 1686 __ Push(Operand(rsp, 0)); // Duplicate receiver.
1681 VisitForStackValue(key); 1687 VisitForStackValue(value);
1682 VisitForStackValue(value);
1683 if (property->emit_store()) {
1684 __ Push(Smi::FromInt(NONE)); // PropertyAttributes
1685 __ CallRuntime(Runtime::kSetProperty, 4);
1686 } else {
1687 __ Drop(3);
1688 }
1689 break;
1690 case ObjectLiteral::Property::PROTOTYPE:
1691 __ Push(Operand(rsp, 0)); // Duplicate receiver.
1692 VisitForStackValue(value);
1693 if (property->emit_store()) {
1694 __ CallRuntime(Runtime::kSetPrototype, 2); 1688 __ CallRuntime(Runtime::kSetPrototype, 2);
1695 } else { 1689 break;
1696 __ Drop(2); 1690 case ObjectLiteral::Property::GETTER:
1697 } 1691 accessor_table.lookup(key)->second->getter = value;
1698 break; 1692 break;
1699 case ObjectLiteral::Property::GETTER: 1693 case ObjectLiteral::Property::SETTER:
1700 accessor_table.lookup(key)->second->getter = value; 1694 accessor_table.lookup(key)->second->setter = value;
1701 break; 1695 break;
1702 case ObjectLiteral::Property::SETTER: 1696 }
1703 accessor_table.lookup(key)->second->setter = value;
1704 break;
1705 } 1697 }
1706 } 1698 }
1707 1699
1708 // Emit code to define accessors, using only a single call to the runtime for 1700 // Emit code to define accessors, using only a single call to the runtime for
1709 // each pair of corresponding getters and setters. 1701 // each pair of corresponding getters and setters.
1710 for (AccessorTable::Iterator it = accessor_table.begin(); 1702 for (AccessorTable::Iterator it = accessor_table.begin();
1711 it != accessor_table.end(); 1703 it != accessor_table.end();
1712 ++it) { 1704 ++it) {
1713 __ Push(Operand(rsp, 0)); // Duplicate receiver. 1705 __ Push(Operand(rsp, 0)); // Duplicate receiver.
1714 VisitForStackValue(it->first); 1706 VisitForStackValue(it->first);
(...skipping 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after
4804 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4796 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4805 Assembler::target_address_at(call_target_address, 4797 Assembler::target_address_at(call_target_address,
4806 unoptimized_code)); 4798 unoptimized_code));
4807 return OSR_AFTER_STACK_CHECK; 4799 return OSR_AFTER_STACK_CHECK;
4808 } 4800 }
4809 4801
4810 4802
4811 } } // namespace v8::internal 4803 } } // namespace v8::internal
4812 4804
4813 #endif // V8_TARGET_ARCH_X64 4805 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698