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

Side by Side Diff: src/ia32/full-codegen-ia32.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 remaining code review issues 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/preparser.h » ('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_IA32 7 #if V8_TARGET_ARCH_IA32
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 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 } 1299 }
1300 1300
1301 __ cmp(eax, isolate()->factory()->undefined_value()); 1301 __ cmp(eax, isolate()->factory()->undefined_value());
1302 Label done; 1302 Label done;
1303 __ j(not_equal, &done); 1303 __ j(not_equal, &done);
1304 __ CallRuntime(Runtime::kThrowNonMethodError, 0); 1304 __ CallRuntime(Runtime::kThrowNonMethodError, 0);
1305 __ bind(&done); 1305 __ bind(&done);
1306 } 1306 }
1307 1307
1308 1308
1309 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer,
1310 int offset) {
1311 if (NeedsHomeObject(initializer)) {
1312 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0));
1313 __ mov(StoreDescriptor::NameRegister(),
1314 Immediate(isolate()->factory()->home_object_symbol()));
1315 __ mov(StoreDescriptor::ValueRegister(),
1316 Operand(esp, offset * kPointerSize));
1317 CallStoreIC();
1318 }
1319 }
1320
1321
1309 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, 1322 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
1310 TypeofState typeof_state, 1323 TypeofState typeof_state,
1311 Label* slow) { 1324 Label* slow) {
1312 Register context = esi; 1325 Register context = esi;
1313 Register temp = edx; 1326 Register temp = edx;
1314 1327
1315 Scope* s = scope(); 1328 Scope* s = scope();
1316 while (s != NULL) { 1329 while (s != NULL) {
1317 if (s->num_heap_slots() > 0) { 1330 if (s->num_heap_slots() > 0) {
1318 if (s->calls_sloppy_eval()) { 1331 if (s->calls_sloppy_eval()) {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 // It is safe to use [[Put]] here because the boilerplate already 1676 // It is safe to use [[Put]] here because the boilerplate already
1664 // contains computed properties with an uninitialized value. 1677 // contains computed properties with an uninitialized value.
1665 if (key->value()->IsInternalizedString()) { 1678 if (key->value()->IsInternalizedString()) {
1666 if (property->emit_store()) { 1679 if (property->emit_store()) {
1667 VisitForAccumulatorValue(value); 1680 VisitForAccumulatorValue(value);
1668 DCHECK(StoreDescriptor::ValueRegister().is(eax)); 1681 DCHECK(StoreDescriptor::ValueRegister().is(eax));
1669 __ mov(StoreDescriptor::NameRegister(), Immediate(key->value())); 1682 __ mov(StoreDescriptor::NameRegister(), Immediate(key->value()));
1670 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); 1683 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0));
1671 CallStoreIC(key->LiteralFeedbackId()); 1684 CallStoreIC(key->LiteralFeedbackId());
1672 PrepareForBailoutForId(key->id(), NO_REGISTERS); 1685 PrepareForBailoutForId(key->id(), NO_REGISTERS);
1686
1687 if (NeedsHomeObject(value)) {
1688 __ mov(StoreDescriptor::ReceiverRegister(), eax);
1689 __ mov(StoreDescriptor::NameRegister(),
1690 Immediate(isolate()->factory()->home_object_symbol()));
1691 __ mov(StoreDescriptor::ValueRegister(), Operand(esp, 0));
1692 CallStoreIC();
1693 }
1673 } else { 1694 } else {
1674 VisitForEffect(value); 1695 VisitForEffect(value);
1675 } 1696 }
1676 break; 1697 break;
1677 } 1698 }
1678 __ push(Operand(esp, 0)); // Duplicate receiver. 1699 __ push(Operand(esp, 0)); // Duplicate receiver.
1679 VisitForStackValue(key); 1700 VisitForStackValue(key);
1680 VisitForStackValue(value); 1701 VisitForStackValue(value);
1681 if (property->emit_store()) { 1702 if (property->emit_store()) {
1703 EmitSetHomeObjectIfNeeded(value, 2);
1682 __ push(Immediate(Smi::FromInt(SLOPPY))); // Strict mode 1704 __ push(Immediate(Smi::FromInt(SLOPPY))); // Strict mode
1683 __ CallRuntime(Runtime::kSetProperty, 4); 1705 __ CallRuntime(Runtime::kSetProperty, 4);
1684 } else { 1706 } else {
1685 __ Drop(3); 1707 __ Drop(3);
1686 } 1708 }
1687 break; 1709 break;
1688 case ObjectLiteral::Property::PROTOTYPE: 1710 case ObjectLiteral::Property::PROTOTYPE:
1689 __ push(Operand(esp, 0)); // Duplicate receiver. 1711 __ push(Operand(esp, 0)); // Duplicate receiver.
1690 VisitForStackValue(value); 1712 VisitForStackValue(value);
1691 if (property->emit_store()) { 1713 if (property->emit_store()) {
(...skipping 12 matching lines...) Expand all
1704 } 1726 }
1705 1727
1706 // Emit code to define accessors, using only a single call to the runtime for 1728 // Emit code to define accessors, using only a single call to the runtime for
1707 // each pair of corresponding getters and setters. 1729 // each pair of corresponding getters and setters.
1708 for (AccessorTable::Iterator it = accessor_table.begin(); 1730 for (AccessorTable::Iterator it = accessor_table.begin();
1709 it != accessor_table.end(); 1731 it != accessor_table.end();
1710 ++it) { 1732 ++it) {
1711 __ push(Operand(esp, 0)); // Duplicate receiver. 1733 __ push(Operand(esp, 0)); // Duplicate receiver.
1712 VisitForStackValue(it->first); 1734 VisitForStackValue(it->first);
1713 EmitAccessor(it->second->getter); 1735 EmitAccessor(it->second->getter);
1736 EmitSetHomeObjectIfNeeded(it->second->getter, 2);
1714 EmitAccessor(it->second->setter); 1737 EmitAccessor(it->second->setter);
1738 EmitSetHomeObjectIfNeeded(it->second->setter, 3);
1715 __ push(Immediate(Smi::FromInt(NONE))); 1739 __ push(Immediate(Smi::FromInt(NONE)));
1716 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); 1740 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
1717 } 1741 }
1718 1742
1719 if (expr->has_function()) { 1743 if (expr->has_function()) {
1720 DCHECK(result_saved); 1744 DCHECK(result_saved);
1721 __ push(Operand(esp, 0)); 1745 __ push(Operand(esp, 0));
1722 __ CallRuntime(Runtime::kToFastProperties, 1); 1746 __ CallRuntime(Runtime::kToFastProperties, 1);
1723 } 1747 }
1724 1748
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 Expression* value = property->value(); 2465 Expression* value = property->value();
2442 DCHECK(key != NULL); 2466 DCHECK(key != NULL);
2443 2467
2444 if (property->is_static()) { 2468 if (property->is_static()) {
2445 __ push(Operand(esp, kPointerSize)); // constructor 2469 __ push(Operand(esp, kPointerSize)); // constructor
2446 } else { 2470 } else {
2447 __ push(Operand(esp, 0)); // prototype 2471 __ push(Operand(esp, 0)); // prototype
2448 } 2472 }
2449 VisitForStackValue(key); 2473 VisitForStackValue(key);
2450 VisitForStackValue(value); 2474 VisitForStackValue(value);
2475 EmitSetHomeObjectIfNeeded(value, 2);
2451 2476
2452 switch (property->kind()) { 2477 switch (property->kind()) {
2453 case ObjectLiteral::Property::CONSTANT: 2478 case ObjectLiteral::Property::CONSTANT:
2454 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 2479 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2455 case ObjectLiteral::Property::COMPUTED: 2480 case ObjectLiteral::Property::COMPUTED:
2456 case ObjectLiteral::Property::PROTOTYPE: 2481 case ObjectLiteral::Property::PROTOTYPE:
2457 __ CallRuntime(Runtime::kDefineClassMethod, 3); 2482 __ CallRuntime(Runtime::kDefineClassMethod, 3);
2458 break; 2483 break;
2459 2484
2460 case ObjectLiteral::Property::GETTER: 2485 case ObjectLiteral::Property::GETTER:
(...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after
5218 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5243 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5219 Assembler::target_address_at(call_target_address, 5244 Assembler::target_address_at(call_target_address,
5220 unoptimized_code)); 5245 unoptimized_code));
5221 return OSR_AFTER_STACK_CHECK; 5246 return OSR_AFTER_STACK_CHECK;
5222 } 5247 }
5223 5248
5224 5249
5225 } } // namespace v8::internal 5250 } } // namespace v8::internal
5226 5251
5227 #endif // V8_TARGET_ARCH_IA32 5252 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698