OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2945 __ SetCallKind(ecx, CALL_AS_METHOD); | 2945 __ SetCallKind(ecx, CALL_AS_METHOD); |
2946 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); | 2946 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); |
2947 } | 2947 } |
2948 | 2948 |
2949 | 2949 |
2950 bool CEntryStub::NeedsImmovableCode() { | 2950 bool CEntryStub::NeedsImmovableCode() { |
2951 return false; | 2951 return false; |
2952 } | 2952 } |
2953 | 2953 |
2954 | 2954 |
2955 bool CEntryStub::IsPregenerated(Isolate* isolate) { | |
2956 return (!save_doubles_ || isolate->fp_stubs_generated()) && | |
2957 result_size_ == 1; | |
2958 } | |
2959 | |
2960 | |
2961 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 2955 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
2962 CEntryStub::GenerateAheadOfTime(isolate); | 2956 CEntryStub::GenerateAheadOfTime(isolate); |
2963 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 2957 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
2964 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 2958 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
2965 // It is important that the store buffer overflow stubs are generated first. | 2959 // It is important that the store buffer overflow stubs are generated first. |
2966 RecordWriteStub::GenerateFixedRegStubsAheadOfTime(isolate); | |
2967 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 2960 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
2968 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 2961 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
2969 if (Serializer::enabled()) { | 2962 if (Serializer::enabled()) { |
2970 PlatformFeatureScope sse2(SSE2); | 2963 PlatformFeatureScope sse2(SSE2); |
2971 BinaryOpStub::GenerateAheadOfTime(isolate); | 2964 BinaryOpStub::GenerateAheadOfTime(isolate); |
2972 } else { | 2965 } else { |
2973 BinaryOpStub::GenerateAheadOfTime(isolate); | 2966 BinaryOpStub::GenerateAheadOfTime(isolate); |
2974 } | 2967 } |
2975 } | 2968 } |
2976 | 2969 |
(...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5280 __ Drop(1); | 5273 __ Drop(1); |
5281 __ ret(2 * kPointerSize); | 5274 __ ret(2 * kPointerSize); |
5282 | 5275 |
5283 __ bind(¬_in_dictionary); | 5276 __ bind(¬_in_dictionary); |
5284 __ mov(result_, Immediate(0)); | 5277 __ mov(result_, Immediate(0)); |
5285 __ Drop(1); | 5278 __ Drop(1); |
5286 __ ret(2 * kPointerSize); | 5279 __ ret(2 * kPointerSize); |
5287 } | 5280 } |
5288 | 5281 |
5289 | 5282 |
5290 struct AheadOfTimeWriteBarrierStubList { | |
5291 Register object, value, address; | |
5292 RememberedSetAction action; | |
5293 }; | |
5294 | |
5295 | |
5296 #define REG(Name) { kRegister_ ## Name ## _Code } | |
5297 | |
5298 static const AheadOfTimeWriteBarrierStubList kAheadOfTime[] = { | |
5299 // Used in RegExpExecStub. | |
5300 { REG(ebx), REG(eax), REG(edi), EMIT_REMEMBERED_SET }, | |
5301 // Used in CompileArrayPushCall. | |
5302 { REG(ebx), REG(ecx), REG(edx), EMIT_REMEMBERED_SET }, | |
5303 { REG(ebx), REG(edi), REG(edx), OMIT_REMEMBERED_SET }, | |
5304 // Used in StoreStubCompiler::CompileStoreField and | |
5305 // KeyedStoreStubCompiler::CompileStoreField via GenerateStoreField. | |
5306 { REG(edx), REG(ecx), REG(ebx), EMIT_REMEMBERED_SET }, | |
5307 // GenerateStoreField calls the stub with two different permutations of | |
5308 // registers. This is the second. | |
5309 { REG(ebx), REG(ecx), REG(edx), EMIT_REMEMBERED_SET }, | |
5310 // StoreIC::GenerateNormal via GenerateDictionaryStore | |
5311 { REG(ebx), REG(edi), REG(edx), EMIT_REMEMBERED_SET }, | |
5312 // KeyedStoreIC::GenerateGeneric. | |
5313 { REG(ebx), REG(edx), REG(ecx), EMIT_REMEMBERED_SET}, | |
5314 // KeyedStoreStubCompiler::GenerateStoreFastElement. | |
5315 { REG(edi), REG(ebx), REG(ecx), EMIT_REMEMBERED_SET}, | |
5316 { REG(edx), REG(edi), REG(ebx), EMIT_REMEMBERED_SET}, | |
5317 // ElementsTransitionGenerator::GenerateMapChangeElementTransition | |
5318 // and ElementsTransitionGenerator::GenerateSmiToDouble | |
5319 // and ElementsTransitionGenerator::GenerateDoubleToObject | |
5320 { REG(edx), REG(ebx), REG(edi), EMIT_REMEMBERED_SET}, | |
5321 { REG(edx), REG(ebx), REG(edi), OMIT_REMEMBERED_SET}, | |
5322 // ElementsTransitionGenerator::GenerateDoubleToObject | |
5323 { REG(eax), REG(edx), REG(esi), EMIT_REMEMBERED_SET}, | |
5324 { REG(edx), REG(eax), REG(edi), EMIT_REMEMBERED_SET}, | |
5325 // StoreArrayLiteralElementStub::Generate | |
5326 { REG(ebx), REG(eax), REG(ecx), EMIT_REMEMBERED_SET}, | |
5327 // FastNewClosureStub and StringAddStub::Generate | |
5328 { REG(ecx), REG(edx), REG(ebx), EMIT_REMEMBERED_SET}, | |
5329 // StringAddStub::Generate | |
5330 { REG(ecx), REG(eax), REG(ebx), EMIT_REMEMBERED_SET}, | |
5331 // Null termination. | |
5332 { REG(no_reg), REG(no_reg), REG(no_reg), EMIT_REMEMBERED_SET} | |
5333 }; | |
5334 | |
5335 #undef REG | |
5336 | |
5337 bool RecordWriteStub::IsPregenerated(Isolate* isolate) { | |
5338 for (const AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; | |
5339 !entry->object.is(no_reg); | |
5340 entry++) { | |
5341 if (object_.is(entry->object) && | |
5342 value_.is(entry->value) && | |
5343 address_.is(entry->address) && | |
5344 remembered_set_action_ == entry->action && | |
5345 save_fp_regs_mode_ == kDontSaveFPRegs) { | |
5346 return true; | |
5347 } | |
5348 } | |
5349 return false; | |
5350 } | |
5351 | |
5352 | |
5353 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime( | 5283 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime( |
5354 Isolate* isolate) { | 5284 Isolate* isolate) { |
5355 StoreBufferOverflowStub stub(kDontSaveFPRegs); | 5285 StoreBufferOverflowStub stub(kDontSaveFPRegs); |
5356 stub.GetCode(isolate)->set_is_pregenerated(true); | 5286 stub.GetCode(isolate)->set_is_pregenerated(true); |
5357 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { | 5287 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
5358 StoreBufferOverflowStub stub2(kSaveFPRegs); | 5288 StoreBufferOverflowStub stub2(kSaveFPRegs); |
5359 stub2.GetCode(isolate)->set_is_pregenerated(true); | 5289 stub2.GetCode(isolate)->set_is_pregenerated(true); |
5360 } | 5290 } |
5361 } | 5291 } |
5362 | 5292 |
5363 | 5293 |
5364 void RecordWriteStub::GenerateFixedRegStubsAheadOfTime(Isolate* isolate) { | |
5365 for (const AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; | |
5366 !entry->object.is(no_reg); | |
5367 entry++) { | |
5368 RecordWriteStub stub(entry->object, | |
5369 entry->value, | |
5370 entry->address, | |
5371 entry->action, | |
5372 kDontSaveFPRegs); | |
5373 stub.GetCode(isolate)->set_is_pregenerated(true); | |
5374 } | |
5375 } | |
5376 | |
5377 | |
5378 bool CodeStub::CanUseFPRegisters() { | 5294 bool CodeStub::CanUseFPRegisters() { |
5379 return CpuFeatures::IsSupported(SSE2); | 5295 return CpuFeatures::IsSupported(SSE2); |
5380 } | 5296 } |
5381 | 5297 |
5382 | 5298 |
5383 // Takes the input in 3 registers: address_ value_ and object_. A pointer to | 5299 // Takes the input in 3 registers: address_ value_ and object_. A pointer to |
5384 // the value has just been written into the object, now this stub makes sure | 5300 // the value has just been written into the object, now this stub makes sure |
5385 // we keep the GC informed. The word in the object where the value has been | 5301 // we keep the GC informed. The word in the object where the value has been |
5386 // written is in the address register. | 5302 // written is in the address register. |
5387 void RecordWriteStub::Generate(MacroAssembler* masm) { | 5303 void RecordWriteStub::Generate(MacroAssembler* masm) { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5696 __ sub(eax, Immediate(1)); | 5612 __ sub(eax, Immediate(1)); |
5697 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 5613 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
5698 ParameterCount argument_count(eax); | 5614 ParameterCount argument_count(eax); |
5699 __ InvokeFunction( | 5615 __ InvokeFunction( |
5700 edi, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | 5616 edi, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
5701 } | 5617 } |
5702 | 5618 |
5703 | 5619 |
5704 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 5620 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
5705 if (masm->isolate()->function_entry_hook() != NULL) { | 5621 if (masm->isolate()->function_entry_hook() != NULL) { |
5706 // It's always safe to call the entry hook stub, as the hook itself | |
5707 // is not allowed to call back to V8. | |
5708 AllowStubCallsScope allow_stub_calls(masm, true); | |
5709 | |
5710 ProfileEntryHookStub stub; | 5622 ProfileEntryHookStub stub; |
5711 masm->CallStub(&stub); | 5623 masm->CallStub(&stub); |
5712 } | 5624 } |
5713 } | 5625 } |
5714 | 5626 |
5715 | 5627 |
5716 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { | 5628 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
5717 // Save volatile registers. | 5629 // Save volatile registers. |
5718 const int kNumSavedRegisters = 3; | 5630 const int kNumSavedRegisters = 3; |
5719 __ push(eax); | 5631 __ push(eax); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6071 __ bind(&fast_elements_case); | 5983 __ bind(&fast_elements_case); |
6072 GenerateCase(masm, FAST_ELEMENTS); | 5984 GenerateCase(masm, FAST_ELEMENTS); |
6073 } | 5985 } |
6074 | 5986 |
6075 | 5987 |
6076 #undef __ | 5988 #undef __ |
6077 | 5989 |
6078 } } // namespace v8::internal | 5990 } } // namespace v8::internal |
6079 | 5991 |
6080 #endif // V8_TARGET_ARCH_IA32 | 5992 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |