| 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 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 // its slot of the pushing of safepoint registers is used to communicate the | 1829 // its slot of the pushing of safepoint registers is used to communicate the |
| 1830 // offset to the location of the map check. | 1830 // offset to the location of the map check. |
| 1831 Register temp = ToRegister(instr->TempAt(0)); | 1831 Register temp = ToRegister(instr->TempAt(0)); |
| 1832 ASSERT(temp.is(edi)); | 1832 ASSERT(temp.is(edi)); |
| 1833 __ mov(InstanceofStub::right(), Immediate(instr->function())); | 1833 __ mov(InstanceofStub::right(), Immediate(instr->function())); |
| 1834 static const int kAdditionalDelta = 16; | 1834 static const int kAdditionalDelta = 16; |
| 1835 int delta = masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta; | 1835 int delta = masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta; |
| 1836 Label before_push_delta; | 1836 Label before_push_delta; |
| 1837 __ bind(&before_push_delta); | 1837 __ bind(&before_push_delta); |
| 1838 __ mov(temp, Immediate(delta)); | 1838 __ mov(temp, Immediate(delta)); |
| 1839 __ mov(Operand(esp, EspIndexForPushAll(temp) * kPointerSize), temp); | 1839 __ StoreToSafepointRegisterSlot(temp, temp); |
| 1840 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 1840 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 1841 __ call(stub.GetCode(), RelocInfo::CODE_TARGET); | 1841 __ call(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 1842 ASSERT_EQ(kAdditionalDelta, | 1842 ASSERT_EQ(kAdditionalDelta, |
| 1843 masm_->SizeOfCodeGeneratedSince(&before_push_delta)); | 1843 masm_->SizeOfCodeGeneratedSince(&before_push_delta)); |
| 1844 RecordSafepointWithRegisters( | 1844 RecordSafepointWithRegisters( |
| 1845 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); | 1845 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); |
| 1846 // Put the result value into the eax slot and restore all registers. | 1846 // Put the result value into the eax slot and restore all registers. |
| 1847 __ mov(Operand(esp, EspIndexForPushAll(eax) * kPointerSize), eax); | 1847 __ StoreToSafepointRegisterSlot(eax, eax); |
| 1848 | |
| 1849 __ PopSafepointRegisters(); | 1848 __ PopSafepointRegisters(); |
| 1850 } | 1849 } |
| 1851 | 1850 |
| 1852 | 1851 |
| 1853 static Condition ComputeCompareCondition(Token::Value op) { | 1852 static Condition ComputeCompareCondition(Token::Value op) { |
| 1854 switch (op) { | 1853 switch (op) { |
| 1855 case Token::EQ_STRICT: | 1854 case Token::EQ_STRICT: |
| 1856 case Token::EQ: | 1855 case Token::EQ: |
| 1857 return equal; | 1856 return equal; |
| 1858 case Token::LT: | 1857 case Token::LT: |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2353 __ bind(&slow); | 2352 __ bind(&slow); |
| 2354 | 2353 |
| 2355 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2354 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2356 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 2355 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
| 2357 RecordSafepointWithRegisters( | 2356 RecordSafepointWithRegisters( |
| 2358 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); | 2357 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); |
| 2359 // Set the pointer to the new heap number in tmp. | 2358 // Set the pointer to the new heap number in tmp. |
| 2360 if (!tmp.is(eax)) __ mov(tmp, eax); | 2359 if (!tmp.is(eax)) __ mov(tmp, eax); |
| 2361 | 2360 |
| 2362 // Restore input_reg after call to runtime. | 2361 // Restore input_reg after call to runtime. |
| 2363 __ mov(input_reg, Operand(esp, EspIndexForPushAll(input_reg) * kPointerSize)); | 2362 __ LoadFromSafepointRegisterSlot(input_reg, input_reg); |
| 2364 | 2363 |
| 2365 __ bind(&allocated); | 2364 __ bind(&allocated); |
| 2366 __ mov(tmp2, FieldOperand(input_reg, HeapNumber::kExponentOffset)); | 2365 __ mov(tmp2, FieldOperand(input_reg, HeapNumber::kExponentOffset)); |
| 2367 __ and_(tmp2, ~HeapNumber::kSignMask); | 2366 __ and_(tmp2, ~HeapNumber::kSignMask); |
| 2368 __ mov(FieldOperand(tmp, HeapNumber::kExponentOffset), tmp2); | 2367 __ mov(FieldOperand(tmp, HeapNumber::kExponentOffset), tmp2); |
| 2369 __ mov(tmp2, FieldOperand(input_reg, HeapNumber::kMantissaOffset)); | 2368 __ mov(tmp2, FieldOperand(input_reg, HeapNumber::kMantissaOffset)); |
| 2370 __ mov(FieldOperand(tmp, HeapNumber::kMantissaOffset), tmp2); | 2369 __ mov(FieldOperand(tmp, HeapNumber::kMantissaOffset), tmp2); |
| 2371 __ mov(Operand(esp, EspIndexForPushAll(input_reg) * kPointerSize), tmp); | 2370 __ StoreToSafepointRegisterSlot(input_reg, tmp); |
| 2372 | 2371 |
| 2373 __ bind(&done); | 2372 __ bind(&done); |
| 2374 __ PopSafepointRegisters(); | 2373 __ PopSafepointRegisters(); |
| 2375 } | 2374 } |
| 2376 | 2375 |
| 2377 | 2376 |
| 2378 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) { | 2377 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) { |
| 2379 Register input_reg = ToRegister(instr->InputAt(0)); | 2378 Register input_reg = ToRegister(instr->InputAt(0)); |
| 2380 __ test(input_reg, Operand(input_reg)); | 2379 __ test(input_reg, Operand(input_reg)); |
| 2381 Label is_positive; | 2380 Label is_positive; |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2916 __ push(index); | 2915 __ push(index); |
| 2917 } | 2916 } |
| 2918 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2917 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2919 __ CallRuntimeSaveDoubles(Runtime::kStringCharCodeAt); | 2918 __ CallRuntimeSaveDoubles(Runtime::kStringCharCodeAt); |
| 2920 RecordSafepointWithRegisters( | 2919 RecordSafepointWithRegisters( |
| 2921 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); | 2920 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); |
| 2922 if (FLAG_debug_code) { | 2921 if (FLAG_debug_code) { |
| 2923 __ AbortIfNotSmi(eax); | 2922 __ AbortIfNotSmi(eax); |
| 2924 } | 2923 } |
| 2925 __ SmiUntag(eax); | 2924 __ SmiUntag(eax); |
| 2926 __ mov(Operand(esp, EspIndexForPushAll(result) * kPointerSize), eax); | 2925 __ StoreToSafepointRegisterSlot(result, eax); |
| 2927 __ PopSafepointRegisters(); | 2926 __ PopSafepointRegisters(); |
| 2928 } | 2927 } |
| 2929 | 2928 |
| 2930 | 2929 |
| 2931 void LCodeGen::DoStringLength(LStringLength* instr) { | 2930 void LCodeGen::DoStringLength(LStringLength* instr) { |
| 2932 Register string = ToRegister(instr->string()); | 2931 Register string = ToRegister(instr->string()); |
| 2933 Register result = ToRegister(instr->result()); | 2932 Register result = ToRegister(instr->result()); |
| 2934 __ mov(result, FieldOperand(string, String::kLengthOffset)); | 2933 __ mov(result, FieldOperand(string, String::kLengthOffset)); |
| 2935 } | 2934 } |
| 2936 | 2935 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2984 __ AllocateHeapNumber(reg, tmp, no_reg, &slow); | 2983 __ AllocateHeapNumber(reg, tmp, no_reg, &slow); |
| 2985 __ jmp(&done); | 2984 __ jmp(&done); |
| 2986 } | 2985 } |
| 2987 | 2986 |
| 2988 // Slow case: Call the runtime system to do the number allocation. | 2987 // Slow case: Call the runtime system to do the number allocation. |
| 2989 __ bind(&slow); | 2988 __ bind(&slow); |
| 2990 | 2989 |
| 2991 // TODO(3095996): Put a valid pointer value in the stack slot where the result | 2990 // TODO(3095996): Put a valid pointer value in the stack slot where the result |
| 2992 // register is stored, as this register is in the pointer map, but contains an | 2991 // register is stored, as this register is in the pointer map, but contains an |
| 2993 // integer value. | 2992 // integer value. |
| 2994 __ mov(Operand(esp, EspIndexForPushAll(reg) * kPointerSize), Immediate(0)); | 2993 __ StoreToSafepointRegisterSlot(reg, Immediate(0)); |
| 2995 | 2994 |
| 2996 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2995 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2997 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 2996 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
| 2998 RecordSafepointWithRegisters( | 2997 RecordSafepointWithRegisters( |
| 2999 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); | 2998 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); |
| 3000 if (!reg.is(eax)) __ mov(reg, eax); | 2999 if (!reg.is(eax)) __ mov(reg, eax); |
| 3001 | 3000 |
| 3002 // Done. Put the value in xmm0 into the value of the allocated heap | 3001 // Done. Put the value in xmm0 into the value of the allocated heap |
| 3003 // number. | 3002 // number. |
| 3004 __ bind(&done); | 3003 __ bind(&done); |
| 3005 __ movdbl(FieldOperand(reg, HeapNumber::kValueOffset), xmm0); | 3004 __ movdbl(FieldOperand(reg, HeapNumber::kValueOffset), xmm0); |
| 3006 __ mov(Operand(esp, EspIndexForPushAll(reg) * kPointerSize), reg); | 3005 __ StoreToSafepointRegisterSlot(reg, reg); |
| 3007 __ PopSafepointRegisters(); | 3006 __ PopSafepointRegisters(); |
| 3008 } | 3007 } |
| 3009 | 3008 |
| 3010 | 3009 |
| 3011 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 3010 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
| 3012 class DeferredNumberTagD: public LDeferredCode { | 3011 class DeferredNumberTagD: public LDeferredCode { |
| 3013 public: | 3012 public: |
| 3014 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 3013 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
| 3015 : LDeferredCode(codegen), instr_(instr) { } | 3014 : LDeferredCode(codegen), instr_(instr) { } |
| 3016 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } | 3015 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3038 // result register contain a valid pointer because it is already | 3037 // result register contain a valid pointer because it is already |
| 3039 // contained in the register pointer map. | 3038 // contained in the register pointer map. |
| 3040 Register reg = ToRegister(instr->result()); | 3039 Register reg = ToRegister(instr->result()); |
| 3041 __ Set(reg, Immediate(0)); | 3040 __ Set(reg, Immediate(0)); |
| 3042 | 3041 |
| 3043 __ PushSafepointRegisters(); | 3042 __ PushSafepointRegisters(); |
| 3044 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3043 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 3045 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 3044 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
| 3046 RecordSafepointWithRegisters( | 3045 RecordSafepointWithRegisters( |
| 3047 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); | 3046 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); |
| 3048 __ mov(Operand(esp, EspIndexForPushAll(reg) * kPointerSize), eax); | 3047 __ StoreToSafepointRegisterSlot(reg, eax); |
| 3049 __ PopSafepointRegisters(); | 3048 __ PopSafepointRegisters(); |
| 3050 } | 3049 } |
| 3051 | 3050 |
| 3052 | 3051 |
| 3053 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 3052 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
| 3054 LOperand* input = instr->InputAt(0); | 3053 LOperand* input = instr->InputAt(0); |
| 3055 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 3054 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
| 3056 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); | 3055 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); |
| 3057 __ SmiTag(ToRegister(input)); | 3056 __ SmiTag(ToRegister(input)); |
| 3058 } | 3057 } |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3800 ASSERT(osr_pc_offset_ == -1); | 3799 ASSERT(osr_pc_offset_ == -1); |
| 3801 osr_pc_offset_ = masm()->pc_offset(); | 3800 osr_pc_offset_ = masm()->pc_offset(); |
| 3802 } | 3801 } |
| 3803 | 3802 |
| 3804 | 3803 |
| 3805 #undef __ | 3804 #undef __ |
| 3806 | 3805 |
| 3807 } } // namespace v8::internal | 3806 } } // namespace v8::internal |
| 3808 | 3807 |
| 3809 #endif // V8_TARGET_ARCH_IA32 | 3808 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |