| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2048 ASSERT(ToRegister(instr->result()).is(eax)); | 2048 ASSERT(ToRegister(instr->result()).is(eax)); |
| 2049 | 2049 |
| 2050 __ mov(ecx, instr->name()); | 2050 __ mov(ecx, instr->name()); |
| 2051 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : | 2051 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : |
| 2052 RelocInfo::CODE_TARGET_CONTEXT; | 2052 RelocInfo::CODE_TARGET_CONTEXT; |
| 2053 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2053 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2054 CallCode(ic, mode, instr); | 2054 CallCode(ic, mode, instr); |
| 2055 } | 2055 } |
| 2056 | 2056 |
| 2057 | 2057 |
| 2058 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { | 2058 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
| 2059 Register value = ToRegister(instr->InputAt(0)); | 2059 Register value = ToRegister(instr->InputAt(0)); |
| 2060 Operand cell_operand = Operand::Cell(instr->hydrogen()->cell()); | 2060 Operand cell_operand = Operand::Cell(instr->hydrogen()->cell()); |
| 2061 | 2061 |
| 2062 // If the cell we are storing to contains the hole it could have | 2062 // If the cell we are storing to contains the hole it could have |
| 2063 // been deleted from the property dictionary. In that case, we need | 2063 // been deleted from the property dictionary. In that case, we need |
| 2064 // to update the property details in the property dictionary to mark | 2064 // to update the property details in the property dictionary to mark |
| 2065 // it as no longer deleted. We deoptimize in that case. | 2065 // it as no longer deleted. We deoptimize in that case. |
| 2066 if (instr->hydrogen()->check_hole_value()) { | 2066 if (instr->hydrogen()->check_hole_value()) { |
| 2067 __ cmp(cell_operand, factory()->the_hole_value()); | 2067 __ cmp(cell_operand, factory()->the_hole_value()); |
| 2068 DeoptimizeIf(equal, instr->environment()); | 2068 DeoptimizeIf(equal, instr->environment()); |
| 2069 } | 2069 } |
| 2070 | 2070 |
| 2071 // Store the value. | 2071 // Store the value. |
| 2072 __ mov(cell_operand, value); | 2072 __ mov(cell_operand, value); |
| 2073 } | 2073 } |
| 2074 | 2074 |
| 2075 | 2075 |
| 2076 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
| 2077 ASSERT(ToRegister(instr->context()).is(esi)); |
| 2078 ASSERT(ToRegister(instr->global_object()).is(edx)); |
| 2079 ASSERT(ToRegister(instr->value()).is(eax)); |
| 2080 |
| 2081 __ mov(ecx, instr->name()); |
| 2082 Handle<Code> ic = isolate()->builtins()->StoreIC_Initialize(); |
| 2083 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
| 2084 } |
| 2085 |
| 2086 |
| 2076 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2087 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 2077 Register context = ToRegister(instr->context()); | 2088 Register context = ToRegister(instr->context()); |
| 2078 Register result = ToRegister(instr->result()); | 2089 Register result = ToRegister(instr->result()); |
| 2079 __ mov(result, ContextOperand(context, instr->slot_index())); | 2090 __ mov(result, ContextOperand(context, instr->slot_index())); |
| 2080 } | 2091 } |
| 2081 | 2092 |
| 2082 | 2093 |
| 2083 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2094 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
| 2084 Register context = ToRegister(instr->context()); | 2095 Register context = ToRegister(instr->context()); |
| 2085 Register value = ToRegister(instr->value()); | 2096 Register value = ToRegister(instr->value()); |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2769 // Return value is in st(0) on ia32. | 2780 // Return value is in st(0) on ia32. |
| 2770 // Store it into the (fixed) result register. | 2781 // Store it into the (fixed) result register. |
| 2771 __ sub(Operand(esp), Immediate(kDoubleSize)); | 2782 __ sub(Operand(esp), Immediate(kDoubleSize)); |
| 2772 __ fstp_d(Operand(esp, 0)); | 2783 __ fstp_d(Operand(esp, 0)); |
| 2773 __ movdbl(result_reg, Operand(esp, 0)); | 2784 __ movdbl(result_reg, Operand(esp, 0)); |
| 2774 __ add(Operand(esp), Immediate(kDoubleSize)); | 2785 __ add(Operand(esp), Immediate(kDoubleSize)); |
| 2775 } | 2786 } |
| 2776 | 2787 |
| 2777 | 2788 |
| 2778 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { | 2789 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
| 2779 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 2790 ASSERT(instr->InputAt(0)->Equals(instr->result())); |
| 2780 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 2791 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
| 2781 TranscendentalCacheStub::UNTAGGED); | 2792 NearLabel positive, done, zero, negative; |
| 2782 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false); | 2793 __ xorpd(xmm0, xmm0); |
| 2794 __ ucomisd(input_reg, xmm0); |
| 2795 __ j(above, &positive); |
| 2796 __ j(equal, &zero); |
| 2797 ExternalReference nan = ExternalReference::address_of_nan(); |
| 2798 __ movdbl(input_reg, Operand::StaticVariable(nan)); |
| 2799 __ jmp(&done); |
| 2800 __ bind(&zero); |
| 2801 __ push(Immediate(0xFFF00000)); |
| 2802 __ push(Immediate(0)); |
| 2803 __ movdbl(input_reg, Operand(esp, 0)); |
| 2804 __ add(Operand(esp), Immediate(kDoubleSize)); |
| 2805 __ jmp(&done); |
| 2806 __ bind(&positive); |
| 2807 __ fldln2(); |
| 2808 __ sub(Operand(esp), Immediate(kDoubleSize)); |
| 2809 __ movdbl(Operand(esp, 0), input_reg); |
| 2810 __ fld_d(Operand(esp, 0)); |
| 2811 __ fyl2x(); |
| 2812 __ fstp_d(Operand(esp, 0)); |
| 2813 __ movdbl(input_reg, Operand(esp, 0)); |
| 2814 __ add(Operand(esp), Immediate(kDoubleSize)); |
| 2815 __ bind(&done); |
| 2783 } | 2816 } |
| 2784 | 2817 |
| 2785 | 2818 |
| 2786 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { | 2819 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { |
| 2787 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 2820 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| 2788 TranscendentalCacheStub stub(TranscendentalCache::COS, | 2821 TranscendentalCacheStub stub(TranscendentalCache::COS, |
| 2789 TranscendentalCacheStub::UNTAGGED); | 2822 TranscendentalCacheStub::UNTAGGED); |
| 2790 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false); | 2823 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false); |
| 2791 } | 2824 } |
| 2792 | 2825 |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4116 ASSERT(osr_pc_offset_ == -1); | 4149 ASSERT(osr_pc_offset_ == -1); |
| 4117 osr_pc_offset_ = masm()->pc_offset(); | 4150 osr_pc_offset_ = masm()->pc_offset(); |
| 4118 } | 4151 } |
| 4119 | 4152 |
| 4120 | 4153 |
| 4121 #undef __ | 4154 #undef __ |
| 4122 | 4155 |
| 4123 } } // namespace v8::internal | 4156 } } // namespace v8::internal |
| 4124 | 4157 |
| 4125 #endif // V8_TARGET_ARCH_IA32 | 4158 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |