| 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 2763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2774 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2774 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 2775 RelocInfo::CODE_TARGET); | 2775 RelocInfo::CODE_TARGET); |
| 2776 } | 2776 } |
| 2777 | 2777 |
| 2778 | 2778 |
| 2779 bool CEntryStub::NeedsImmovableCode() { | 2779 bool CEntryStub::NeedsImmovableCode() { |
| 2780 return false; | 2780 return false; |
| 2781 } | 2781 } |
| 2782 | 2782 |
| 2783 | 2783 |
| 2784 bool CEntryStub::IsPregenerated(Isolate* isolate) { | |
| 2785 #ifdef _WIN64 | |
| 2786 return result_size_ == 1; | |
| 2787 #else | |
| 2788 return true; | |
| 2789 #endif | |
| 2790 } | |
| 2791 | |
| 2792 | |
| 2793 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 2784 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
| 2794 CEntryStub::GenerateAheadOfTime(isolate); | 2785 CEntryStub::GenerateAheadOfTime(isolate); |
| 2795 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 2786 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
| 2796 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 2787 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
| 2797 // It is important that the store buffer overflow stubs are generated first. | 2788 // It is important that the store buffer overflow stubs are generated first. |
| 2798 RecordWriteStub::GenerateFixedRegStubsAheadOfTime(isolate); | |
| 2799 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 2789 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 2800 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 2790 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
| 2801 BinaryOpStub::GenerateAheadOfTime(isolate); | 2791 BinaryOpStub::GenerateAheadOfTime(isolate); |
| 2802 } | 2792 } |
| 2803 | 2793 |
| 2804 | 2794 |
| 2805 void CodeStub::GenerateFPStubs(Isolate* isolate) { | 2795 void CodeStub::GenerateFPStubs(Isolate* isolate) { |
| 2806 } | 2796 } |
| 2807 | 2797 |
| 2808 | 2798 |
| (...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5078 __ Drop(1); | 5068 __ Drop(1); |
| 5079 __ ret(2 * kPointerSize); | 5069 __ ret(2 * kPointerSize); |
| 5080 | 5070 |
| 5081 __ bind(¬_in_dictionary); | 5071 __ bind(¬_in_dictionary); |
| 5082 __ movq(scratch, Immediate(0)); | 5072 __ movq(scratch, Immediate(0)); |
| 5083 __ Drop(1); | 5073 __ Drop(1); |
| 5084 __ ret(2 * kPointerSize); | 5074 __ ret(2 * kPointerSize); |
| 5085 } | 5075 } |
| 5086 | 5076 |
| 5087 | 5077 |
| 5088 struct AheadOfTimeWriteBarrierStubList { | |
| 5089 Register object, value, address; | |
| 5090 RememberedSetAction action; | |
| 5091 }; | |
| 5092 | |
| 5093 | |
| 5094 #define REG(Name) { kRegister_ ## Name ## _Code } | |
| 5095 | |
| 5096 struct AheadOfTimeWriteBarrierStubList kAheadOfTime[] = { | |
| 5097 // Used in RegExpExecStub. | |
| 5098 { REG(rbx), REG(rax), REG(rdi), EMIT_REMEMBERED_SET }, | |
| 5099 // Used in CompileArrayPushCall. | |
| 5100 { REG(rbx), REG(rcx), REG(rdx), EMIT_REMEMBERED_SET }, | |
| 5101 // Used in StoreStubCompiler::CompileStoreField and | |
| 5102 // KeyedStoreStubCompiler::CompileStoreField via GenerateStoreField. | |
| 5103 { REG(rdx), REG(rcx), REG(rbx), EMIT_REMEMBERED_SET }, | |
| 5104 // GenerateStoreField calls the stub with two different permutations of | |
| 5105 // registers. This is the second. | |
| 5106 { REG(rbx), REG(rcx), REG(rdx), EMIT_REMEMBERED_SET }, | |
| 5107 // StoreIC::GenerateNormal via GenerateDictionaryStore. | |
| 5108 { REG(rbx), REG(r8), REG(r9), EMIT_REMEMBERED_SET }, | |
| 5109 // KeyedStoreIC::GenerateGeneric. | |
| 5110 { REG(rbx), REG(rdx), REG(rcx), EMIT_REMEMBERED_SET}, | |
| 5111 // KeyedStoreStubCompiler::GenerateStoreFastElement. | |
| 5112 { REG(rdi), REG(rbx), REG(rcx), EMIT_REMEMBERED_SET}, | |
| 5113 { REG(rdx), REG(rdi), REG(rbx), EMIT_REMEMBERED_SET}, | |
| 5114 // ElementsTransitionGenerator::GenerateMapChangeElementTransition | |
| 5115 // and ElementsTransitionGenerator::GenerateSmiToDouble | |
| 5116 // and ElementsTransitionGenerator::GenerateDoubleToObject | |
| 5117 { REG(rdx), REG(rbx), REG(rdi), EMIT_REMEMBERED_SET}, | |
| 5118 { REG(rdx), REG(rbx), REG(rdi), OMIT_REMEMBERED_SET}, | |
| 5119 // ElementsTransitionGenerator::GenerateSmiToDouble | |
| 5120 // and ElementsTransitionGenerator::GenerateDoubleToObject | |
| 5121 { REG(rdx), REG(r11), REG(r15), EMIT_REMEMBERED_SET}, | |
| 5122 // ElementsTransitionGenerator::GenerateDoubleToObject | |
| 5123 { REG(r11), REG(rax), REG(r15), EMIT_REMEMBERED_SET}, | |
| 5124 // StoreArrayLiteralElementStub::Generate | |
| 5125 { REG(rbx), REG(rax), REG(rcx), EMIT_REMEMBERED_SET}, | |
| 5126 // FastNewClosureStub::Generate and | |
| 5127 // StringAddStub::Generate | |
| 5128 { REG(rcx), REG(rdx), REG(rbx), EMIT_REMEMBERED_SET}, | |
| 5129 // StringAddStub::Generate | |
| 5130 { REG(rcx), REG(rax), REG(rbx), EMIT_REMEMBERED_SET}, | |
| 5131 // Null termination. | |
| 5132 { REG(no_reg), REG(no_reg), REG(no_reg), EMIT_REMEMBERED_SET} | |
| 5133 }; | |
| 5134 | |
| 5135 #undef REG | |
| 5136 | |
| 5137 bool RecordWriteStub::IsPregenerated(Isolate* isolate) { | |
| 5138 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; | |
| 5139 !entry->object.is(no_reg); | |
| 5140 entry++) { | |
| 5141 if (object_.is(entry->object) && | |
| 5142 value_.is(entry->value) && | |
| 5143 address_.is(entry->address) && | |
| 5144 remembered_set_action_ == entry->action && | |
| 5145 save_fp_regs_mode_ == kDontSaveFPRegs) { | |
| 5146 return true; | |
| 5147 } | |
| 5148 } | |
| 5149 return false; | |
| 5150 } | |
| 5151 | |
| 5152 | |
| 5153 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime( | 5078 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime( |
| 5154 Isolate* isolate) { | 5079 Isolate* isolate) { |
| 5155 StoreBufferOverflowStub stub1(kDontSaveFPRegs); | 5080 StoreBufferOverflowStub stub1(kDontSaveFPRegs); |
| 5156 stub1.GetCode(isolate)->set_is_pregenerated(true); | 5081 stub1.GetCode(isolate)->set_is_pregenerated(true); |
| 5157 StoreBufferOverflowStub stub2(kSaveFPRegs); | 5082 StoreBufferOverflowStub stub2(kSaveFPRegs); |
| 5158 stub2.GetCode(isolate)->set_is_pregenerated(true); | 5083 stub2.GetCode(isolate)->set_is_pregenerated(true); |
| 5159 } | 5084 } |
| 5160 | 5085 |
| 5161 | 5086 |
| 5162 void RecordWriteStub::GenerateFixedRegStubsAheadOfTime(Isolate* isolate) { | |
| 5163 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; | |
| 5164 !entry->object.is(no_reg); | |
| 5165 entry++) { | |
| 5166 RecordWriteStub stub(entry->object, | |
| 5167 entry->value, | |
| 5168 entry->address, | |
| 5169 entry->action, | |
| 5170 kDontSaveFPRegs); | |
| 5171 stub.GetCode(isolate)->set_is_pregenerated(true); | |
| 5172 } | |
| 5173 } | |
| 5174 | |
| 5175 | |
| 5176 bool CodeStub::CanUseFPRegisters() { | 5087 bool CodeStub::CanUseFPRegisters() { |
| 5177 return true; // Always have SSE2 on x64. | 5088 return true; // Always have SSE2 on x64. |
| 5178 } | 5089 } |
| 5179 | 5090 |
| 5180 | 5091 |
| 5181 // Takes the input in 3 registers: address_ value_ and object_. A pointer to | 5092 // Takes the input in 3 registers: address_ value_ and object_. A pointer to |
| 5182 // the value has just been written into the object, now this stub makes sure | 5093 // the value has just been written into the object, now this stub makes sure |
| 5183 // we keep the GC informed. The word in the object where the value has been | 5094 // we keep the GC informed. The word in the object where the value has been |
| 5184 // written is in the address register. | 5095 // written is in the address register. |
| 5185 void RecordWriteStub::Generate(MacroAssembler* masm) { | 5096 void RecordWriteStub::Generate(MacroAssembler* masm) { |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5489 __ subl(rax, Immediate(1)); | 5400 __ subl(rax, Immediate(1)); |
| 5490 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 5401 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 5491 ParameterCount argument_count(rax); | 5402 ParameterCount argument_count(rax); |
| 5492 __ InvokeFunction( | 5403 __ InvokeFunction( |
| 5493 rdi, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | 5404 rdi, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 5494 } | 5405 } |
| 5495 | 5406 |
| 5496 | 5407 |
| 5497 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 5408 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 5498 if (masm->isolate()->function_entry_hook() != NULL) { | 5409 if (masm->isolate()->function_entry_hook() != NULL) { |
| 5499 // It's always safe to call the entry hook stub, as the hook itself | |
| 5500 // is not allowed to call back to V8. | |
| 5501 AllowStubCallsScope allow_stub_calls(masm, true); | |
| 5502 | |
| 5503 ProfileEntryHookStub stub; | 5410 ProfileEntryHookStub stub; |
| 5504 masm->CallStub(&stub); | 5411 masm->CallStub(&stub); |
| 5505 } | 5412 } |
| 5506 } | 5413 } |
| 5507 | 5414 |
| 5508 | 5415 |
| 5509 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { | 5416 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
| 5510 // This stub can be called from essentially anywhere, so it needs to save | 5417 // This stub can be called from essentially anywhere, so it needs to save |
| 5511 // all volatile and callee-save registers. | 5418 // all volatile and callee-save registers. |
| 5512 const size_t kNumSavedRegisters = 2; | 5419 const size_t kNumSavedRegisters = 2; |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5876 __ bind(&fast_elements_case); | 5783 __ bind(&fast_elements_case); |
| 5877 GenerateCase(masm, FAST_ELEMENTS); | 5784 GenerateCase(masm, FAST_ELEMENTS); |
| 5878 } | 5785 } |
| 5879 | 5786 |
| 5880 | 5787 |
| 5881 #undef __ | 5788 #undef __ |
| 5882 | 5789 |
| 5883 } } // namespace v8::internal | 5790 } } // namespace v8::internal |
| 5884 | 5791 |
| 5885 #endif // V8_TARGET_ARCH_X64 | 5792 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |