| 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 4524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4535 } | 4535 } |
| 4536 __ push(ip); | 4536 __ push(ip); |
| 4537 } | 4537 } |
| 4538 | 4538 |
| 4539 | 4539 |
| 4540 // ---------------------------------------------------------------------------- | 4540 // ---------------------------------------------------------------------------- |
| 4541 // Non-local control flow support. | 4541 // Non-local control flow support. |
| 4542 | 4542 |
| 4543 void FullCodeGenerator::EnterFinallyBlock() { | 4543 void FullCodeGenerator::EnterFinallyBlock() { |
| 4544 DCHECK(!result_register().is(r4)); | 4544 DCHECK(!result_register().is(r4)); |
| 4545 // Store result register while executing finally block. | |
| 4546 __ push(result_register()); | |
| 4547 // Cook return address in link register to stack (smi encoded Code* delta) | |
| 4548 __ mflr(r4); | |
| 4549 __ mov(ip, Operand(masm_->CodeObject())); | |
| 4550 __ sub(r4, r4, ip); | |
| 4551 __ SmiTag(r4); | |
| 4552 | |
| 4553 // Store result register while executing finally block. | |
| 4554 __ push(r4); | |
| 4555 | |
| 4556 // Store pending message while executing finally block. | 4545 // Store pending message while executing finally block. |
| 4557 ExternalReference pending_message_obj = | 4546 ExternalReference pending_message_obj = |
| 4558 ExternalReference::address_of_pending_message_obj(isolate()); | 4547 ExternalReference::address_of_pending_message_obj(isolate()); |
| 4559 __ mov(ip, Operand(pending_message_obj)); | 4548 __ mov(ip, Operand(pending_message_obj)); |
| 4560 __ LoadP(r4, MemOperand(ip)); | 4549 __ LoadP(r4, MemOperand(ip)); |
| 4561 __ push(r4); | 4550 __ push(r4); |
| 4562 | 4551 |
| 4563 ClearPendingMessage(); | 4552 ClearPendingMessage(); |
| 4564 } | 4553 } |
| 4565 | 4554 |
| 4566 | 4555 |
| 4567 void FullCodeGenerator::ExitFinallyBlock() { | 4556 void FullCodeGenerator::ExitFinallyBlock() { |
| 4568 DCHECK(!result_register().is(r4)); | 4557 DCHECK(!result_register().is(r4)); |
| 4569 // Restore pending message from stack. | 4558 // Restore pending message from stack. |
| 4570 __ pop(r4); | 4559 __ pop(r4); |
| 4571 ExternalReference pending_message_obj = | 4560 ExternalReference pending_message_obj = |
| 4572 ExternalReference::address_of_pending_message_obj(isolate()); | 4561 ExternalReference::address_of_pending_message_obj(isolate()); |
| 4573 __ mov(ip, Operand(pending_message_obj)); | 4562 __ mov(ip, Operand(pending_message_obj)); |
| 4574 __ StoreP(r4, MemOperand(ip)); | 4563 __ StoreP(r4, MemOperand(ip)); |
| 4575 | |
| 4576 // Restore result register from stack. | |
| 4577 __ pop(r4); | |
| 4578 | |
| 4579 // Uncook return address and return. | |
| 4580 __ pop(result_register()); | |
| 4581 __ SmiUntag(r4); | |
| 4582 __ mov(ip, Operand(masm_->CodeObject())); | |
| 4583 __ add(ip, ip, r4); | |
| 4584 __ mtctr(ip); | |
| 4585 __ bctr(); | |
| 4586 } | 4564 } |
| 4587 | 4565 |
| 4588 | 4566 |
| 4589 void FullCodeGenerator::ClearPendingMessage() { | 4567 void FullCodeGenerator::ClearPendingMessage() { |
| 4590 DCHECK(!result_register().is(r4)); | 4568 DCHECK(!result_register().is(r4)); |
| 4591 ExternalReference pending_message_obj = | 4569 ExternalReference pending_message_obj = |
| 4592 ExternalReference::address_of_pending_message_obj(isolate()); | 4570 ExternalReference::address_of_pending_message_obj(isolate()); |
| 4593 __ LoadRoot(r4, Heap::kTheHoleValueRootIndex); | 4571 __ LoadRoot(r4, Heap::kTheHoleValueRootIndex); |
| 4594 __ mov(ip, Operand(pending_message_obj)); | 4572 __ mov(ip, Operand(pending_message_obj)); |
| 4595 __ StoreP(r4, MemOperand(ip)); | 4573 __ StoreP(r4, MemOperand(ip)); |
| 4596 } | 4574 } |
| 4597 | 4575 |
| 4598 | 4576 |
| 4599 void FullCodeGenerator::EmitLoadStoreICSlot(FeedbackVectorSlot slot) { | 4577 void FullCodeGenerator::EmitLoadStoreICSlot(FeedbackVectorSlot slot) { |
| 4600 DCHECK(!slot.IsInvalid()); | 4578 DCHECK(!slot.IsInvalid()); |
| 4601 __ mov(VectorStoreICTrampolineDescriptor::SlotRegister(), | 4579 __ mov(VectorStoreICTrampolineDescriptor::SlotRegister(), |
| 4602 Operand(SmiFromSlot(slot))); | 4580 Operand(SmiFromSlot(slot))); |
| 4603 } | 4581 } |
| 4604 | 4582 |
| 4583 void FullCodeGenerator::DeferredCommands::EmitCommands() { |
| 4584 DCHECK(!result_register().is(r4)); |
| 4585 // Restore the accumulator (r3) and token (r4). |
| 4586 __ Pop(r4, result_register()); |
| 4587 for (DeferredCommand cmd : commands_) { |
| 4588 Label skip; |
| 4589 __ CmpSmiLiteral(r4, Smi::FromInt(cmd.token), r0); |
| 4590 __ bne(&skip); |
| 4591 switch (cmd.command) { |
| 4592 case kReturn: |
| 4593 codegen_->EmitUnwindAndReturn(); |
| 4594 break; |
| 4595 case kThrow: |
| 4596 __ Push(result_register()); |
| 4597 __ CallRuntime(Runtime::kReThrow); |
| 4598 break; |
| 4599 case kContinue: |
| 4600 codegen_->EmitContinue(cmd.target); |
| 4601 break; |
| 4602 case kBreak: |
| 4603 codegen_->EmitBreak(cmd.target); |
| 4604 break; |
| 4605 } |
| 4606 __ bind(&skip); |
| 4607 } |
| 4608 } |
| 4605 | 4609 |
| 4606 #undef __ | 4610 #undef __ |
| 4607 | 4611 |
| 4608 | 4612 |
| 4609 void BackEdgeTable::PatchAt(Code* unoptimized_code, Address pc, | 4613 void BackEdgeTable::PatchAt(Code* unoptimized_code, Address pc, |
| 4610 BackEdgeState target_state, | 4614 BackEdgeState target_state, |
| 4611 Code* replacement_code) { | 4615 Code* replacement_code) { |
| 4612 Address mov_address = Assembler::target_address_from_return_address(pc); | 4616 Address mov_address = Assembler::target_address_from_return_address(pc); |
| 4613 Address cmp_address = mov_address - 2 * Assembler::kInstrSize; | 4617 Address cmp_address = mov_address - 2 * Assembler::kInstrSize; |
| 4614 Isolate* isolate = unoptimized_code->GetIsolate(); | 4618 Isolate* isolate = unoptimized_code->GetIsolate(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4671 return ON_STACK_REPLACEMENT; | 4675 return ON_STACK_REPLACEMENT; |
| 4672 } | 4676 } |
| 4673 | 4677 |
| 4674 DCHECK(interrupt_address == | 4678 DCHECK(interrupt_address == |
| 4675 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4679 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 4676 return OSR_AFTER_STACK_CHECK; | 4680 return OSR_AFTER_STACK_CHECK; |
| 4677 } | 4681 } |
| 4678 } // namespace internal | 4682 } // namespace internal |
| 4679 } // namespace v8 | 4683 } // namespace v8 |
| 4680 #endif // V8_TARGET_ARCH_PPC | 4684 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |