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 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2970 | 2970 |
2971 void CodeStub::GenerateFPStubs(Isolate* isolate) { | 2971 void CodeStub::GenerateFPStubs(Isolate* isolate) { |
2972 if (CpuFeatures::IsSupported(SSE2)) { | 2972 if (CpuFeatures::IsSupported(SSE2)) { |
2973 CEntryStub save_doubles(1, kSaveFPRegs); | 2973 CEntryStub save_doubles(1, kSaveFPRegs); |
2974 // Stubs might already be in the snapshot, detect that and don't regenerate, | 2974 // Stubs might already be in the snapshot, detect that and don't regenerate, |
2975 // which would lead to code stub initialization state being messed up. | 2975 // which would lead to code stub initialization state being messed up. |
2976 Code* save_doubles_code; | 2976 Code* save_doubles_code; |
2977 if (!save_doubles.FindCodeInCache(&save_doubles_code, isolate)) { | 2977 if (!save_doubles.FindCodeInCache(&save_doubles_code, isolate)) { |
2978 save_doubles_code = *(save_doubles.GetCode(isolate)); | 2978 save_doubles_code = *(save_doubles.GetCode(isolate)); |
2979 } | 2979 } |
2980 save_doubles_code->set_is_pregenerated(true); | |
2981 isolate->set_fp_stubs_generated(true); | 2980 isolate->set_fp_stubs_generated(true); |
2982 } | 2981 } |
2983 } | 2982 } |
2984 | 2983 |
2985 | 2984 |
2986 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { | 2985 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { |
2987 CEntryStub stub(1, kDontSaveFPRegs); | 2986 CEntryStub stub(1, kDontSaveFPRegs); |
2988 Handle<Code> code = stub.GetCode(isolate); | 2987 stub.GetCode(isolate); |
2989 code->set_is_pregenerated(true); | |
2990 } | 2988 } |
2991 | 2989 |
2992 | 2990 |
2993 static void JumpIfOOM(MacroAssembler* masm, | 2991 static void JumpIfOOM(MacroAssembler* masm, |
2994 Register value, | 2992 Register value, |
2995 Register scratch, | 2993 Register scratch, |
2996 Label* oom_label) { | 2994 Label* oom_label) { |
2997 __ mov(scratch, value); | 2995 __ mov(scratch, value); |
2998 STATIC_ASSERT(Failure::OUT_OF_MEMORY_EXCEPTION == 3); | 2996 STATIC_ASSERT(Failure::OUT_OF_MEMORY_EXCEPTION == 3); |
2999 STATIC_ASSERT(kFailureTag == 3); | 2997 STATIC_ASSERT(kFailureTag == 3); |
(...skipping 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5276 __ bind(¬_in_dictionary); | 5274 __ bind(¬_in_dictionary); |
5277 __ mov(result_, Immediate(0)); | 5275 __ mov(result_, Immediate(0)); |
5278 __ Drop(1); | 5276 __ Drop(1); |
5279 __ ret(2 * kPointerSize); | 5277 __ ret(2 * kPointerSize); |
5280 } | 5278 } |
5281 | 5279 |
5282 | 5280 |
5283 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime( | 5281 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime( |
5284 Isolate* isolate) { | 5282 Isolate* isolate) { |
5285 StoreBufferOverflowStub stub(kDontSaveFPRegs); | 5283 StoreBufferOverflowStub stub(kDontSaveFPRegs); |
5286 stub.GetCode(isolate)->set_is_pregenerated(true); | 5284 stub.GetCode(isolate); |
5287 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { | 5285 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
5288 StoreBufferOverflowStub stub2(kSaveFPRegs); | 5286 StoreBufferOverflowStub stub2(kSaveFPRegs); |
5289 stub2.GetCode(isolate)->set_is_pregenerated(true); | 5287 stub2.GetCode(isolate); |
5290 } | 5288 } |
5291 } | 5289 } |
5292 | 5290 |
5293 | 5291 |
5294 bool CodeStub::CanUseFPRegisters() { | 5292 bool CodeStub::CanUseFPRegisters() { |
5295 return CpuFeatures::IsSupported(SSE2); | 5293 return CpuFeatures::IsSupported(SSE2); |
5296 } | 5294 } |
5297 | 5295 |
5298 | 5296 |
5299 // Takes the input in 3 registers: address_ value_ and object_. A pointer to | 5297 // Takes the input in 3 registers: address_ value_ and object_. A pointer to |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5770 template<class T> | 5768 template<class T> |
5771 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { | 5769 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { |
5772 ElementsKind initial_kind = GetInitialFastElementsKind(); | 5770 ElementsKind initial_kind = GetInitialFastElementsKind(); |
5773 ElementsKind initial_holey_kind = GetHoleyElementsKind(initial_kind); | 5771 ElementsKind initial_holey_kind = GetHoleyElementsKind(initial_kind); |
5774 | 5772 |
5775 int to_index = GetSequenceIndexFromFastElementsKind( | 5773 int to_index = GetSequenceIndexFromFastElementsKind( |
5776 TERMINAL_FAST_ELEMENTS_KIND); | 5774 TERMINAL_FAST_ELEMENTS_KIND); |
5777 for (int i = 0; i <= to_index; ++i) { | 5775 for (int i = 0; i <= to_index; ++i) { |
5778 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 5776 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
5779 T stub(kind); | 5777 T stub(kind); |
5780 stub.GetCode(isolate)->set_is_pregenerated(true); | 5778 stub.GetCode(isolate); |
5781 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE || | 5779 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE || |
5782 (!FLAG_track_allocation_sites && | 5780 (!FLAG_track_allocation_sites && |
5783 (kind == initial_kind || kind == initial_holey_kind))) { | 5781 (kind == initial_kind || kind == initial_holey_kind))) { |
5784 T stub1(kind, CONTEXT_CHECK_REQUIRED, DISABLE_ALLOCATION_SITES); | 5782 T stub1(kind, CONTEXT_CHECK_REQUIRED, DISABLE_ALLOCATION_SITES); |
5785 stub1.GetCode(isolate)->set_is_pregenerated(true); | 5783 stub1.GetCode(isolate); |
5786 } | 5784 } |
5787 } | 5785 } |
5788 } | 5786 } |
5789 | 5787 |
5790 | 5788 |
5791 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { | 5789 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { |
5792 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( | 5790 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( |
5793 isolate); | 5791 isolate); |
5794 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( | 5792 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( |
5795 isolate); | 5793 isolate); |
5796 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>( | 5794 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>( |
5797 isolate); | 5795 isolate); |
5798 } | 5796 } |
5799 | 5797 |
5800 | 5798 |
5801 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime( | 5799 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime( |
5802 Isolate* isolate) { | 5800 Isolate* isolate) { |
5803 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; | 5801 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; |
5804 for (int i = 0; i < 2; i++) { | 5802 for (int i = 0; i < 2; i++) { |
5805 // For internal arrays we only need a few things | 5803 // For internal arrays we only need a few things |
5806 InternalArrayNoArgumentConstructorStub stubh1(kinds[i]); | 5804 InternalArrayNoArgumentConstructorStub stubh1(kinds[i]); |
5807 stubh1.GetCode(isolate)->set_is_pregenerated(true); | 5805 stubh1.GetCode(isolate); |
5808 InternalArraySingleArgumentConstructorStub stubh2(kinds[i]); | 5806 InternalArraySingleArgumentConstructorStub stubh2(kinds[i]); |
5809 stubh2.GetCode(isolate)->set_is_pregenerated(true); | 5807 stubh2.GetCode(isolate); |
5810 InternalArrayNArgumentsConstructorStub stubh3(kinds[i]); | 5808 InternalArrayNArgumentsConstructorStub stubh3(kinds[i]); |
5811 stubh3.GetCode(isolate)->set_is_pregenerated(true); | 5809 stubh3.GetCode(isolate); |
5812 } | 5810 } |
5813 } | 5811 } |
5814 | 5812 |
5815 | 5813 |
5816 void ArrayConstructorStub::GenerateDispatchToArrayStub( | 5814 void ArrayConstructorStub::GenerateDispatchToArrayStub( |
5817 MacroAssembler* masm, | 5815 MacroAssembler* masm, |
5818 AllocationSiteOverrideMode mode) { | 5816 AllocationSiteOverrideMode mode) { |
5819 if (argument_count_ == ANY) { | 5817 if (argument_count_ == ANY) { |
5820 Label not_zero_case, not_one_case; | 5818 Label not_zero_case, not_one_case; |
5821 __ test(eax, eax); | 5819 __ test(eax, eax); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5983 __ bind(&fast_elements_case); | 5981 __ bind(&fast_elements_case); |
5984 GenerateCase(masm, FAST_ELEMENTS); | 5982 GenerateCase(masm, FAST_ELEMENTS); |
5985 } | 5983 } |
5986 | 5984 |
5987 | 5985 |
5988 #undef __ | 5986 #undef __ |
5989 | 5987 |
5990 } } // namespace v8::internal | 5988 } } // namespace v8::internal |
5991 | 5989 |
5992 #endif // V8_TARGET_ARCH_IA32 | 5990 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |