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

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

Issue 639243003: Support for super assignments in for..in. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback 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
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('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_ARM 7 #if V8_TARGET_ARCH_ARM
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 2496 matching lines...) Expand 10 before | Expand all | Expand 10 after
2507 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2507 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2508 CallIC(code, expr->BinaryOperationFeedbackId()); 2508 CallIC(code, expr->BinaryOperationFeedbackId());
2509 patch_site.EmitPatchInfo(); 2509 patch_site.EmitPatchInfo();
2510 context()->Plug(r0); 2510 context()->Plug(r0);
2511 } 2511 }
2512 2512
2513 2513
2514 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2514 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2515 DCHECK(expr->IsValidReferenceExpression()); 2515 DCHECK(expr->IsValidReferenceExpression());
2516 2516
2517 // Left-hand side can only be a property, a global or a (parameter or local)
2518 // slot.
2519 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
2520 LhsKind assign_type = VARIABLE;
2521 Property* prop = expr->AsProperty(); 2517 Property* prop = expr->AsProperty();
2522 if (prop != NULL) { 2518 LhsKind assign_type = GetAssignType(prop);
2523 assign_type = (prop->key()->IsPropertyName())
2524 ? NAMED_PROPERTY
2525 : KEYED_PROPERTY;
2526 }
2527 2519
2528 switch (assign_type) { 2520 switch (assign_type) {
2529 case VARIABLE: { 2521 case VARIABLE: {
2530 Variable* var = expr->AsVariableProxy()->var(); 2522 Variable* var = expr->AsVariableProxy()->var();
2531 EffectContext context(this); 2523 EffectContext context(this);
2532 EmitVariableAssignment(var, Token::ASSIGN); 2524 EmitVariableAssignment(var, Token::ASSIGN);
2533 break; 2525 break;
2534 } 2526 }
2535 case NAMED_PROPERTY: { 2527 case NAMED_PROPERTY: {
2536 __ push(r0); // Preserve value. 2528 __ push(r0); // Preserve value.
2537 VisitForAccumulatorValue(prop->obj()); 2529 VisitForAccumulatorValue(prop->obj());
2538 __ Move(StoreDescriptor::ReceiverRegister(), r0); 2530 __ Move(StoreDescriptor::ReceiverRegister(), r0);
2539 __ pop(StoreDescriptor::ValueRegister()); // Restore value. 2531 __ pop(StoreDescriptor::ValueRegister()); // Restore value.
2540 __ mov(StoreDescriptor::NameRegister(), 2532 __ mov(StoreDescriptor::NameRegister(),
2541 Operand(prop->key()->AsLiteral()->value())); 2533 Operand(prop->key()->AsLiteral()->value()));
2542 CallStoreIC(); 2534 CallStoreIC();
2543 break; 2535 break;
2544 } 2536 }
2537 case NAMED_SUPER_PROPERTY: {
2538 __ Push(r0);
2539 VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
2540 EmitLoadHomeObject(prop->obj()->AsSuperReference());
2541 // stack: value, this; r0: home_object
2542 Register scratch = r2;
2543 Register scratch2 = r3;
2544 __ mov(scratch, result_register()); // home_object
2545 __ ldr(r0, MemOperand(sp, kPointerSize)); // value
2546 __ ldr(scratch2, MemOperand(sp, 0)); // this
2547 __ str(scratch2, MemOperand(sp, kPointerSize)); // this
2548 __ str(scratch, MemOperand(sp, 0)); // home_object
2549 // stack: this, home_object; r0: value
2550 EmitNamedSuperPropertyStore(prop);
2551 break;
2552 }
2553 case KEYED_SUPER_PROPERTY: {
2554 __ Push(r0);
2555 VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
2556 EmitLoadHomeObject(prop->obj()->AsSuperReference());
2557 __ Push(result_register());
2558 VisitForAccumulatorValue(prop->key());
2559 Register scratch = r2;
2560 Register scratch2 = r3;
2561 __ ldr(scratch2, MemOperand(sp, 2 * kPointerSize)); // value
2562 // stack: value, this, home_object; r0: key, r3: value
2563 __ ldr(scratch, MemOperand(sp, kPointerSize)); // this
2564 __ str(scratch, MemOperand(sp, 2 * kPointerSize));
2565 __ ldr(scratch, MemOperand(sp, 0)); // home_object
2566 __ str(scratch, MemOperand(sp, kPointerSize));
2567 __ str(r0, MemOperand(sp, 0));
2568 __ Move(r0, scratch2);
2569 // stack: this, home_object, key; r0: value.
2570 EmitKeyedSuperPropertyStore(prop);
2571 break;
2572 }
2545 case KEYED_PROPERTY: { 2573 case KEYED_PROPERTY: {
2546 __ push(r0); // Preserve value. 2574 __ push(r0); // Preserve value.
2547 VisitForStackValue(prop->obj()); 2575 VisitForStackValue(prop->obj());
2548 VisitForAccumulatorValue(prop->key()); 2576 VisitForAccumulatorValue(prop->key());
2549 __ Move(StoreDescriptor::NameRegister(), r0); 2577 __ Move(StoreDescriptor::NameRegister(), r0);
2550 __ Pop(StoreDescriptor::ValueRegister(), 2578 __ Pop(StoreDescriptor::ValueRegister(),
2551 StoreDescriptor::ReceiverRegister()); 2579 StoreDescriptor::ReceiverRegister());
2552 Handle<Code> ic = 2580 Handle<Code> ic =
2553 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); 2581 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
2554 CallIC(ic); 2582 CallIC(ic);
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after
5199 5227
5200 DCHECK(interrupt_address == 5228 DCHECK(interrupt_address ==
5201 isolate->builtins()->OsrAfterStackCheck()->entry()); 5229 isolate->builtins()->OsrAfterStackCheck()->entry());
5202 return OSR_AFTER_STACK_CHECK; 5230 return OSR_AFTER_STACK_CHECK;
5203 } 5231 }
5204 5232
5205 5233
5206 } } // namespace v8::internal 5234 } } // namespace v8::internal
5207 5235
5208 #endif // V8_TARGET_ARCH_ARM 5236 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698