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_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 switch (property->kind()) { | 1686 switch (property->kind()) { |
1687 case ObjectLiteral::Property::CONSTANT: | 1687 case ObjectLiteral::Property::CONSTANT: |
1688 UNREACHABLE(); | 1688 UNREACHABLE(); |
1689 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1689 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1690 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1690 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); |
1691 // Fall through. | 1691 // Fall through. |
1692 case ObjectLiteral::Property::COMPUTED: | 1692 case ObjectLiteral::Property::COMPUTED: |
1693 if (key->value()->IsInternalizedString()) { | 1693 if (key->value()->IsInternalizedString()) { |
1694 if (property->emit_store()) { | 1694 if (property->emit_store()) { |
1695 VisitForAccumulatorValue(value); | 1695 VisitForAccumulatorValue(value); |
1696 __ mov(r2, Operand(key->value())); | 1696 ASSERT(StoreIC::ValueRegister().is(r0)); |
1697 __ ldr(r1, MemOperand(sp)); | 1697 __ mov(StoreIC::NameRegister(), Operand(key->value())); |
| 1698 __ ldr(StoreIC::ReceiverRegister(), MemOperand(sp)); |
1698 CallStoreIC(key->LiteralFeedbackId()); | 1699 CallStoreIC(key->LiteralFeedbackId()); |
1699 PrepareForBailoutForId(key->id(), NO_REGISTERS); | 1700 PrepareForBailoutForId(key->id(), NO_REGISTERS); |
1700 } else { | 1701 } else { |
1701 VisitForEffect(value); | 1702 VisitForEffect(value); |
1702 } | 1703 } |
1703 break; | 1704 break; |
1704 } | 1705 } |
1705 // Duplicate receiver on stack. | 1706 // Duplicate receiver on stack. |
1706 __ ldr(r0, MemOperand(sp)); | 1707 __ ldr(r0, MemOperand(sp)); |
1707 __ push(r0); | 1708 __ push(r0); |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2413 switch (assign_type) { | 2414 switch (assign_type) { |
2414 case VARIABLE: { | 2415 case VARIABLE: { |
2415 Variable* var = expr->AsVariableProxy()->var(); | 2416 Variable* var = expr->AsVariableProxy()->var(); |
2416 EffectContext context(this); | 2417 EffectContext context(this); |
2417 EmitVariableAssignment(var, Token::ASSIGN); | 2418 EmitVariableAssignment(var, Token::ASSIGN); |
2418 break; | 2419 break; |
2419 } | 2420 } |
2420 case NAMED_PROPERTY: { | 2421 case NAMED_PROPERTY: { |
2421 __ push(r0); // Preserve value. | 2422 __ push(r0); // Preserve value. |
2422 VisitForAccumulatorValue(prop->obj()); | 2423 VisitForAccumulatorValue(prop->obj()); |
2423 __ mov(r1, r0); | 2424 __ Move(StoreIC::ReceiverRegister(), r0); |
2424 __ pop(r0); // Restore value. | 2425 __ pop(StoreIC::ValueRegister()); // Restore value. |
2425 __ mov(r2, Operand(prop->key()->AsLiteral()->value())); | 2426 __ mov(StoreIC::NameRegister(), |
| 2427 Operand(prop->key()->AsLiteral()->value())); |
2426 CallStoreIC(); | 2428 CallStoreIC(); |
2427 break; | 2429 break; |
2428 } | 2430 } |
2429 case KEYED_PROPERTY: { | 2431 case KEYED_PROPERTY: { |
2430 __ push(r0); // Preserve value. | 2432 __ push(r0); // Preserve value. |
2431 VisitForStackValue(prop->obj()); | 2433 VisitForStackValue(prop->obj()); |
2432 VisitForAccumulatorValue(prop->key()); | 2434 VisitForAccumulatorValue(prop->key()); |
2433 __ mov(r1, r0); | 2435 __ Move(KeyedStoreIC::NameRegister(), r0); |
2434 __ Pop(r0, r2); // r0 = restored value. | 2436 __ Pop(KeyedStoreIC::ValueRegister(), KeyedStoreIC::ReceiverRegister()); |
2435 Handle<Code> ic = strict_mode() == SLOPPY | 2437 Handle<Code> ic = strict_mode() == SLOPPY |
2436 ? isolate()->builtins()->KeyedStoreIC_Initialize() | 2438 ? isolate()->builtins()->KeyedStoreIC_Initialize() |
2437 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 2439 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
2438 CallIC(ic); | 2440 CallIC(ic); |
2439 break; | 2441 break; |
2440 } | 2442 } |
2441 } | 2443 } |
2442 context()->Plug(r0); | 2444 context()->Plug(r0); |
2443 } | 2445 } |
2444 | 2446 |
(...skipping 17 matching lines...) Expand all Loading... |
2462 __ mov(r1, Operand(name)); | 2464 __ mov(r1, Operand(name)); |
2463 __ mov(r0, Operand(Smi::FromInt(strict_mode))); | 2465 __ mov(r0, Operand(Smi::FromInt(strict_mode))); |
2464 __ Push(cp, r1, r0); // Context, name, strict mode. | 2466 __ Push(cp, r1, r0); // Context, name, strict mode. |
2465 __ CallRuntime(Runtime::kStoreContextSlot, 4); | 2467 __ CallRuntime(Runtime::kStoreContextSlot, 4); |
2466 } | 2468 } |
2467 | 2469 |
2468 | 2470 |
2469 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { | 2471 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { |
2470 if (var->IsUnallocated()) { | 2472 if (var->IsUnallocated()) { |
2471 // Global var, const, or let. | 2473 // Global var, const, or let. |
2472 __ mov(r2, Operand(var->name())); | 2474 __ mov(StoreIC::NameRegister(), Operand(var->name())); |
2473 __ ldr(r1, GlobalObjectOperand()); | 2475 __ ldr(StoreIC::ReceiverRegister(), GlobalObjectOperand()); |
2474 CallStoreIC(); | 2476 CallStoreIC(); |
2475 | 2477 |
2476 } else if (op == Token::INIT_CONST_LEGACY) { | 2478 } else if (op == Token::INIT_CONST_LEGACY) { |
2477 // Const initializers need a write barrier. | 2479 // Const initializers need a write barrier. |
2478 ASSERT(!var->IsParameter()); // No const parameters. | 2480 ASSERT(!var->IsParameter()); // No const parameters. |
2479 if (var->IsLookupSlot()) { | 2481 if (var->IsLookupSlot()) { |
2480 __ push(r0); | 2482 __ push(r0); |
2481 __ mov(r0, Operand(var->name())); | 2483 __ mov(r0, Operand(var->name())); |
2482 __ Push(cp, r0); // Context and name. | 2484 __ Push(cp, r0); // Context and name. |
2483 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); | 2485 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2533 | 2535 |
2534 | 2536 |
2535 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2537 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2536 // Assignment to a property, using a named store IC. | 2538 // Assignment to a property, using a named store IC. |
2537 Property* prop = expr->target()->AsProperty(); | 2539 Property* prop = expr->target()->AsProperty(); |
2538 ASSERT(prop != NULL); | 2540 ASSERT(prop != NULL); |
2539 ASSERT(prop->key()->IsLiteral()); | 2541 ASSERT(prop->key()->IsLiteral()); |
2540 | 2542 |
2541 // Record source code position before IC call. | 2543 // Record source code position before IC call. |
2542 SetSourcePosition(expr->position()); | 2544 SetSourcePosition(expr->position()); |
2543 __ mov(r2, Operand(prop->key()->AsLiteral()->value())); | 2545 __ mov(StoreIC::NameRegister(), Operand(prop->key()->AsLiteral()->value())); |
2544 __ pop(r1); | 2546 __ pop(StoreIC::ReceiverRegister()); |
2545 | |
2546 CallStoreIC(expr->AssignmentFeedbackId()); | 2547 CallStoreIC(expr->AssignmentFeedbackId()); |
2547 | 2548 |
2548 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2549 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
2549 context()->Plug(r0); | 2550 context()->Plug(r0); |
2550 } | 2551 } |
2551 | 2552 |
2552 | 2553 |
2553 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2554 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
2554 // Assignment to a property, using a keyed store IC. | 2555 // Assignment to a property, using a keyed store IC. |
2555 | 2556 |
2556 // Record source code position before IC call. | 2557 // Record source code position before IC call. |
2557 SetSourcePosition(expr->position()); | 2558 SetSourcePosition(expr->position()); |
2558 __ Pop(r2, r1); // r1 = key. | 2559 __ Pop(KeyedStoreIC::ReceiverRegister(), KeyedStoreIC::NameRegister()); |
| 2560 ASSERT(KeyedStoreIC::ValueRegister().is(r0)); |
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(r0); | 2568 context()->Plug(r0); |
2567 } | 2569 } |
2568 | 2570 |
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4347 context()->PlugTOS(); | 4349 context()->PlugTOS(); |
4348 } | 4350 } |
4349 } else { | 4351 } else { |
4350 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4352 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
4351 Token::ASSIGN); | 4353 Token::ASSIGN); |
4352 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4354 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
4353 context()->Plug(r0); | 4355 context()->Plug(r0); |
4354 } | 4356 } |
4355 break; | 4357 break; |
4356 case NAMED_PROPERTY: { | 4358 case NAMED_PROPERTY: { |
4357 __ mov(r2, Operand(prop->key()->AsLiteral()->value())); | 4359 __ mov(StoreIC::NameRegister(), |
4358 __ pop(r1); | 4360 Operand(prop->key()->AsLiteral()->value())); |
| 4361 __ pop(StoreIC::ReceiverRegister()); |
4359 CallStoreIC(expr->CountStoreFeedbackId()); | 4362 CallStoreIC(expr->CountStoreFeedbackId()); |
4360 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4363 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
4361 if (expr->is_postfix()) { | 4364 if (expr->is_postfix()) { |
4362 if (!context()->IsEffect()) { | 4365 if (!context()->IsEffect()) { |
4363 context()->PlugTOS(); | 4366 context()->PlugTOS(); |
4364 } | 4367 } |
4365 } else { | 4368 } else { |
4366 context()->Plug(r0); | 4369 context()->Plug(r0); |
4367 } | 4370 } |
4368 break; | 4371 break; |
4369 } | 4372 } |
4370 case KEYED_PROPERTY: { | 4373 case KEYED_PROPERTY: { |
4371 __ Pop(r2, r1); // r1 = key. r2 = receiver. | 4374 __ Pop(KeyedStoreIC::ReceiverRegister(), KeyedStoreIC::NameRegister()); |
4372 Handle<Code> ic = strict_mode() == SLOPPY | 4375 Handle<Code> ic = strict_mode() == SLOPPY |
4373 ? isolate()->builtins()->KeyedStoreIC_Initialize() | 4376 ? isolate()->builtins()->KeyedStoreIC_Initialize() |
4374 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 4377 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
4375 CallIC(ic, expr->CountStoreFeedbackId()); | 4378 CallIC(ic, expr->CountStoreFeedbackId()); |
4376 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4379 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
4377 if (expr->is_postfix()) { | 4380 if (expr->is_postfix()) { |
4378 if (!context()->IsEffect()) { | 4381 if (!context()->IsEffect()) { |
4379 context()->PlugTOS(); | 4382 context()->PlugTOS(); |
4380 } | 4383 } |
4381 } else { | 4384 } else { |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4859 | 4862 |
4860 ASSERT(interrupt_address == | 4863 ASSERT(interrupt_address == |
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_ARM | 4871 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |