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

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 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 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 (value->IsFunctionLiteral() &&
Dmitry Lomov (no reviews) 2014/11/11 19:27:48 Use NeedsHomeObject
arv (Not doing code reviews) 2014/11/11 19:51:29 Done.
1688 value->AsFunctionLiteral()->needs_super_binding()) {
1689 __ mov(StoreDescriptor::ReceiverRegister(), eax);
1690 __ mov(StoreDescriptor::NameRegister(),
1691 Immediate(isolate()->factory()->home_object_symbol()));
1692 __ mov(StoreDescriptor::ValueRegister(), Operand(esp, 0));
1693 CallStoreIC();
1694 }
1673 } else { 1695 } else {
1674 VisitForEffect(value); 1696 VisitForEffect(value);
1675 } 1697 }
1676 break; 1698 break;
1677 } 1699 }
1678 __ push(Operand(esp, 0)); // Duplicate receiver. 1700 __ push(Operand(esp, 0)); // Duplicate receiver.
1679 VisitForStackValue(key); 1701 VisitForStackValue(key);
1680 VisitForStackValue(value); 1702 VisitForStackValue(value);
1681 if (property->emit_store()) { 1703 if (property->emit_store()) {
1704 EmitSetHomeObjectIfNeeded(value, 2);
1682 __ push(Immediate(Smi::FromInt(SLOPPY))); // Strict mode 1705 __ push(Immediate(Smi::FromInt(SLOPPY))); // Strict mode
1683 __ CallRuntime(Runtime::kSetProperty, 4); 1706 __ CallRuntime(Runtime::kSetProperty, 4);
1684 } else { 1707 } else {
1685 __ Drop(3); 1708 __ Drop(3);
1686 } 1709 }
1687 break; 1710 break;
1688 case ObjectLiteral::Property::PROTOTYPE: 1711 case ObjectLiteral::Property::PROTOTYPE:
1689 __ push(Operand(esp, 0)); // Duplicate receiver. 1712 __ push(Operand(esp, 0)); // Duplicate receiver.
1690 VisitForStackValue(value); 1713 VisitForStackValue(value);
1691 if (property->emit_store()) { 1714 if (property->emit_store()) {
(...skipping 12 matching lines...) Expand all
1704 } 1727 }
1705 1728
1706 // Emit code to define accessors, using only a single call to the runtime for 1729 // Emit code to define accessors, using only a single call to the runtime for
1707 // each pair of corresponding getters and setters. 1730 // each pair of corresponding getters and setters.
1708 for (AccessorTable::Iterator it = accessor_table.begin(); 1731 for (AccessorTable::Iterator it = accessor_table.begin();
1709 it != accessor_table.end(); 1732 it != accessor_table.end();
1710 ++it) { 1733 ++it) {
1711 __ push(Operand(esp, 0)); // Duplicate receiver. 1734 __ push(Operand(esp, 0)); // Duplicate receiver.
1712 VisitForStackValue(it->first); 1735 VisitForStackValue(it->first);
1713 EmitAccessor(it->second->getter); 1736 EmitAccessor(it->second->getter);
1737 EmitSetHomeObjectIfNeeded(it->second->getter, 2);
1714 EmitAccessor(it->second->setter); 1738 EmitAccessor(it->second->setter);
1739 EmitSetHomeObjectIfNeeded(it->second->setter, 3);
1715 __ push(Immediate(Smi::FromInt(NONE))); 1740 __ push(Immediate(Smi::FromInt(NONE)));
1716 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); 1741 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
1717 } 1742 }
1718 1743
1719 if (expr->has_function()) { 1744 if (expr->has_function()) {
1720 DCHECK(result_saved); 1745 DCHECK(result_saved);
1721 __ push(Operand(esp, 0)); 1746 __ push(Operand(esp, 0));
1722 __ CallRuntime(Runtime::kToFastProperties, 1); 1747 __ CallRuntime(Runtime::kToFastProperties, 1);
1723 } 1748 }
1724 1749
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 Expression* value = property->value(); 2466 Expression* value = property->value();
2442 DCHECK(key != NULL); 2467 DCHECK(key != NULL);
2443 2468
2444 if (property->is_static()) { 2469 if (property->is_static()) {
2445 __ push(Operand(esp, kPointerSize)); // constructor 2470 __ push(Operand(esp, kPointerSize)); // constructor
2446 } else { 2471 } else {
2447 __ push(Operand(esp, 0)); // prototype 2472 __ push(Operand(esp, 0)); // prototype
2448 } 2473 }
2449 VisitForStackValue(key); 2474 VisitForStackValue(key);
2450 VisitForStackValue(value); 2475 VisitForStackValue(value);
2476 EmitSetHomeObjectIfNeeded(value, 2);
2451 2477
2452 switch (property->kind()) { 2478 switch (property->kind()) {
2453 case ObjectLiteral::Property::CONSTANT: 2479 case ObjectLiteral::Property::CONSTANT:
2454 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 2480 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2455 case ObjectLiteral::Property::COMPUTED: 2481 case ObjectLiteral::Property::COMPUTED:
2456 case ObjectLiteral::Property::PROTOTYPE: 2482 case ObjectLiteral::Property::PROTOTYPE:
2457 __ CallRuntime(Runtime::kDefineClassMethod, 3); 2483 __ CallRuntime(Runtime::kDefineClassMethod, 3);
2458 break; 2484 break;
2459 2485
2460 case ObjectLiteral::Property::GETTER: 2486 case ObjectLiteral::Property::GETTER:
(...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after
5218 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5244 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5219 Assembler::target_address_at(call_target_address, 5245 Assembler::target_address_at(call_target_address,
5220 unoptimized_code)); 5246 unoptimized_code));
5221 return OSR_AFTER_STACK_CHECK; 5247 return OSR_AFTER_STACK_CHECK;
5222 } 5248 }
5223 5249
5224 5250
5225 } } // namespace v8::internal 5251 } } // namespace v8::internal
5226 5252
5227 #endif // V8_TARGET_ARCH_IA32 5253 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698