| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "a64/lithium-codegen-a64.h" | 30 #include "a64/lithium-codegen-a64.h" |
| 31 #include "a64/lithium-gap-resolver-a64.h" | 31 #include "a64/lithium-gap-resolver-a64.h" |
| 32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
| 33 #include "stub-cache.h" | 33 #include "stub-cache.h" |
| 34 #include "hydrogen-osr.h" |
| 34 | 35 |
| 35 namespace v8 { | 36 namespace v8 { |
| 36 namespace internal { | 37 namespace internal { |
| 37 | 38 |
| 38 | 39 |
| 39 class SafepointGenerator : public CallWrapper { | 40 class SafepointGenerator : public CallWrapper { |
| 40 public: | 41 public: |
| 41 SafepointGenerator(LCodeGen* codegen, | 42 SafepointGenerator(LCodeGen* codegen, |
| 42 LPointerMap* pointers, | 43 LPointerMap* pointers, |
| 43 Safepoint::DeoptMode mode) | 44 Safepoint::DeoptMode mode) |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 | 726 |
| 726 // Trace the call. | 727 // Trace the call. |
| 727 if (FLAG_trace && info()->IsOptimizing()) { | 728 if (FLAG_trace && info()->IsOptimizing()) { |
| 728 __ CallRuntime(Runtime::kTraceEnter, 0); | 729 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 729 } | 730 } |
| 730 | 731 |
| 731 return !is_aborted(); | 732 return !is_aborted(); |
| 732 } | 733 } |
| 733 | 734 |
| 734 | 735 |
| 736 void LCodeGen::GenerateOsrPrologue() { |
| 737 // Generate the OSR entry prologue at the first unknown OSR value, or if there |
| 738 // are none, at the OSR entrypoint instruction. |
| 739 if (osr_pc_offset_ >= 0) return; |
| 740 |
| 741 osr_pc_offset_ = masm()->pc_offset(); |
| 742 |
| 743 // Adjust the frame size, subsuming the unoptimized frame into the |
| 744 // optimized frame. |
| 745 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); |
| 746 ASSERT(slots >= 0); |
| 747 __ Claim(slots); |
| 748 } |
| 749 |
| 750 |
| 735 bool LCodeGen::GenerateBody() { | 751 bool LCodeGen::GenerateBody() { |
| 736 ASSERT(is_generating()); | 752 ASSERT(is_generating()); |
| 737 bool emit_instructions = true; | 753 bool emit_instructions = true; |
| 738 | 754 |
| 739 for (current_instruction_ = 0; | 755 for (current_instruction_ = 0; |
| 740 !is_aborted() && (current_instruction_ < instructions_->length()); | 756 !is_aborted() && (current_instruction_ < instructions_->length()); |
| 741 current_instruction_++) { | 757 current_instruction_++) { |
| 742 LInstruction* instr = instructions_->at(current_instruction_); | 758 LInstruction* instr = instructions_->at(current_instruction_); |
| 743 | 759 |
| 744 // Don't emit code for basic blocks with a replacement. | 760 // Don't emit code for basic blocks with a replacement. |
| (...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 2016 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 2001 break; | 2017 break; |
| 2002 } | 2018 } |
| 2003 default: | 2019 default: |
| 2004 UNREACHABLE(); | 2020 UNREACHABLE(); |
| 2005 } | 2021 } |
| 2006 } | 2022 } |
| 2007 | 2023 |
| 2008 | 2024 |
| 2009 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { | 2025 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { |
| 2010 // Record the address of the first unknown OSR value as the place to enter. | 2026 GenerateOsrPrologue(); |
| 2011 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); | |
| 2012 } | 2027 } |
| 2013 | 2028 |
| 2014 | 2029 |
| 2015 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { | 2030 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { |
| 2016 Register temp = ToRegister(instr->temp()); | 2031 Register temp = ToRegister(instr->temp()); |
| 2017 { | 2032 { |
| 2018 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 2033 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
| 2019 __ Push(object); | 2034 __ Push(object); |
| 2020 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); | 2035 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
| 2021 __ StoreToSafepointRegisterSlot(x0, temp); | 2036 __ StoreToSafepointRegisterSlot(x0, temp); |
| (...skipping 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4444 // This is a pseudo-instruction that ensures that the environment here is | 4459 // This is a pseudo-instruction that ensures that the environment here is |
| 4445 // properly registered for deoptimization and records the assembler's PC | 4460 // properly registered for deoptimization and records the assembler's PC |
| 4446 // offset. | 4461 // offset. |
| 4447 LEnvironment* environment = instr->environment(); | 4462 LEnvironment* environment = instr->environment(); |
| 4448 | 4463 |
| 4449 // If the environment were already registered, we would have no way of | 4464 // If the environment were already registered, we would have no way of |
| 4450 // backpatching it with the spill slot operands. | 4465 // backpatching it with the spill slot operands. |
| 4451 ASSERT(!environment->HasBeenRegistered()); | 4466 ASSERT(!environment->HasBeenRegistered()); |
| 4452 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4467 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 4453 | 4468 |
| 4454 // Normally we record the first unknown OSR value as the entrypoint to the OSR | 4469 GenerateOsrPrologue(); |
| 4455 // code, but if there were none, record the entrypoint here. | |
| 4456 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); | |
| 4457 } | 4470 } |
| 4458 | 4471 |
| 4459 | 4472 |
| 4460 void LCodeGen::DoOuterContext(LOuterContext* instr) { | 4473 void LCodeGen::DoOuterContext(LOuterContext* instr) { |
| 4461 Register context = ToRegister(instr->context()); | 4474 Register context = ToRegister(instr->context()); |
| 4462 Register result = ToRegister(instr->result()); | 4475 Register result = ToRegister(instr->result()); |
| 4463 __ Ldr(result, ContextMemOperand(context, Context::PREVIOUS_INDEX)); | 4476 __ Ldr(result, ContextMemOperand(context, Context::PREVIOUS_INDEX)); |
| 4464 } | 4477 } |
| 4465 | 4478 |
| 4466 | 4479 |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5593 __ Bind(&out_of_object); | 5606 __ Bind(&out_of_object); |
| 5594 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5607 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5595 // Index is equal to negated out of object property index plus 1. | 5608 // Index is equal to negated out of object property index plus 1. |
| 5596 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5609 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5597 __ Ldr(result, FieldMemOperand(result, | 5610 __ Ldr(result, FieldMemOperand(result, |
| 5598 FixedArray::kHeaderSize - kPointerSize)); | 5611 FixedArray::kHeaderSize - kPointerSize)); |
| 5599 __ Bind(&done); | 5612 __ Bind(&done); |
| 5600 } | 5613 } |
| 5601 | 5614 |
| 5602 } } // namespace v8::internal | 5615 } } // namespace v8::internal |
| OLD | NEW |