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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 2471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2482 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2482 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2483 CallIC(code, expr->BinaryOperationFeedbackId()); | 2483 CallIC(code, expr->BinaryOperationFeedbackId()); |
2484 patch_site.EmitPatchInfo(); | 2484 patch_site.EmitPatchInfo(); |
2485 context()->Plug(v0); | 2485 context()->Plug(v0); |
2486 } | 2486 } |
2487 | 2487 |
2488 | 2488 |
2489 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2489 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
2490 DCHECK(expr->IsValidReferenceExpression()); | 2490 DCHECK(expr->IsValidReferenceExpression()); |
2491 | 2491 |
2492 // Left-hand side can only be a property, a global or a (parameter or local) | |
2493 // slot. | |
2494 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | |
2495 LhsKind assign_type = VARIABLE; | |
2496 Property* prop = expr->AsProperty(); | 2492 Property* prop = expr->AsProperty(); |
2497 if (prop != NULL) { | 2493 LhsKind assign_type = GetAssignType(prop); |
2498 assign_type = (prop->key()->IsPropertyName()) | |
2499 ? NAMED_PROPERTY | |
2500 : KEYED_PROPERTY; | |
2501 } | |
2502 | 2494 |
2503 switch (assign_type) { | 2495 switch (assign_type) { |
2504 case VARIABLE: { | 2496 case VARIABLE: { |
2505 Variable* var = expr->AsVariableProxy()->var(); | 2497 Variable* var = expr->AsVariableProxy()->var(); |
2506 EffectContext context(this); | 2498 EffectContext context(this); |
2507 EmitVariableAssignment(var, Token::ASSIGN); | 2499 EmitVariableAssignment(var, Token::ASSIGN); |
2508 break; | 2500 break; |
2509 } | 2501 } |
2510 case NAMED_PROPERTY: { | 2502 case NAMED_PROPERTY: { |
2511 __ push(result_register()); // Preserve value. | 2503 __ push(result_register()); // Preserve value. |
2512 VisitForAccumulatorValue(prop->obj()); | 2504 VisitForAccumulatorValue(prop->obj()); |
2513 __ mov(StoreDescriptor::ReceiverRegister(), result_register()); | 2505 __ mov(StoreDescriptor::ReceiverRegister(), result_register()); |
2514 __ pop(StoreDescriptor::ValueRegister()); // Restore value. | 2506 __ pop(StoreDescriptor::ValueRegister()); // Restore value. |
2515 __ li(StoreDescriptor::NameRegister(), | 2507 __ li(StoreDescriptor::NameRegister(), |
2516 Operand(prop->key()->AsLiteral()->value())); | 2508 Operand(prop->key()->AsLiteral()->value())); |
2517 CallStoreIC(); | 2509 CallStoreIC(); |
2518 break; | 2510 break; |
2519 } | 2511 } |
| 2512 case NAMED_SUPER_PROPERTY: { |
| 2513 __ Push(v0); |
| 2514 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
| 2515 EmitLoadHomeObject(prop->obj()->AsSuperReference()); |
| 2516 // stack: value, this; v0: home_object |
| 2517 Register scratch = a2; |
| 2518 Register scratch2 = a3; |
| 2519 __ mov(scratch, result_register()); // home_object |
| 2520 __ lw(v0, MemOperand(sp, kPointerSize)); // value |
| 2521 __ lw(scratch2, MemOperand(sp, 0)); // this |
| 2522 __ sw(scratch2, MemOperand(sp, kPointerSize)); // this |
| 2523 __ sw(scratch, MemOperand(sp, 0)); // home_object |
| 2524 // stack: this, home_object; v0: value |
| 2525 EmitNamedSuperPropertyStore(prop); |
| 2526 break; |
| 2527 } |
| 2528 case KEYED_SUPER_PROPERTY: { |
| 2529 __ Push(v0); |
| 2530 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
| 2531 EmitLoadHomeObject(prop->obj()->AsSuperReference()); |
| 2532 __ Push(result_register()); |
| 2533 VisitForAccumulatorValue(prop->key()); |
| 2534 Register scratch = a2; |
| 2535 Register scratch2 = a3; |
| 2536 __ lw(scratch2, MemOperand(sp, 2 * kPointerSize)); // value |
| 2537 // stack: value, this, home_object; v0: key, a3: value |
| 2538 __ lw(scratch, MemOperand(sp, kPointerSize)); // this |
| 2539 __ sw(scratch, MemOperand(sp, 2 * kPointerSize)); |
| 2540 __ lw(scratch, MemOperand(sp, 0)); // home_object |
| 2541 __ sw(scratch, MemOperand(sp, kPointerSize)); |
| 2542 __ sw(v0, MemOperand(sp, 0)); |
| 2543 __ Move(v0, scratch2); |
| 2544 // stack: this, home_object, key; v0: value. |
| 2545 EmitKeyedSuperPropertyStore(prop); |
| 2546 break; |
| 2547 } |
2520 case KEYED_PROPERTY: { | 2548 case KEYED_PROPERTY: { |
2521 __ push(result_register()); // Preserve value. | 2549 __ push(result_register()); // Preserve value. |
2522 VisitForStackValue(prop->obj()); | 2550 VisitForStackValue(prop->obj()); |
2523 VisitForAccumulatorValue(prop->key()); | 2551 VisitForAccumulatorValue(prop->key()); |
2524 __ Move(StoreDescriptor::NameRegister(), result_register()); | 2552 __ Move(StoreDescriptor::NameRegister(), result_register()); |
2525 __ Pop(StoreDescriptor::ValueRegister(), | 2553 __ Pop(StoreDescriptor::ValueRegister(), |
2526 StoreDescriptor::ReceiverRegister()); | 2554 StoreDescriptor::ReceiverRegister()); |
2527 Handle<Code> ic = | 2555 Handle<Code> ic = |
2528 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); | 2556 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); |
2529 CallIC(ic); | 2557 CallIC(ic); |
(...skipping 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5141 Assembler::target_address_at(pc_immediate_load_address)) == | 5169 Assembler::target_address_at(pc_immediate_load_address)) == |
5142 reinterpret_cast<uint64_t>( | 5170 reinterpret_cast<uint64_t>( |
5143 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5171 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5144 return OSR_AFTER_STACK_CHECK; | 5172 return OSR_AFTER_STACK_CHECK; |
5145 } | 5173 } |
5146 | 5174 |
5147 | 5175 |
5148 } } // namespace v8::internal | 5176 } } // namespace v8::internal |
5149 | 5177 |
5150 #endif // V8_TARGET_ARCH_MIPS64 | 5178 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |