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 4953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4964 return false; | 4964 return false; |
4965 } | 4965 } |
4966 | 4966 |
4967 | 4967 |
4968 bool CEntryStub::IsPregenerated() { | 4968 bool CEntryStub::IsPregenerated() { |
4969 return (!save_doubles_ || ISOLATE->fp_stubs_generated()) && | 4969 return (!save_doubles_ || ISOLATE->fp_stubs_generated()) && |
4970 result_size_ == 1; | 4970 result_size_ == 1; |
4971 } | 4971 } |
4972 | 4972 |
4973 | 4973 |
4974 void CodeStub::GenerateStubsAheadOfTime() { | 4974 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
4975 CEntryStub::GenerateAheadOfTime(); | 4975 CEntryStub::GenerateAheadOfTime(isolate); |
4976 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(); | 4976 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
4977 // It is important that the store buffer overflow stubs are generated first. | 4977 // It is important that the store buffer overflow stubs are generated first. |
4978 RecordWriteStub::GenerateFixedRegStubsAheadOfTime(); | 4978 RecordWriteStub::GenerateFixedRegStubsAheadOfTime(isolate); |
4979 } | 4979 } |
4980 | 4980 |
4981 | 4981 |
4982 void CodeStub::GenerateFPStubs() { | 4982 void CodeStub::GenerateFPStubs(Isolate* isolate) { |
4983 if (CpuFeatures::IsSupported(SSE2)) { | 4983 if (CpuFeatures::IsSupported(SSE2)) { |
4984 CEntryStub save_doubles(1, kSaveFPRegs); | 4984 CEntryStub save_doubles(1, kSaveFPRegs); |
4985 // Stubs might already be in the snapshot, detect that and don't regenerate, | 4985 // Stubs might already be in the snapshot, detect that and don't regenerate, |
4986 // which would lead to code stub initialization state being messed up. | 4986 // which would lead to code stub initialization state being messed up. |
4987 Code* save_doubles_code; | 4987 Code* save_doubles_code; |
4988 if (!save_doubles.FindCodeInCache(&save_doubles_code, ISOLATE)) { | 4988 if (!save_doubles.FindCodeInCache(&save_doubles_code, isolate)) { |
4989 save_doubles_code = *(save_doubles.GetCode()); | 4989 save_doubles_code = *(save_doubles.GetCode(isolate)); |
4990 } | 4990 } |
4991 save_doubles_code->set_is_pregenerated(true); | 4991 save_doubles_code->set_is_pregenerated(true); |
4992 save_doubles_code->GetIsolate()->set_fp_stubs_generated(true); | 4992 isolate->set_fp_stubs_generated(true); |
4993 } | 4993 } |
4994 } | 4994 } |
4995 | 4995 |
4996 | 4996 |
4997 void CEntryStub::GenerateAheadOfTime() { | 4997 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { |
4998 CEntryStub stub(1, kDontSaveFPRegs); | 4998 CEntryStub stub(1, kDontSaveFPRegs); |
4999 Handle<Code> code = stub.GetCode(); | 4999 Handle<Code> code = stub.GetCode(isolate); |
5000 code->set_is_pregenerated(true); | 5000 code->set_is_pregenerated(true); |
5001 } | 5001 } |
5002 | 5002 |
5003 | 5003 |
5004 static void JumpIfOOM(MacroAssembler* masm, | 5004 static void JumpIfOOM(MacroAssembler* masm, |
5005 Register value, | 5005 Register value, |
5006 Register scratch, | 5006 Register scratch, |
5007 Label* oom_label) { | 5007 Label* oom_label) { |
5008 __ mov(scratch, value); | 5008 __ mov(scratch, value); |
5009 STATIC_ASSERT(Failure::OUT_OF_MEMORY_EXCEPTION == 3); | 5009 STATIC_ASSERT(Failure::OUT_OF_MEMORY_EXCEPTION == 3); |
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6810 __ j(not_equal, &maybe_undefined1, Label::kNear); | 6810 __ j(not_equal, &maybe_undefined1, Label::kNear); |
6811 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), | 6811 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), |
6812 masm->isolate()->factory()->heap_number_map()); | 6812 masm->isolate()->factory()->heap_number_map()); |
6813 __ j(not_equal, &maybe_undefined2, Label::kNear); | 6813 __ j(not_equal, &maybe_undefined2, Label::kNear); |
6814 } | 6814 } |
6815 | 6815 |
6816 __ bind(&unordered); | 6816 __ bind(&unordered); |
6817 __ bind(&generic_stub); | 6817 __ bind(&generic_stub); |
6818 ICCompareStub stub(op_, CompareIC::GENERIC, CompareIC::GENERIC, | 6818 ICCompareStub stub(op_, CompareIC::GENERIC, CompareIC::GENERIC, |
6819 CompareIC::GENERIC); | 6819 CompareIC::GENERIC); |
6820 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); | 6820 __ jmp(stub.GetCode(masm->isolate()), RelocInfo::CODE_TARGET); |
6821 | 6821 |
6822 __ bind(&maybe_undefined1); | 6822 __ bind(&maybe_undefined1); |
6823 if (Token::IsOrderedRelationalCompareOp(op_)) { | 6823 if (Token::IsOrderedRelationalCompareOp(op_)) { |
6824 __ cmp(eax, Immediate(masm->isolate()->factory()->undefined_value())); | 6824 __ cmp(eax, Immediate(masm->isolate()->factory()->undefined_value())); |
6825 __ j(not_equal, &miss); | 6825 __ j(not_equal, &miss); |
6826 __ JumpIfSmi(edx, &unordered); | 6826 __ JumpIfSmi(edx, &unordered); |
6827 __ CmpObjectType(edx, HEAP_NUMBER_TYPE, ecx); | 6827 __ CmpObjectType(edx, HEAP_NUMBER_TYPE, ecx); |
6828 __ j(not_equal, &maybe_undefined2, Label::kNear); | 6828 __ j(not_equal, &maybe_undefined2, Label::kNear); |
6829 __ jmp(&unordered); | 6829 __ jmp(&unordered); |
6830 } | 6830 } |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7315 address_.is(entry->address) && | 7315 address_.is(entry->address) && |
7316 remembered_set_action_ == entry->action && | 7316 remembered_set_action_ == entry->action && |
7317 save_fp_regs_mode_ == kDontSaveFPRegs) { | 7317 save_fp_regs_mode_ == kDontSaveFPRegs) { |
7318 return true; | 7318 return true; |
7319 } | 7319 } |
7320 } | 7320 } |
7321 return false; | 7321 return false; |
7322 } | 7322 } |
7323 | 7323 |
7324 | 7324 |
7325 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime() { | 7325 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime( |
| 7326 Isolate* isolate) { |
7326 StoreBufferOverflowStub stub1(kDontSaveFPRegs); | 7327 StoreBufferOverflowStub stub1(kDontSaveFPRegs); |
7327 stub1.GetCode()->set_is_pregenerated(true); | 7328 stub1.GetCode(isolate)->set_is_pregenerated(true); |
7328 | 7329 |
7329 CpuFeatures::TryForceFeatureScope scope(SSE2); | 7330 CpuFeatures::TryForceFeatureScope scope(SSE2); |
7330 if (CpuFeatures::IsSupported(SSE2)) { | 7331 if (CpuFeatures::IsSupported(SSE2)) { |
7331 StoreBufferOverflowStub stub2(kSaveFPRegs); | 7332 StoreBufferOverflowStub stub2(kSaveFPRegs); |
7332 stub2.GetCode()->set_is_pregenerated(true); | 7333 stub2.GetCode(isolate)->set_is_pregenerated(true); |
7333 } | 7334 } |
7334 } | 7335 } |
7335 | 7336 |
7336 | 7337 |
7337 void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() { | 7338 void RecordWriteStub::GenerateFixedRegStubsAheadOfTime(Isolate* isolate) { |
7338 for (const AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; | 7339 for (const AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; |
7339 !entry->object.is(no_reg); | 7340 !entry->object.is(no_reg); |
7340 entry++) { | 7341 entry++) { |
7341 RecordWriteStub stub(entry->object, | 7342 RecordWriteStub stub(entry->object, |
7342 entry->value, | 7343 entry->value, |
7343 entry->address, | 7344 entry->address, |
7344 entry->action, | 7345 entry->action, |
7345 kDontSaveFPRegs); | 7346 kDontSaveFPRegs); |
7346 stub.GetCode()->set_is_pregenerated(true); | 7347 stub.GetCode(isolate)->set_is_pregenerated(true); |
7347 } | 7348 } |
7348 } | 7349 } |
7349 | 7350 |
7350 | 7351 |
7351 bool CodeStub::CanUseFPRegisters() { | 7352 bool CodeStub::CanUseFPRegisters() { |
7352 return CpuFeatures::IsSupported(SSE2); | 7353 return CpuFeatures::IsSupported(SSE2); |
7353 } | 7354 } |
7354 | 7355 |
7355 | 7356 |
7356 // Takes the input in 3 registers: address_ value_ and object_. A pointer to | 7357 // Takes the input in 3 registers: address_ value_ and object_. A pointer to |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7632 false); | 7633 false); |
7633 __ pop(edx); | 7634 __ pop(edx); |
7634 __ ret(0); | 7635 __ ret(0); |
7635 } | 7636 } |
7636 | 7637 |
7637 | 7638 |
7638 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 7639 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
7639 ASSERT(!Serializer::enabled()); | 7640 ASSERT(!Serializer::enabled()); |
7640 bool save_fp_regs = CpuFeatures::IsSupported(SSE2); | 7641 bool save_fp_regs = CpuFeatures::IsSupported(SSE2); |
7641 CEntryStub ces(1, save_fp_regs ? kSaveFPRegs : kDontSaveFPRegs); | 7642 CEntryStub ces(1, save_fp_regs ? kSaveFPRegs : kDontSaveFPRegs); |
7642 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); | 7643 __ call(ces.GetCode(masm->isolate()), RelocInfo::CODE_TARGET); |
7643 int parameter_count_offset = | 7644 int parameter_count_offset = |
7644 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 7645 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
7645 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); | 7646 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); |
7646 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 7647 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
7647 __ pop(ecx); | 7648 __ pop(ecx); |
7648 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, | 7649 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, |
7649 extra_expression_stack_count_ * kPointerSize)); | 7650 extra_expression_stack_count_ * kPointerSize)); |
7650 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. | 7651 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. |
7651 } | 7652 } |
7652 | 7653 |
(...skipping 27 matching lines...) Expand all Loading... |
7680 // Restore ecx. | 7681 // Restore ecx. |
7681 __ pop(ecx); | 7682 __ pop(ecx); |
7682 __ ret(0); | 7683 __ ret(0); |
7683 } | 7684 } |
7684 | 7685 |
7685 #undef __ | 7686 #undef __ |
7686 | 7687 |
7687 } } // namespace v8::internal | 7688 } } // namespace v8::internal |
7688 | 7689 |
7689 #endif // V8_TARGET_ARCH_IA32 | 7690 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |