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

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

Issue 332443002: Add support for computed property names in object literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Dynamic part of object literal initialized with PutOwnProperty Created 6 years, 6 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 | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | src/ast.h » ('J')
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_ARM 7 #if V8_TARGET_ARCH_ARM
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 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 // 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
1674 // result_saved is false the result is in r0. 1674 // result_saved is false the result is in r0.
1675 bool result_saved = false; 1675 bool result_saved = false;
1676 1676
1677 // Mark all computed expressions that are bound to a key that 1677 // Mark all computed expressions that are bound to a key that
1678 // is shadowed by a later occurrence of the same key. For the 1678 // is shadowed by a later occurrence of the same key. For the
1679 // marked expressions, no store code is emitted. 1679 // marked expressions, no store code is emitted.
1680 expr->CalculateEmitStore(zone()); 1680 expr->CalculateEmitStore(zone());
1681 1681
1682 AccessorTable accessor_table(zone()); 1682 AccessorTable accessor_table(zone());
1683 for (int i = 0; i < expr->properties()->length(); i++) { 1683 int property_index = 0;
1684 ObjectLiteral::Property* property = expr->properties()->at(i); 1684 for (; property_index < expr->properties()->length(); property_index++) {
1685 ObjectLiteral::Property* property = expr->properties()->at(property_index);
1685 if (property->IsCompileTimeValue()) continue; 1686 if (property->IsCompileTimeValue()) continue;
1687 if (property->kind() == ObjectLiteral::Property::COMPUTED_NAME) break;
1686 1688
1687 Literal* key = property->key(); 1689 Literal* key = property->key()->AsLiteral();
1688 Expression* value = property->value(); 1690 Expression* value = property->value();
1689 if (!result_saved) { 1691 if (!result_saved) {
1690 __ push(r0); // Save result on stack 1692 __ push(r0); // Save result on stack
1691 result_saved = true; 1693 result_saved = true;
1692 } 1694 }
1693 switch (property->kind()) { 1695 switch (property->kind()) {
1694 case ObjectLiteral::Property::CONSTANT: 1696 case ObjectLiteral::Property::CONSTANT:
1697 case ObjectLiteral::Property::COMPUTED_NAME:
1695 UNREACHABLE(); 1698 UNREACHABLE();
1696 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1699 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1697 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); 1700 ASSERT(!CompileTimeValue::IsCompileTimeValue(value));
1698 // Fall through. 1701 // Fall through.
1699 case ObjectLiteral::Property::COMPUTED: 1702 case ObjectLiteral::Property::COMPUTED:
1700 if (key->value()->IsInternalizedString()) { 1703 if (key->value()->IsInternalizedString()) {
1701 if (property->emit_store()) { 1704 if (property->emit_store()) {
1702 VisitForAccumulatorValue(value); 1705 VisitForAccumulatorValue(value);
1703 __ mov(r2, Operand(key->value())); 1706 __ mov(r2, Operand(key->value()));
1704 __ ldr(r1, MemOperand(sp)); 1707 __ ldr(r1, MemOperand(sp));
1705 CallStoreIC(key->LiteralFeedbackId()); 1708 CallStoreIC(key->LiteralFeedbackId());
1706 PrepareForBailoutForId(key->id(), NO_REGISTERS); 1709 PrepareForBailoutForId(key->id(), NO_REGISTERS);
1707 } else { 1710 } else {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 __ ldr(r0, MemOperand(sp)); // Duplicate receiver. 1754 __ ldr(r0, MemOperand(sp)); // Duplicate receiver.
1752 __ push(r0); 1755 __ push(r0);
1753 VisitForStackValue(it->first); 1756 VisitForStackValue(it->first);
1754 EmitAccessor(it->second->getter); 1757 EmitAccessor(it->second->getter);
1755 EmitAccessor(it->second->setter); 1758 EmitAccessor(it->second->setter);
1756 __ mov(r0, Operand(Smi::FromInt(NONE))); 1759 __ mov(r0, Operand(Smi::FromInt(NONE)));
1757 __ push(r0); 1760 __ push(r0);
1758 __ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5); 1761 __ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
1759 } 1762 }
1760 1763
1764 for (; property_index < expr->properties()->length(); property_index++) {
1765 ObjectLiteral::Property* property = expr->properties()->at(property_index);
1766
1767 Expression* key = property->key();
1768 Expression* value = property->value();
1769 if (!result_saved) {
1770 __ push(r0); // Save result on the stack
1771 result_saved = true;
1772 }
1773
1774 switch (property->kind()) {
1775 case ObjectLiteral::Property::CONSTANT:
1776 case ObjectLiteral::Property::COMPUTED_NAME:
1777 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1778 case ObjectLiteral::Property::COMPUTED:
1779 // Duplicate receiver on stack.
1780 __ ldr(r0, MemOperand(sp));
1781 __ push(r0);
1782 VisitForStackValue(key);
1783 VisitForStackValue(value);
1784 if (property->emit_store()) {
1785 __ CallRuntime(Runtime::kPutOwnProperty, 3);
1786 } else {
1787 __ Drop(3);
1788 }
1789 break;
1790 case ObjectLiteral::Property::PROTOTYPE:
1791 // Duplicate receiver on stack.
1792 __ ldr(r0, MemOperand(sp));
1793 __ push(r0);
1794 VisitForStackValue(value);
1795 if (property->emit_store()) {
1796 __ CallRuntime(Runtime::kSetPrototype, 2);
1797 } else {
1798 __ Drop(2);
1799 }
1800 break;
1801 case ObjectLiteral::Property::GETTER: {
1802 ObjectLiteral::Accessors *accessors =
1803 accessor_table.lookup(key->AsLiteral())->second;
1804 accessors->getter = value;
1805
1806 // Duplicate receiver on stack.
1807 __ ldr(r0, MemOperand(sp));
1808 __ push(r0);
1809 VisitForStackValue(key);
1810 EmitAccessor(accessors->getter);
1811 EmitAccessor(accessors->setter);
1812 __ mov(r0, Operand(Smi::FromInt(NONE)));
1813 __ push(r0);
1814 __ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
1815 break;
1816 }
1817 case ObjectLiteral::Property::SETTER: {
1818 ObjectLiteral::Accessors *accessors =
1819 accessor_table.lookup(key->AsLiteral())->second;
1820 accessors->setter = value;
1821
1822 // Duplicate receiver on stack.
1823 __ ldr(r0, MemOperand(sp));
1824 __ push(r0);
1825 VisitForStackValue(key);
1826 EmitAccessor(accessors->getter);
1827 EmitAccessor(accessors->setter);
1828 __ mov(r0, Operand(Smi::FromInt(NONE)));
1829 __ push(r0);
1830 __ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
1831 break;
1832 }
1833 }
1834 }
1835
1761 if (expr->has_function()) { 1836 if (expr->has_function()) {
1762 ASSERT(result_saved); 1837 ASSERT(result_saved);
1763 __ ldr(r0, MemOperand(sp)); 1838 __ ldr(r0, MemOperand(sp));
1764 __ push(r0); 1839 __ push(r0);
1765 __ CallRuntime(Runtime::kToFastProperties, 1); 1840 __ CallRuntime(Runtime::kToFastProperties, 1);
1766 } 1841 }
1767 1842
1768 if (result_saved) { 1843 if (result_saved) {
1769 context()->PlugTOS(); 1844 context()->PlugTOS();
1770 } else { 1845 } else {
(...skipping 3060 matching lines...) Expand 10 before | Expand all | Expand 10 after
4831 4906
4832 ASSERT(interrupt_address == 4907 ASSERT(interrupt_address ==
4833 isolate->builtins()->OsrAfterStackCheck()->entry()); 4908 isolate->builtins()->OsrAfterStackCheck()->entry());
4834 return OSR_AFTER_STACK_CHECK; 4909 return OSR_AFTER_STACK_CHECK;
4835 } 4910 }
4836 4911
4837 4912
4838 } } // namespace v8::internal 4913 } } // namespace v8::internal
4839 4914
4840 #endif // V8_TARGET_ARCH_ARM 4915 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | src/ast.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698