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 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 switch (property->kind()) { | 1682 switch (property->kind()) { |
1683 case ObjectLiteral::Property::CONSTANT: | 1683 case ObjectLiteral::Property::CONSTANT: |
1684 UNREACHABLE(); | 1684 UNREACHABLE(); |
1685 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1685 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1686 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1686 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); |
1687 // Fall through. | 1687 // Fall through. |
1688 case ObjectLiteral::Property::COMPUTED: | 1688 case ObjectLiteral::Property::COMPUTED: |
1689 if (key->value()->IsInternalizedString()) { | 1689 if (key->value()->IsInternalizedString()) { |
1690 if (property->emit_store()) { | 1690 if (property->emit_store()) { |
1691 VisitForAccumulatorValue(value); | 1691 VisitForAccumulatorValue(value); |
1692 __ mov(a0, result_register()); | 1692 __ mov(StoreIC::ValueRegister(), result_register()); |
1693 __ li(a2, Operand(key->value())); | 1693 ASSERT(StoreIC::ValueRegister().is(a0)); |
1694 __ lw(a1, MemOperand(sp)); | 1694 __ li(StoreIC::NameRegister(), Operand(key->value())); |
| 1695 __ lw(StoreIC::ReceiverRegister(), MemOperand(sp)); |
1695 CallStoreIC(key->LiteralFeedbackId()); | 1696 CallStoreIC(key->LiteralFeedbackId()); |
1696 PrepareForBailoutForId(key->id(), NO_REGISTERS); | 1697 PrepareForBailoutForId(key->id(), NO_REGISTERS); |
1697 } else { | 1698 } else { |
1698 VisitForEffect(value); | 1699 VisitForEffect(value); |
1699 } | 1700 } |
1700 break; | 1701 break; |
1701 } | 1702 } |
1702 // Duplicate receiver on stack. | 1703 // Duplicate receiver on stack. |
1703 __ lw(a0, MemOperand(sp)); | 1704 __ lw(a0, MemOperand(sp)); |
1704 __ push(a0); | 1705 __ push(a0); |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2407 switch (assign_type) { | 2408 switch (assign_type) { |
2408 case VARIABLE: { | 2409 case VARIABLE: { |
2409 Variable* var = expr->AsVariableProxy()->var(); | 2410 Variable* var = expr->AsVariableProxy()->var(); |
2410 EffectContext context(this); | 2411 EffectContext context(this); |
2411 EmitVariableAssignment(var, Token::ASSIGN); | 2412 EmitVariableAssignment(var, Token::ASSIGN); |
2412 break; | 2413 break; |
2413 } | 2414 } |
2414 case NAMED_PROPERTY: { | 2415 case NAMED_PROPERTY: { |
2415 __ push(result_register()); // Preserve value. | 2416 __ push(result_register()); // Preserve value. |
2416 VisitForAccumulatorValue(prop->obj()); | 2417 VisitForAccumulatorValue(prop->obj()); |
2417 __ mov(a1, result_register()); | 2418 __ mov(StoreIC::ReceiverRegister(), result_register()); |
2418 __ pop(a0); // Restore value. | 2419 __ pop(StoreIC::ValueRegister()); // Restore value. |
2419 __ li(a2, Operand(prop->key()->AsLiteral()->value())); | 2420 __ li(StoreIC::NameRegister(), |
| 2421 Operand(prop->key()->AsLiteral()->value())); |
2420 CallStoreIC(); | 2422 CallStoreIC(); |
2421 break; | 2423 break; |
2422 } | 2424 } |
2423 case KEYED_PROPERTY: { | 2425 case KEYED_PROPERTY: { |
2424 __ push(result_register()); // Preserve value. | 2426 __ push(result_register()); // Preserve value. |
2425 VisitForStackValue(prop->obj()); | 2427 VisitForStackValue(prop->obj()); |
2426 VisitForAccumulatorValue(prop->key()); | 2428 VisitForAccumulatorValue(prop->key()); |
2427 __ mov(a1, result_register()); | 2429 __ mov(KeyedStoreIC::NameRegister(), result_register()); |
2428 __ Pop(a0, a2); // a0 = restored value. | 2430 __ Pop(KeyedStoreIC::ValueRegister(), KeyedStoreIC::ReceiverRegister()); |
2429 Handle<Code> ic = strict_mode() == SLOPPY | 2431 Handle<Code> ic = strict_mode() == SLOPPY |
2430 ? isolate()->builtins()->KeyedStoreIC_Initialize() | 2432 ? isolate()->builtins()->KeyedStoreIC_Initialize() |
2431 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 2433 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
2432 CallIC(ic); | 2434 CallIC(ic); |
2433 break; | 2435 break; |
2434 } | 2436 } |
2435 } | 2437 } |
2436 context()->Plug(v0); | 2438 context()->Plug(v0); |
2437 } | 2439 } |
2438 | 2440 |
(...skipping 16 matching lines...) Expand all Loading... |
2455 __ li(a1, Operand(name)); | 2457 __ li(a1, Operand(name)); |
2456 __ li(a0, Operand(Smi::FromInt(strict_mode))); | 2458 __ li(a0, Operand(Smi::FromInt(strict_mode))); |
2457 __ Push(v0, cp, a1, a0); // Value, context, name, strict mode. | 2459 __ Push(v0, cp, a1, a0); // Value, context, name, strict mode. |
2458 __ CallRuntime(Runtime::kStoreContextSlot, 4); | 2460 __ CallRuntime(Runtime::kStoreContextSlot, 4); |
2459 } | 2461 } |
2460 | 2462 |
2461 | 2463 |
2462 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { | 2464 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { |
2463 if (var->IsUnallocated()) { | 2465 if (var->IsUnallocated()) { |
2464 // Global var, const, or let. | 2466 // Global var, const, or let. |
2465 __ mov(a0, result_register()); | 2467 __ mov(StoreIC::ValueRegister(), result_register()); |
2466 __ li(a2, Operand(var->name())); | 2468 __ li(StoreIC::NameRegister(), Operand(var->name())); |
2467 __ lw(a1, GlobalObjectOperand()); | 2469 __ lw(StoreIC::ReceiverRegister(), GlobalObjectOperand()); |
2468 CallStoreIC(); | 2470 CallStoreIC(); |
2469 | 2471 |
2470 } else if (op == Token::INIT_CONST_LEGACY) { | 2472 } else if (op == Token::INIT_CONST_LEGACY) { |
2471 // Const initializers need a write barrier. | 2473 // Const initializers need a write barrier. |
2472 ASSERT(!var->IsParameter()); // No const parameters. | 2474 ASSERT(!var->IsParameter()); // No const parameters. |
2473 if (var->IsLookupSlot()) { | 2475 if (var->IsLookupSlot()) { |
2474 __ li(a0, Operand(var->name())); | 2476 __ li(a0, Operand(var->name())); |
2475 __ Push(v0, cp, a0); // Context and name. | 2477 __ Push(v0, cp, a0); // Context and name. |
2476 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); | 2478 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); |
2477 } else { | 2479 } else { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2526 | 2528 |
2527 | 2529 |
2528 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2530 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2529 // Assignment to a property, using a named store IC. | 2531 // Assignment to a property, using a named store IC. |
2530 Property* prop = expr->target()->AsProperty(); | 2532 Property* prop = expr->target()->AsProperty(); |
2531 ASSERT(prop != NULL); | 2533 ASSERT(prop != NULL); |
2532 ASSERT(prop->key()->IsLiteral()); | 2534 ASSERT(prop->key()->IsLiteral()); |
2533 | 2535 |
2534 // Record source code position before IC call. | 2536 // Record source code position before IC call. |
2535 SetSourcePosition(expr->position()); | 2537 SetSourcePosition(expr->position()); |
2536 __ mov(a0, result_register()); // Load the value. | 2538 __ mov(StoreIC::ValueRegister(), result_register()); |
2537 __ li(a2, Operand(prop->key()->AsLiteral()->value())); | 2539 __ li(StoreIC::NameRegister(), Operand(prop->key()->AsLiteral()->value())); |
2538 __ pop(a1); | 2540 __ pop(StoreIC::ReceiverRegister()); |
2539 | |
2540 CallStoreIC(expr->AssignmentFeedbackId()); | 2541 CallStoreIC(expr->AssignmentFeedbackId()); |
2541 | 2542 |
2542 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2543 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
2543 context()->Plug(v0); | 2544 context()->Plug(v0); |
2544 } | 2545 } |
2545 | 2546 |
2546 | 2547 |
2547 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2548 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
2548 // Assignment to a property, using a keyed store IC. | 2549 // Assignment to a property, using a keyed store IC. |
2549 | 2550 |
2550 // Record source code position before IC call. | 2551 // Record source code position before IC call. |
2551 SetSourcePosition(expr->position()); | 2552 SetSourcePosition(expr->position()); |
2552 // Call keyed store IC. | 2553 // Call keyed store IC. |
2553 // The arguments are: | 2554 // The arguments are: |
2554 // - a0 is the value, | 2555 // - a0 is the value, |
2555 // - a1 is the key, | 2556 // - a1 is the key, |
2556 // - a2 is the receiver. | 2557 // - a2 is the receiver. |
2557 __ mov(a0, result_register()); | 2558 __ mov(KeyedStoreIC::ValueRegister(), result_register()); |
2558 __ Pop(a2, a1); // a1 = key. | 2559 __ Pop(KeyedStoreIC::ReceiverRegister(), KeyedStoreIC::NameRegister()); |
| 2560 ASSERT(KeyedStoreIC::ValueRegister().is(a0)); |
2559 | 2561 |
2560 Handle<Code> ic = strict_mode() == SLOPPY | 2562 Handle<Code> ic = strict_mode() == SLOPPY |
2561 ? isolate()->builtins()->KeyedStoreIC_Initialize() | 2563 ? isolate()->builtins()->KeyedStoreIC_Initialize() |
2562 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 2564 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
2563 CallIC(ic, expr->AssignmentFeedbackId()); | 2565 CallIC(ic, expr->AssignmentFeedbackId()); |
2564 | 2566 |
2565 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2567 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
2566 context()->Plug(v0); | 2568 context()->Plug(v0); |
2567 } | 2569 } |
2568 | 2570 |
(...skipping 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4380 context()->PlugTOS(); | 4382 context()->PlugTOS(); |
4381 } | 4383 } |
4382 } else { | 4384 } else { |
4383 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4385 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
4384 Token::ASSIGN); | 4386 Token::ASSIGN); |
4385 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4387 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
4386 context()->Plug(v0); | 4388 context()->Plug(v0); |
4387 } | 4389 } |
4388 break; | 4390 break; |
4389 case NAMED_PROPERTY: { | 4391 case NAMED_PROPERTY: { |
4390 __ mov(a0, result_register()); // Value. | 4392 __ mov(StoreIC::ValueRegister(), result_register()); |
4391 __ li(a2, Operand(prop->key()->AsLiteral()->value())); // Name. | 4393 __ li(StoreIC::NameRegister(), |
4392 __ pop(a1); // Receiver. | 4394 Operand(prop->key()->AsLiteral()->value())); |
| 4395 __ pop(StoreIC::ReceiverRegister()); |
4393 CallStoreIC(expr->CountStoreFeedbackId()); | 4396 CallStoreIC(expr->CountStoreFeedbackId()); |
4394 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4397 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
4395 if (expr->is_postfix()) { | 4398 if (expr->is_postfix()) { |
4396 if (!context()->IsEffect()) { | 4399 if (!context()->IsEffect()) { |
4397 context()->PlugTOS(); | 4400 context()->PlugTOS(); |
4398 } | 4401 } |
4399 } else { | 4402 } else { |
4400 context()->Plug(v0); | 4403 context()->Plug(v0); |
4401 } | 4404 } |
4402 break; | 4405 break; |
4403 } | 4406 } |
4404 case KEYED_PROPERTY: { | 4407 case KEYED_PROPERTY: { |
4405 __ mov(a0, result_register()); // Value. | 4408 __ mov(KeyedStoreIC::ValueRegister(), result_register()); |
4406 __ Pop(a2, a1); // a1 = key, a2 = receiver. | 4409 __ Pop(KeyedStoreIC::ReceiverRegister(), KeyedStoreIC::NameRegister()); |
4407 Handle<Code> ic = strict_mode() == SLOPPY | 4410 Handle<Code> ic = strict_mode() == SLOPPY |
4408 ? isolate()->builtins()->KeyedStoreIC_Initialize() | 4411 ? isolate()->builtins()->KeyedStoreIC_Initialize() |
4409 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 4412 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
4410 CallIC(ic, expr->CountStoreFeedbackId()); | 4413 CallIC(ic, expr->CountStoreFeedbackId()); |
4411 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4414 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
4412 if (expr->is_postfix()) { | 4415 if (expr->is_postfix()) { |
4413 if (!context()->IsEffect()) { | 4416 if (!context()->IsEffect()) { |
4414 context()->PlugTOS(); | 4417 context()->PlugTOS(); |
4415 } | 4418 } |
4416 } else { | 4419 } else { |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4859 Assembler::target_address_at(pc_immediate_load_address)) == | 4862 Assembler::target_address_at(pc_immediate_load_address)) == |
4860 reinterpret_cast<uint32_t>( | 4863 reinterpret_cast<uint32_t>( |
4861 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4864 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4862 return OSR_AFTER_STACK_CHECK; | 4865 return OSR_AFTER_STACK_CHECK; |
4863 } | 4866 } |
4864 | 4867 |
4865 | 4868 |
4866 } } // namespace v8::internal | 4869 } } // namespace v8::internal |
4867 | 4870 |
4868 #endif // V8_TARGET_ARCH_MIPS | 4871 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |