OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 3429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3440 // code. Fetch it from the context. | 3440 // code. Fetch it from the context. |
3441 __ LoadP(ip, ContextMemOperand(cp, Context::CLOSURE_INDEX)); | 3441 __ LoadP(ip, ContextMemOperand(cp, Context::CLOSURE_INDEX)); |
3442 } else { | 3442 } else { |
3443 DCHECK(closure_scope->is_function_scope()); | 3443 DCHECK(closure_scope->is_function_scope()); |
3444 __ LoadP(ip, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 3444 __ LoadP(ip, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
3445 } | 3445 } |
3446 PushOperand(ip); | 3446 PushOperand(ip); |
3447 } | 3447 } |
3448 | 3448 |
3449 | 3449 |
3450 // ---------------------------------------------------------------------------- | |
3451 // Non-local control flow support. | |
3452 | |
3453 void FullCodeGenerator::EnterFinallyBlock() { | |
3454 DCHECK(!result_register().is(r4)); | |
3455 // Store pending message while executing finally block. | |
3456 ExternalReference pending_message_obj = | |
3457 ExternalReference::address_of_pending_message_obj(isolate()); | |
3458 __ mov(ip, Operand(pending_message_obj)); | |
3459 __ LoadP(r4, MemOperand(ip)); | |
3460 PushOperand(r4); | |
3461 | |
3462 ClearPendingMessage(); | |
3463 } | |
3464 | |
3465 | |
3466 void FullCodeGenerator::ExitFinallyBlock() { | |
3467 DCHECK(!result_register().is(r4)); | |
3468 // Restore pending message from stack. | |
3469 PopOperand(r4); | |
3470 ExternalReference pending_message_obj = | |
3471 ExternalReference::address_of_pending_message_obj(isolate()); | |
3472 __ mov(ip, Operand(pending_message_obj)); | |
3473 __ StoreP(r4, MemOperand(ip)); | |
3474 } | |
3475 | |
3476 | |
3477 void FullCodeGenerator::ClearPendingMessage() { | |
3478 DCHECK(!result_register().is(r4)); | |
3479 ExternalReference pending_message_obj = | |
3480 ExternalReference::address_of_pending_message_obj(isolate()); | |
3481 __ LoadRoot(r4, Heap::kTheHoleValueRootIndex); | |
3482 __ mov(ip, Operand(pending_message_obj)); | |
3483 __ StoreP(r4, MemOperand(ip)); | |
3484 } | |
3485 | |
3486 | |
3487 void FullCodeGenerator::DeferredCommands::EmitCommands() { | |
3488 DCHECK(!result_register().is(r4)); | |
3489 // Restore the accumulator (r3) and token (r4). | |
3490 __ Pop(r4, result_register()); | |
3491 for (DeferredCommand cmd : commands_) { | |
3492 Label skip; | |
3493 __ CmpSmiLiteral(r4, Smi::FromInt(cmd.token), r0); | |
3494 __ bne(&skip); | |
3495 switch (cmd.command) { | |
3496 case kReturn: | |
3497 codegen_->EmitUnwindAndReturn(); | |
3498 break; | |
3499 case kThrow: | |
3500 __ Push(result_register()); | |
3501 __ CallRuntime(Runtime::kReThrow); | |
3502 break; | |
3503 case kContinue: | |
3504 codegen_->EmitContinue(cmd.target); | |
3505 break; | |
3506 case kBreak: | |
3507 codegen_->EmitBreak(cmd.target); | |
3508 break; | |
3509 } | |
3510 __ bind(&skip); | |
3511 } | |
3512 } | |
3513 | |
3514 #undef __ | 3450 #undef __ |
3515 | 3451 |
3516 | 3452 |
3517 void BackEdgeTable::PatchAt(Code* unoptimized_code, Address pc, | 3453 void BackEdgeTable::PatchAt(Code* unoptimized_code, Address pc, |
3518 BackEdgeState target_state, | 3454 BackEdgeState target_state, |
3519 Code* replacement_code) { | 3455 Code* replacement_code) { |
3520 Address mov_address = Assembler::target_address_from_return_address(pc); | 3456 Address mov_address = Assembler::target_address_from_return_address(pc); |
3521 Address cmp_address = mov_address - 2 * Assembler::kInstrSize; | 3457 Address cmp_address = mov_address - 2 * Assembler::kInstrSize; |
3522 Isolate* isolate = unoptimized_code->GetIsolate(); | 3458 Isolate* isolate = unoptimized_code->GetIsolate(); |
3523 CodePatcher patcher(isolate, cmp_address, 1); | 3459 CodePatcher patcher(isolate, cmp_address, 1); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3576 | 3512 |
3577 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 3513 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
3578 | 3514 |
3579 DCHECK(interrupt_address == | 3515 DCHECK(interrupt_address == |
3580 isolate->builtins()->OnStackReplacement()->entry()); | 3516 isolate->builtins()->OnStackReplacement()->entry()); |
3581 return ON_STACK_REPLACEMENT; | 3517 return ON_STACK_REPLACEMENT; |
3582 } | 3518 } |
3583 } // namespace internal | 3519 } // namespace internal |
3584 } // namespace v8 | 3520 } // namespace v8 |
3585 #endif // V8_TARGET_ARCH_PPC | 3521 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |