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 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 3427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3438 // code. Fetch it from the context. | 3438 // code. Fetch it from the context. |
3439 __ ldr(ip, ContextMemOperand(cp, Context::CLOSURE_INDEX)); | 3439 __ ldr(ip, ContextMemOperand(cp, Context::CLOSURE_INDEX)); |
3440 } else { | 3440 } else { |
3441 DCHECK(closure_scope->is_function_scope()); | 3441 DCHECK(closure_scope->is_function_scope()); |
3442 __ ldr(ip, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 3442 __ ldr(ip, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
3443 } | 3443 } |
3444 PushOperand(ip); | 3444 PushOperand(ip); |
3445 } | 3445 } |
3446 | 3446 |
3447 | 3447 |
3448 // ---------------------------------------------------------------------------- | |
3449 // Non-local control flow support. | |
3450 | |
3451 void FullCodeGenerator::EnterFinallyBlock() { | |
3452 DCHECK(!result_register().is(r1)); | |
3453 // Store pending message while executing finally block. | |
3454 ExternalReference pending_message_obj = | |
3455 ExternalReference::address_of_pending_message_obj(isolate()); | |
3456 __ mov(ip, Operand(pending_message_obj)); | |
3457 __ ldr(r1, MemOperand(ip)); | |
3458 PushOperand(r1); | |
3459 | |
3460 ClearPendingMessage(); | |
3461 } | |
3462 | |
3463 | |
3464 void FullCodeGenerator::ExitFinallyBlock() { | |
3465 DCHECK(!result_register().is(r1)); | |
3466 // Restore pending message from stack. | |
3467 PopOperand(r1); | |
3468 ExternalReference pending_message_obj = | |
3469 ExternalReference::address_of_pending_message_obj(isolate()); | |
3470 __ mov(ip, Operand(pending_message_obj)); | |
3471 __ str(r1, MemOperand(ip)); | |
3472 } | |
3473 | |
3474 | |
3475 void FullCodeGenerator::ClearPendingMessage() { | |
3476 DCHECK(!result_register().is(r1)); | |
3477 ExternalReference pending_message_obj = | |
3478 ExternalReference::address_of_pending_message_obj(isolate()); | |
3479 __ LoadRoot(r1, Heap::kTheHoleValueRootIndex); | |
3480 __ mov(ip, Operand(pending_message_obj)); | |
3481 __ str(r1, MemOperand(ip)); | |
3482 } | |
3483 | |
3484 | |
3485 void FullCodeGenerator::DeferredCommands::EmitCommands() { | |
3486 DCHECK(!result_register().is(r1)); | |
3487 __ Pop(result_register()); // Restore the accumulator. | |
3488 __ Pop(r1); // Get the token. | |
3489 for (DeferredCommand cmd : commands_) { | |
3490 Label skip; | |
3491 __ cmp(r1, Operand(Smi::FromInt(cmd.token))); | |
3492 __ b(ne, &skip); | |
3493 switch (cmd.command) { | |
3494 case kReturn: | |
3495 codegen_->EmitUnwindAndReturn(); | |
3496 break; | |
3497 case kThrow: | |
3498 __ Push(result_register()); | |
3499 __ CallRuntime(Runtime::kReThrow); | |
3500 break; | |
3501 case kContinue: | |
3502 codegen_->EmitContinue(cmd.target); | |
3503 break; | |
3504 case kBreak: | |
3505 codegen_->EmitBreak(cmd.target); | |
3506 break; | |
3507 } | |
3508 __ bind(&skip); | |
3509 } | |
3510 } | |
3511 | |
3512 #undef __ | 3448 #undef __ |
3513 | 3449 |
3514 | 3450 |
3515 static Address GetInterruptImmediateLoadAddress(Address pc) { | 3451 static Address GetInterruptImmediateLoadAddress(Address pc) { |
3516 Address load_address = pc - 2 * Assembler::kInstrSize; | 3452 Address load_address = pc - 2 * Assembler::kInstrSize; |
3517 if (!FLAG_enable_embedded_constant_pool) { | 3453 if (!FLAG_enable_embedded_constant_pool) { |
3518 DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(load_address))); | 3454 DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(load_address))); |
3519 } else if (Assembler::IsLdrPpRegOffset(Memory::int32_at(load_address))) { | 3455 } else if (Assembler::IsLdrPpRegOffset(Memory::int32_at(load_address))) { |
3520 // This is an extended constant pool lookup. | 3456 // This is an extended constant pool lookup. |
3521 if (CpuFeatures::IsSupported(ARMv7)) { | 3457 if (CpuFeatures::IsSupported(ARMv7)) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3645 DCHECK(interrupt_address == | 3581 DCHECK(interrupt_address == |
3646 isolate->builtins()->OnStackReplacement()->entry()); | 3582 isolate->builtins()->OnStackReplacement()->entry()); |
3647 return ON_STACK_REPLACEMENT; | 3583 return ON_STACK_REPLACEMENT; |
3648 } | 3584 } |
3649 | 3585 |
3650 | 3586 |
3651 } // namespace internal | 3587 } // namespace internal |
3652 } // namespace v8 | 3588 } // namespace v8 |
3653 | 3589 |
3654 #endif // V8_TARGET_ARCH_ARM | 3590 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |