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

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

Issue 718473002: ES6: Add support for super in object literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix code review comments Created 6 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 1365
1366 __ Mov(x10, Operand(isolate()->factory()->undefined_value())); 1366 __ Mov(x10, Operand(isolate()->factory()->undefined_value()));
1367 __ cmp(x0, x10); 1367 __ cmp(x0, x10);
1368 Label done; 1368 Label done;
1369 __ b(&done, ne); 1369 __ b(&done, ne);
1370 __ CallRuntime(Runtime::kThrowNonMethodError, 0); 1370 __ CallRuntime(Runtime::kThrowNonMethodError, 0);
1371 __ bind(&done); 1371 __ bind(&done);
1372 } 1372 }
1373 1373
1374 1374
1375 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer,
1376 int offset) {
1377 if (NeedsHomeObject(initializer)) {
1378 __ Peek(StoreDescriptor::ReceiverRegister(), 0);
1379 __ Mov(StoreDescriptor::NameRegister(),
1380 Operand(isolate()->factory()->home_object_symbol()));
1381 __ Peek(StoreDescriptor::ValueRegister(), offset * kPointerSize);
1382 CallStoreIC();
1383 }
1384 }
1385
1386
1375 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, 1387 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
1376 TypeofState typeof_state, 1388 TypeofState typeof_state,
1377 Label* slow) { 1389 Label* slow) {
1378 Register current = cp; 1390 Register current = cp;
1379 Register next = x10; 1391 Register next = x10;
1380 Register temp = x11; 1392 Register temp = x11;
1381 1393
1382 Scope* s = scope(); 1394 Scope* s = scope();
1383 while (s != NULL) { 1395 while (s != NULL) {
1384 if (s->num_heap_slots() > 0) { 1396 if (s->num_heap_slots() > 0) {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 // It is safe to use [[Put]] here because the boilerplate already 1726 // It is safe to use [[Put]] here because the boilerplate already
1715 // contains computed properties with an uninitialized value. 1727 // contains computed properties with an uninitialized value.
1716 if (key->value()->IsInternalizedString()) { 1728 if (key->value()->IsInternalizedString()) {
1717 if (property->emit_store()) { 1729 if (property->emit_store()) {
1718 VisitForAccumulatorValue(value); 1730 VisitForAccumulatorValue(value);
1719 DCHECK(StoreDescriptor::ValueRegister().is(x0)); 1731 DCHECK(StoreDescriptor::ValueRegister().is(x0));
1720 __ Mov(StoreDescriptor::NameRegister(), Operand(key->value())); 1732 __ Mov(StoreDescriptor::NameRegister(), Operand(key->value()));
1721 __ Peek(StoreDescriptor::ReceiverRegister(), 0); 1733 __ Peek(StoreDescriptor::ReceiverRegister(), 0);
1722 CallStoreIC(key->LiteralFeedbackId()); 1734 CallStoreIC(key->LiteralFeedbackId());
1723 PrepareForBailoutForId(key->id(), NO_REGISTERS); 1735 PrepareForBailoutForId(key->id(), NO_REGISTERS);
1736
1737 if (value != NULL && value->IsFunctionLiteral() &&
Dmitry Lomov (no reviews) 2014/11/11 19:27:47 Use NeedsHomeObject
arv (Not doing code reviews) 2014/11/11 19:51:29 Done.
1738 value->AsFunctionLiteral()->needs_super_binding()) {
1739 __ Mov(StoreDescriptor::ReceiverRegister(), x0);
1740 __ Mov(StoreDescriptor::NameRegister(),
1741 Operand(isolate()->factory()->home_object_symbol()));
1742 __ Peek(StoreDescriptor::ValueRegister(), 0);
1743 CallStoreIC();
1744 }
1724 } else { 1745 } else {
1725 VisitForEffect(value); 1746 VisitForEffect(value);
1726 } 1747 }
1727 break; 1748 break;
1728 } 1749 }
1729 if (property->emit_store()) { 1750 if (property->emit_store()) {
1730 // Duplicate receiver on stack. 1751 // Duplicate receiver on stack.
1731 __ Peek(x0, 0); 1752 __ Peek(x0, 0);
1732 __ Push(x0); 1753 __ Push(x0);
1733 VisitForStackValue(key); 1754 VisitForStackValue(key);
1734 VisitForStackValue(value); 1755 VisitForStackValue(value);
1756 EmitSetHomeObjectIfNeeded(value, 2);
1735 __ Mov(x0, Smi::FromInt(SLOPPY)); // Strict mode 1757 __ Mov(x0, Smi::FromInt(SLOPPY)); // Strict mode
1736 __ Push(x0); 1758 __ Push(x0);
1737 __ CallRuntime(Runtime::kSetProperty, 4); 1759 __ CallRuntime(Runtime::kSetProperty, 4);
1738 } else { 1760 } else {
1739 VisitForEffect(key); 1761 VisitForEffect(key);
1740 VisitForEffect(value); 1762 VisitForEffect(value);
1741 } 1763 }
1742 break; 1764 break;
1743 case ObjectLiteral::Property::PROTOTYPE: 1765 case ObjectLiteral::Property::PROTOTYPE:
1744 if (property->emit_store()) { 1766 if (property->emit_store()) {
(...skipping 17 matching lines...) Expand all
1762 1784
1763 // Emit code to define accessors, using only a single call to the runtime for 1785 // Emit code to define accessors, using only a single call to the runtime for
1764 // each pair of corresponding getters and setters. 1786 // each pair of corresponding getters and setters.
1765 for (AccessorTable::Iterator it = accessor_table.begin(); 1787 for (AccessorTable::Iterator it = accessor_table.begin();
1766 it != accessor_table.end(); 1788 it != accessor_table.end();
1767 ++it) { 1789 ++it) {
1768 __ Peek(x10, 0); // Duplicate receiver. 1790 __ Peek(x10, 0); // Duplicate receiver.
1769 __ Push(x10); 1791 __ Push(x10);
1770 VisitForStackValue(it->first); 1792 VisitForStackValue(it->first);
1771 EmitAccessor(it->second->getter); 1793 EmitAccessor(it->second->getter);
1794 EmitSetHomeObjectIfNeeded(it->second->getter, 2);
1772 EmitAccessor(it->second->setter); 1795 EmitAccessor(it->second->setter);
1796 EmitSetHomeObjectIfNeeded(it->second->setter, 3);
1773 __ Mov(x10, Smi::FromInt(NONE)); 1797 __ Mov(x10, Smi::FromInt(NONE));
1774 __ Push(x10); 1798 __ Push(x10);
1775 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); 1799 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
1776 } 1800 }
1777 1801
1778 if (expr->has_function()) { 1802 if (expr->has_function()) {
1779 DCHECK(result_saved); 1803 DCHECK(result_saved);
1780 __ Peek(x0, 0); 1804 __ Peek(x0, 0);
1781 __ Push(x0); 1805 __ Push(x0);
1782 __ CallRuntime(Runtime::kToFastProperties, 1); 1806 __ CallRuntime(Runtime::kToFastProperties, 1);
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 DCHECK(key != NULL); 2220 DCHECK(key != NULL);
2197 2221
2198 if (property->is_static()) { 2222 if (property->is_static()) {
2199 __ Peek(scratch, kPointerSize); // constructor 2223 __ Peek(scratch, kPointerSize); // constructor
2200 } else { 2224 } else {
2201 __ Peek(scratch, 0); // prototype 2225 __ Peek(scratch, 0); // prototype
2202 } 2226 }
2203 __ Push(scratch); 2227 __ Push(scratch);
2204 VisitForStackValue(key); 2228 VisitForStackValue(key);
2205 VisitForStackValue(value); 2229 VisitForStackValue(value);
2230 EmitSetHomeObjectIfNeeded(value, 2);
2206 2231
2207 switch (property->kind()) { 2232 switch (property->kind()) {
2208 case ObjectLiteral::Property::CONSTANT: 2233 case ObjectLiteral::Property::CONSTANT:
2209 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 2234 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2210 case ObjectLiteral::Property::COMPUTED: 2235 case ObjectLiteral::Property::COMPUTED:
2211 case ObjectLiteral::Property::PROTOTYPE: 2236 case ObjectLiteral::Property::PROTOTYPE:
2212 __ CallRuntime(Runtime::kDefineClassMethod, 3); 2237 __ CallRuntime(Runtime::kDefineClassMethod, 3);
2213 break; 2238 break;
2214 2239
2215 case ObjectLiteral::Property::GETTER: 2240 case ObjectLiteral::Property::GETTER:
(...skipping 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after
5323 return previous_; 5348 return previous_;
5324 } 5349 }
5325 5350
5326 5351
5327 #undef __ 5352 #undef __
5328 5353
5329 5354
5330 } } // namespace v8::internal 5355 } } // namespace v8::internal
5331 5356
5332 #endif // V8_TARGET_ARCH_ARM64 5357 #endif // V8_TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698