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

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

Issue 653823002: X87: Support for super assignments in for..in. (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@bleeding_edge
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | 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_X87 7 #if V8_TARGET_ARCH_X87
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 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2410 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2411 CallIC(code, expr->BinaryOperationFeedbackId()); 2411 CallIC(code, expr->BinaryOperationFeedbackId());
2412 patch_site.EmitPatchInfo(); 2412 patch_site.EmitPatchInfo();
2413 context()->Plug(eax); 2413 context()->Plug(eax);
2414 } 2414 }
2415 2415
2416 2416
2417 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2417 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2418 DCHECK(expr->IsValidReferenceExpression()); 2418 DCHECK(expr->IsValidReferenceExpression());
2419 2419
2420 // Left-hand side can only be a property, a global or a (parameter or local)
2421 // slot.
2422 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
2423 LhsKind assign_type = VARIABLE;
2424 Property* prop = expr->AsProperty(); 2420 Property* prop = expr->AsProperty();
2425 if (prop != NULL) { 2421 LhsKind assign_type = GetAssignType(prop);
2426 assign_type = (prop->key()->IsPropertyName())
2427 ? NAMED_PROPERTY
2428 : KEYED_PROPERTY;
2429 }
2430 2422
2431 switch (assign_type) { 2423 switch (assign_type) {
2432 case VARIABLE: { 2424 case VARIABLE: {
2433 Variable* var = expr->AsVariableProxy()->var(); 2425 Variable* var = expr->AsVariableProxy()->var();
2434 EffectContext context(this); 2426 EffectContext context(this);
2435 EmitVariableAssignment(var, Token::ASSIGN); 2427 EmitVariableAssignment(var, Token::ASSIGN);
2436 break; 2428 break;
2437 } 2429 }
2438 case NAMED_PROPERTY: { 2430 case NAMED_PROPERTY: {
2439 __ push(eax); // Preserve value. 2431 __ push(eax); // Preserve value.
2440 VisitForAccumulatorValue(prop->obj()); 2432 VisitForAccumulatorValue(prop->obj());
2441 __ Move(StoreDescriptor::ReceiverRegister(), eax); 2433 __ Move(StoreDescriptor::ReceiverRegister(), eax);
2442 __ pop(StoreDescriptor::ValueRegister()); // Restore value. 2434 __ pop(StoreDescriptor::ValueRegister()); // Restore value.
2443 __ mov(StoreDescriptor::NameRegister(), 2435 __ mov(StoreDescriptor::NameRegister(),
2444 prop->key()->AsLiteral()->value()); 2436 prop->key()->AsLiteral()->value());
2445 CallStoreIC(); 2437 CallStoreIC();
2446 break; 2438 break;
2447 } 2439 }
2440 case NAMED_SUPER_PROPERTY: {
2441 __ push(eax);
2442 VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
2443 EmitLoadHomeObject(prop->obj()->AsSuperReference());
2444 // stack: value, this; eax: home_object
2445 Register scratch = ecx;
2446 Register scratch2 = edx;
2447 __ mov(scratch, result_register()); // home_object
2448 __ mov(eax, MemOperand(esp, kPointerSize)); // value
2449 __ mov(scratch2, MemOperand(esp, 0)); // this
2450 __ mov(MemOperand(esp, kPointerSize), scratch2); // this
2451 __ mov(MemOperand(esp, 0), scratch); // home_object
2452 // stack: this, home_object. eax: value
2453 EmitNamedSuperPropertyStore(prop);
2454 break;
2455 }
2456 case KEYED_SUPER_PROPERTY: {
2457 __ push(eax);
2458 VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
2459 EmitLoadHomeObject(prop->obj()->AsSuperReference());
2460 __ push(result_register());
2461 VisitForAccumulatorValue(prop->key());
2462 Register scratch = ecx;
2463 Register scratch2 = edx;
2464 __ mov(scratch2, MemOperand(esp, 2 * kPointerSize)); // value
2465 // stack: value, this, home_object; eax: key, edx: value
2466 __ mov(scratch, MemOperand(esp, kPointerSize)); // this
2467 __ mov(MemOperand(esp, 2 * kPointerSize), scratch);
2468 __ mov(scratch, MemOperand(esp, 0)); // home_object
2469 __ mov(MemOperand(esp, kPointerSize), scratch);
2470 __ mov(MemOperand(esp, 0), eax);
2471 __ mov(eax, scratch2);
2472 // stack: this, home_object, key; eax: value.
2473 EmitKeyedSuperPropertyStore(prop);
2474 break;
2475 }
2448 case KEYED_PROPERTY: { 2476 case KEYED_PROPERTY: {
2449 __ push(eax); // Preserve value. 2477 __ push(eax); // Preserve value.
2450 VisitForStackValue(prop->obj()); 2478 VisitForStackValue(prop->obj());
2451 VisitForAccumulatorValue(prop->key()); 2479 VisitForAccumulatorValue(prop->key());
2452 __ Move(StoreDescriptor::NameRegister(), eax); 2480 __ Move(StoreDescriptor::NameRegister(), eax);
2453 __ pop(StoreDescriptor::ReceiverRegister()); // Receiver. 2481 __ pop(StoreDescriptor::ReceiverRegister()); // Receiver.
2454 __ pop(StoreDescriptor::ValueRegister()); // Restore value. 2482 __ pop(StoreDescriptor::ValueRegister()); // Restore value.
2455 Handle<Code> ic = 2483 Handle<Code> ic =
2456 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); 2484 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
2457 CallIC(ic); 2485 CallIC(ic);
(...skipping 2610 matching lines...) Expand 10 before | Expand all | Expand 10 after
5068 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5096 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5069 Assembler::target_address_at(call_target_address, 5097 Assembler::target_address_at(call_target_address,
5070 unoptimized_code)); 5098 unoptimized_code));
5071 return OSR_AFTER_STACK_CHECK; 5099 return OSR_AFTER_STACK_CHECK;
5072 } 5100 }
5073 5101
5074 5102
5075 } } // namespace v8::internal 5103 } } // namespace v8::internal
5076 5104
5077 #endif // V8_TARGET_ARCH_X87 5105 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698