OLD | NEW |
---|---|
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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2422 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2422 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2423 CallIC(code, expr->BinaryOperationFeedbackId()); | 2423 CallIC(code, expr->BinaryOperationFeedbackId()); |
2424 patch_site.EmitPatchInfo(); | 2424 patch_site.EmitPatchInfo(); |
2425 context()->Plug(rax); | 2425 context()->Plug(rax); |
2426 } | 2426 } |
2427 | 2427 |
2428 | 2428 |
2429 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2429 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
2430 DCHECK(expr->IsValidReferenceExpression()); | 2430 DCHECK(expr->IsValidReferenceExpression()); |
2431 | 2431 |
2432 // Left-hand side can only be a property, a global or a (parameter or local) | |
2433 // slot. | |
2434 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | |
2435 LhsKind assign_type = VARIABLE; | |
2436 Property* prop = expr->AsProperty(); | 2432 Property* prop = expr->AsProperty(); |
2437 if (prop != NULL) { | 2433 LhsKind assign_type = GetAssignType(prop); |
2438 assign_type = (prop->key()->IsPropertyName()) | |
2439 ? NAMED_PROPERTY | |
2440 : KEYED_PROPERTY; | |
2441 } | |
2442 | 2434 |
2443 switch (assign_type) { | 2435 switch (assign_type) { |
2444 case VARIABLE: { | 2436 case VARIABLE: { |
2445 Variable* var = expr->AsVariableProxy()->var(); | 2437 Variable* var = expr->AsVariableProxy()->var(); |
2446 EffectContext context(this); | 2438 EffectContext context(this); |
2447 EmitVariableAssignment(var, Token::ASSIGN); | 2439 EmitVariableAssignment(var, Token::ASSIGN); |
2448 break; | 2440 break; |
2449 } | 2441 } |
2450 case NAMED_PROPERTY: { | 2442 case NAMED_PROPERTY: { |
2451 __ Push(rax); // Preserve value. | 2443 __ Push(rax); // Preserve value. |
2452 VisitForAccumulatorValue(prop->obj()); | 2444 VisitForAccumulatorValue(prop->obj()); |
2453 __ Move(StoreDescriptor::ReceiverRegister(), rax); | 2445 __ Move(StoreDescriptor::ReceiverRegister(), rax); |
2454 __ Pop(StoreDescriptor::ValueRegister()); // Restore value. | 2446 __ Pop(StoreDescriptor::ValueRegister()); // Restore value. |
2455 __ Move(StoreDescriptor::NameRegister(), | 2447 __ Move(StoreDescriptor::NameRegister(), |
2456 prop->key()->AsLiteral()->value()); | 2448 prop->key()->AsLiteral()->value()); |
2457 CallStoreIC(); | 2449 CallStoreIC(); |
2458 break; | 2450 break; |
2459 } | 2451 } |
2452 case NAMED_SUPER_PROPERTY: { | |
2453 __ Push(rax); | |
2454 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | |
2455 EmitLoadHomeObject(prop->obj()->AsSuperReference()); | |
2456 // stack: value, this; rax: home_object | |
2457 Register scratch = rcx; | |
2458 Register scratch2 = rdx; | |
2459 __ Move(scratch, result_register()); // home_object | |
2460 __ movp(scratch2, MemOperand(rsp, kPointerSize)); // value | |
Igor Sheludko
2014/10/13 11:39:07
And here.
Dmitry Lomov (no reviews)
2014/10/13 12:39:51
Done.
| |
2461 __ movp(rax, MemOperand(rsp, 0)); // this | |
2462 __ movp(MemOperand(rsp, kPointerSize), rax); // this | |
2463 __ movp(MemOperand(rsp, 0), scratch); // home_object | |
2464 __ Move(rax, scratch2); | |
2465 // stack: this, home_object; rax: value | |
2466 EmitNamedSuperPropertyStore(prop); | |
2467 break; | |
2468 } | |
2469 case KEYED_SUPER_PROPERTY: { | |
2470 __ Push(rax); | |
2471 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | |
2472 EmitLoadHomeObject(prop->obj()->AsSuperReference()); | |
2473 __ Push(result_register()); | |
2474 VisitForAccumulatorValue(prop->key()); | |
2475 Register scratch = rcx; | |
2476 Register scratch2 = rdx; | |
2477 __ movp(scratch2, MemOperand(rsp, 2 * kPointerSize)); // value | |
2478 // stack: value, this, home_object; rax: key, rdx: value | |
2479 __ movp(scratch, MemOperand(rsp, kPointerSize)); // this | |
2480 __ movp(MemOperand(rsp, 2 * kPointerSize), scratch); | |
2481 __ movp(scratch, MemOperand(rsp, 0)); // home_object | |
2482 __ movp(MemOperand(rsp, kPointerSize), scratch); | |
2483 __ movp(MemOperand(rsp, 0), rax); | |
2484 __ Move(rax, scratch2); | |
2485 // stack: this, home_object, key; rax: value. | |
2486 EmitKeyedSuperPropertyStore(prop); | |
2487 break; | |
2488 } | |
2460 case KEYED_PROPERTY: { | 2489 case KEYED_PROPERTY: { |
2461 __ Push(rax); // Preserve value. | 2490 __ Push(rax); // Preserve value. |
2462 VisitForStackValue(prop->obj()); | 2491 VisitForStackValue(prop->obj()); |
2463 VisitForAccumulatorValue(prop->key()); | 2492 VisitForAccumulatorValue(prop->key()); |
2464 __ Move(StoreDescriptor::NameRegister(), rax); | 2493 __ Move(StoreDescriptor::NameRegister(), rax); |
2465 __ Pop(StoreDescriptor::ReceiverRegister()); | 2494 __ Pop(StoreDescriptor::ReceiverRegister()); |
2466 __ Pop(StoreDescriptor::ValueRegister()); // Restore value. | 2495 __ Pop(StoreDescriptor::ValueRegister()); // Restore value. |
2467 Handle<Code> ic = | 2496 Handle<Code> ic = |
2468 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); | 2497 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); |
2469 CallIC(ic); | 2498 CallIC(ic); |
(...skipping 2627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5097 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5126 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5098 Assembler::target_address_at(call_target_address, | 5127 Assembler::target_address_at(call_target_address, |
5099 unoptimized_code)); | 5128 unoptimized_code)); |
5100 return OSR_AFTER_STACK_CHECK; | 5129 return OSR_AFTER_STACK_CHECK; |
5101 } | 5130 } |
5102 | 5131 |
5103 | 5132 |
5104 } } // namespace v8::internal | 5133 } } // namespace v8::internal |
5105 | 5134 |
5106 #endif // V8_TARGET_ARCH_X64 | 5135 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |