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