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

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

Issue 639243003: Support for super assignments in for..in. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: stray edit in ia32 removed Created 6 years, 2 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
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 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2423 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2423 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2424 CallIC(code, expr->BinaryOperationFeedbackId()); 2424 CallIC(code, expr->BinaryOperationFeedbackId());
2425 patch_site.EmitPatchInfo(); 2425 patch_site.EmitPatchInfo();
2426 context()->Plug(eax); 2426 context()->Plug(eax);
2427 } 2427 }
2428 2428
2429 2429
2430 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2430 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2431 DCHECK(expr->IsValidReferenceExpression()); 2431 DCHECK(expr->IsValidReferenceExpression());
2432 2432
2433 // Left-hand side can only be a property, a global or a (parameter or local)
2434 // slot.
2435 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
2436 LhsKind assign_type = VARIABLE;
2437 Property* prop = expr->AsProperty(); 2433 Property* prop = expr->AsProperty();
2438 if (prop != NULL) { 2434 LhsKind assign_type = GetAssignType(prop);
2439 assign_type = (prop->key()->IsPropertyName())
2440 ? NAMED_PROPERTY
2441 : KEYED_PROPERTY;
2442 }
2443 2435
2444 switch (assign_type) { 2436 switch (assign_type) {
2445 case VARIABLE: { 2437 case VARIABLE: {
2446 Variable* var = expr->AsVariableProxy()->var(); 2438 Variable* var = expr->AsVariableProxy()->var();
2447 EffectContext context(this); 2439 EffectContext context(this);
2448 EmitVariableAssignment(var, Token::ASSIGN); 2440 EmitVariableAssignment(var, Token::ASSIGN);
2449 break; 2441 break;
2450 } 2442 }
2451 case NAMED_PROPERTY: { 2443 case NAMED_PROPERTY: {
2452 __ push(eax); // Preserve value. 2444 __ push(eax); // Preserve value.
2453 VisitForAccumulatorValue(prop->obj()); 2445 VisitForAccumulatorValue(prop->obj());
2454 __ Move(StoreDescriptor::ReceiverRegister(), eax); 2446 __ Move(StoreDescriptor::ReceiverRegister(), eax);
2455 __ pop(StoreDescriptor::ValueRegister()); // Restore value. 2447 __ pop(StoreDescriptor::ValueRegister()); // Restore value.
2456 __ mov(StoreDescriptor::NameRegister(), 2448 __ mov(StoreDescriptor::NameRegister(),
2457 prop->key()->AsLiteral()->value()); 2449 prop->key()->AsLiteral()->value());
2458 CallStoreIC(); 2450 CallStoreIC();
2459 break; 2451 break;
2460 } 2452 }
2453 case NAMED_SUPER_PROPERTY: {
2454 __ push(eax);
2455 VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
2456 EmitLoadHomeObject(prop->obj()->AsSuperReference());
2457 // stack: value, this; eax: home_object
2458 Register scratch = ecx;
2459 Register scratch2 = edx;
2460 __ mov(scratch, result_register()); // home_object
2461 __ mov(scratch2, MemOperand(esp, kPointerSize)); // value
Igor Sheludko 2014/10/13 11:39:07 Same note here.
Dmitry Lomov (no reviews) 2014/10/13 12:39:51 Done.
2462 __ mov(eax, MemOperand(esp, 0)); // this
2463 __ mov(MemOperand(esp, kPointerSize), eax); // this
2464 __ mov(MemOperand(esp, 0), scratch); // home_object
2465 __ mov(eax, scratch2);
2466 // stack: this, home_object. eax: value
2467 EmitNamedSuperPropertyStore(prop);
2468 break;
2469 }
2470 case KEYED_SUPER_PROPERTY: {
2471 __ push(eax);
2472 VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
2473 EmitLoadHomeObject(prop->obj()->AsSuperReference());
2474 __ push(result_register());
2475 VisitForAccumulatorValue(prop->key());
2476 Register scratch = ecx;
2477 Register scratch2 = edx;
2478 __ mov(scratch2, MemOperand(esp, 2 * kPointerSize)); // value
2479 // stack: value, this, home_object; eax: key, edx: value
2480 __ mov(scratch, MemOperand(esp, kPointerSize)); // this
2481 __ mov(MemOperand(esp, 2 * kPointerSize), scratch);
2482 __ mov(scratch, MemOperand(esp, 0)); // home_object
2483 __ mov(MemOperand(esp, kPointerSize), scratch);
2484 __ mov(MemOperand(esp, 0), eax);
2485 __ mov(eax, scratch2);
2486 // stack: this, home_object, key; eax: value.
2487 EmitKeyedSuperPropertyStore(prop);
2488 break;
2489 }
2461 case KEYED_PROPERTY: { 2490 case KEYED_PROPERTY: {
2462 __ push(eax); // Preserve value. 2491 __ push(eax); // Preserve value.
2463 VisitForStackValue(prop->obj()); 2492 VisitForStackValue(prop->obj());
2464 VisitForAccumulatorValue(prop->key()); 2493 VisitForAccumulatorValue(prop->key());
2465 __ Move(StoreDescriptor::NameRegister(), eax); 2494 __ Move(StoreDescriptor::NameRegister(), eax);
2466 __ pop(StoreDescriptor::ReceiverRegister()); // Receiver. 2495 __ pop(StoreDescriptor::ReceiverRegister()); // Receiver.
2467 __ pop(StoreDescriptor::ValueRegister()); // Restore value. 2496 __ pop(StoreDescriptor::ValueRegister()); // Restore value.
2468 Handle<Code> ic = 2497 Handle<Code> ic =
2469 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); 2498 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
2470 CallIC(ic); 2499 CallIC(ic);
(...skipping 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after
5082 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5111 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5083 Assembler::target_address_at(call_target_address, 5112 Assembler::target_address_at(call_target_address,
5084 unoptimized_code)); 5113 unoptimized_code));
5085 return OSR_AFTER_STACK_CHECK; 5114 return OSR_AFTER_STACK_CHECK;
5086 } 5115 }
5087 5116
5088 5117
5089 } } // namespace v8::internal 5118 } } // namespace v8::internal
5090 5119
5091 #endif // V8_TARGET_ARCH_IA32 5120 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698