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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 ASSERT(!left.is(r0) && !right.is(r0)); | 919 ASSERT(!left.is(r0) && !right.is(r0)); |
920 __ mov(r0, right); | 920 __ mov(r0, right); |
921 __ mov(r1, left); | 921 __ mov(r1, left); |
922 } | 922 } |
923 TypeRecordingBinaryOpStub stub(op, OVERWRITE_LEFT); | 923 TypeRecordingBinaryOpStub stub(op, OVERWRITE_LEFT); |
924 __ CallStub(&stub); | 924 __ CallStub(&stub); |
925 RecordSafepointWithRegistersAndDoubles(instr->pointer_map(), | 925 RecordSafepointWithRegistersAndDoubles(instr->pointer_map(), |
926 0, | 926 0, |
927 Safepoint::kNoDeoptimizationIndex); | 927 Safepoint::kNoDeoptimizationIndex); |
928 // Overwrite the stored value of r0 with the result of the stub. | 928 // Overwrite the stored value of r0 with the result of the stub. |
929 __ StoreToSafepointRegistersAndDoublesSlot(r0); | 929 __ StoreToSafepointRegistersAndDoublesSlot(r0, r0); |
930 __ PopSafepointRegistersAndDoubles(); | 930 __ PopSafepointRegistersAndDoubles(); |
931 } | 931 } |
932 | 932 |
933 | 933 |
934 void LCodeGen::DoMulI(LMulI* instr) { | 934 void LCodeGen::DoMulI(LMulI* instr) { |
935 Register scratch = scratch0(); | 935 Register scratch = scratch0(); |
936 Register left = ToRegister(instr->InputAt(0)); | 936 Register left = ToRegister(instr->InputAt(0)); |
937 Register right = EmitLoadRegister(instr->InputAt(1), scratch); | 937 Register right = EmitLoadRegister(instr->InputAt(1), scratch); |
938 | 938 |
939 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero) && | 939 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero) && |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 // offset to the location of the map check. | 1933 // offset to the location of the map check. |
1934 Register temp = ToRegister(instr->TempAt(0)); | 1934 Register temp = ToRegister(instr->TempAt(0)); |
1935 ASSERT(temp.is(r4)); | 1935 ASSERT(temp.is(r4)); |
1936 __ mov(InstanceofStub::right(), Operand(instr->function())); | 1936 __ mov(InstanceofStub::right(), Operand(instr->function())); |
1937 static const int kAdditionalDelta = 4; | 1937 static const int kAdditionalDelta = 4; |
1938 int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta; | 1938 int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta; |
1939 Label before_push_delta; | 1939 Label before_push_delta; |
1940 __ bind(&before_push_delta); | 1940 __ bind(&before_push_delta); |
1941 __ BlockConstPoolFor(kAdditionalDelta); | 1941 __ BlockConstPoolFor(kAdditionalDelta); |
1942 __ mov(temp, Operand(delta * kPointerSize)); | 1942 __ mov(temp, Operand(delta * kPointerSize)); |
1943 __ StoreToSafepointRegisterSlot(temp); | 1943 __ StoreToSafepointRegisterSlot(temp, temp); |
1944 __ Call(stub.GetCode(), RelocInfo::CODE_TARGET); | 1944 __ Call(stub.GetCode(), RelocInfo::CODE_TARGET); |
1945 ASSERT_EQ(kAdditionalDelta, | 1945 ASSERT_EQ(kAdditionalDelta, |
1946 masm_->InstructionsGeneratedSince(&before_push_delta)); | 1946 masm_->InstructionsGeneratedSince(&before_push_delta)); |
1947 RecordSafepointWithRegisters( | 1947 RecordSafepointWithRegisters( |
1948 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); | 1948 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); |
1949 // Put the result value into the result register slot and | 1949 // Put the result value into the result register slot and |
1950 // restore all registers. | 1950 // restore all registers. |
1951 __ StoreToSafepointRegisterSlot(result); | 1951 __ StoreToSafepointRegisterSlot(result, result); |
1952 | 1952 |
1953 __ PopSafepointRegisters(); | 1953 __ PopSafepointRegisters(); |
1954 } | 1954 } |
1955 | 1955 |
1956 | 1956 |
1957 static Condition ComputeCompareCondition(Token::Value op) { | 1957 static Condition ComputeCompareCondition(Token::Value op) { |
1958 switch (op) { | 1958 switch (op) { |
1959 case Token::EQ_STRICT: | 1959 case Token::EQ_STRICT: |
1960 case Token::EQ: | 1960 case Token::EQ: |
1961 return eq; | 1961 return eq; |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2474 | 2474 |
2475 // Slow case: Call the runtime system to do the number allocation. | 2475 // Slow case: Call the runtime system to do the number allocation. |
2476 __ bind(&slow); | 2476 __ bind(&slow); |
2477 | 2477 |
2478 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 2478 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
2479 RecordSafepointWithRegisters( | 2479 RecordSafepointWithRegisters( |
2480 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); | 2480 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); |
2481 // Set the pointer to the new heap number in tmp. | 2481 // Set the pointer to the new heap number in tmp. |
2482 if (!tmp1.is(r0)) __ mov(tmp1, Operand(r0)); | 2482 if (!tmp1.is(r0)) __ mov(tmp1, Operand(r0)); |
2483 // Restore input_reg after call to runtime. | 2483 // Restore input_reg after call to runtime. |
2484 __ LoadFromSafepointRegisterSlot(input); | 2484 __ LoadFromSafepointRegisterSlot(input, input); |
2485 __ ldr(exponent, FieldMemOperand(input, HeapNumber::kExponentOffset)); | 2485 __ ldr(exponent, FieldMemOperand(input, HeapNumber::kExponentOffset)); |
2486 | 2486 |
2487 __ bind(&allocated); | 2487 __ bind(&allocated); |
2488 // exponent: floating point exponent value. | 2488 // exponent: floating point exponent value. |
2489 // tmp1: allocated heap number. | 2489 // tmp1: allocated heap number. |
2490 __ bic(exponent, exponent, Operand(HeapNumber::kSignMask)); | 2490 __ bic(exponent, exponent, Operand(HeapNumber::kSignMask)); |
2491 __ str(exponent, FieldMemOperand(tmp1, HeapNumber::kExponentOffset)); | 2491 __ str(exponent, FieldMemOperand(tmp1, HeapNumber::kExponentOffset)); |
2492 __ ldr(tmp2, FieldMemOperand(input, HeapNumber::kMantissaOffset)); | 2492 __ ldr(tmp2, FieldMemOperand(input, HeapNumber::kMantissaOffset)); |
2493 __ str(tmp2, FieldMemOperand(tmp1, HeapNumber::kMantissaOffset)); | 2493 __ str(tmp2, FieldMemOperand(tmp1, HeapNumber::kMantissaOffset)); |
2494 | 2494 |
2495 __ str(tmp1, masm()->SafepointRegisterSlot(input)); | 2495 __ StoreToSafepointRegisterSlot(tmp1, input); |
2496 __ PopSafepointRegisters(); | 2496 __ PopSafepointRegisters(); |
2497 | 2497 |
2498 __ bind(&done); | 2498 __ bind(&done); |
2499 } | 2499 } |
2500 | 2500 |
2501 | 2501 |
2502 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) { | 2502 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) { |
2503 Register input = ToRegister(instr->InputAt(0)); | 2503 Register input = ToRegister(instr->InputAt(0)); |
2504 __ cmp(input, Operand(0)); | 2504 __ cmp(input, Operand(0)); |
2505 // We can make rsb conditional because the previous cmp instruction | 2505 // We can make rsb conditional because the previous cmp instruction |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2916 __ SmiTag(index); | 2916 __ SmiTag(index); |
2917 __ push(index); | 2917 __ push(index); |
2918 } | 2918 } |
2919 __ CallRuntimeSaveDoubles(Runtime::kStringCharCodeAt); | 2919 __ CallRuntimeSaveDoubles(Runtime::kStringCharCodeAt); |
2920 RecordSafepointWithRegisters( | 2920 RecordSafepointWithRegisters( |
2921 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); | 2921 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); |
2922 if (FLAG_debug_code) { | 2922 if (FLAG_debug_code) { |
2923 __ AbortIfNotSmi(r0); | 2923 __ AbortIfNotSmi(r0); |
2924 } | 2924 } |
2925 __ SmiUntag(r0); | 2925 __ SmiUntag(r0); |
2926 MemOperand result_stack_slot = masm()->SafepointRegisterSlot(result); | 2926 __ StoreToSafepointRegisterSlot(r0, result); |
2927 __ str(r0, result_stack_slot); | |
2928 __ PopSafepointRegisters(); | 2927 __ PopSafepointRegisters(); |
2929 } | 2928 } |
2930 | 2929 |
2931 | 2930 |
2932 void LCodeGen::DoStringLength(LStringLength* instr) { | 2931 void LCodeGen::DoStringLength(LStringLength* instr) { |
2933 Register string = ToRegister(instr->InputAt(0)); | 2932 Register string = ToRegister(instr->InputAt(0)); |
2934 Register result = ToRegister(instr->result()); | 2933 Register result = ToRegister(instr->result()); |
2935 __ ldr(result, FieldMemOperand(string, String::kLengthOffset)); | 2934 __ ldr(result, FieldMemOperand(string, String::kLengthOffset)); |
2936 } | 2935 } |
2937 | 2936 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2998 __ b(&done); | 2997 __ b(&done); |
2999 } | 2998 } |
3000 | 2999 |
3001 // Slow case: Call the runtime system to do the number allocation. | 3000 // Slow case: Call the runtime system to do the number allocation. |
3002 __ bind(&slow); | 3001 __ bind(&slow); |
3003 | 3002 |
3004 // TODO(3095996): Put a valid pointer value in the stack slot where the result | 3003 // TODO(3095996): Put a valid pointer value in the stack slot where the result |
3005 // register is stored, as this register is in the pointer map, but contains an | 3004 // register is stored, as this register is in the pointer map, but contains an |
3006 // integer value. | 3005 // integer value. |
3007 __ mov(ip, Operand(0)); | 3006 __ mov(ip, Operand(0)); |
3008 int reg_stack_index = __ SafepointRegisterStackIndex(reg.code()); | 3007 __ StoreToSafepointRegisterSlot(ip, reg); |
3009 __ str(ip, MemOperand(sp, reg_stack_index * kPointerSize)); | |
3010 | |
3011 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 3008 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
3012 RecordSafepointWithRegisters( | 3009 RecordSafepointWithRegisters( |
3013 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); | 3010 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); |
3014 if (!reg.is(r0)) __ mov(reg, r0); | 3011 if (!reg.is(r0)) __ mov(reg, r0); |
3015 | 3012 |
3016 // Done. Put the value in dbl_scratch into the value of the allocated heap | 3013 // Done. Put the value in dbl_scratch into the value of the allocated heap |
3017 // number. | 3014 // number. |
3018 __ bind(&done); | 3015 __ bind(&done); |
3019 __ sub(ip, reg, Operand(kHeapObjectTag)); | 3016 __ sub(ip, reg, Operand(kHeapObjectTag)); |
3020 __ vstr(dbl_scratch, ip, HeapNumber::kValueOffset); | 3017 __ vstr(dbl_scratch, ip, HeapNumber::kValueOffset); |
3021 __ str(reg, MemOperand(sp, reg_stack_index * kPointerSize)); | 3018 __ StoreToSafepointRegisterSlot(reg, reg); |
3022 __ PopSafepointRegisters(); | 3019 __ PopSafepointRegisters(); |
3023 } | 3020 } |
3024 | 3021 |
3025 | 3022 |
3026 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 3023 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
3027 class DeferredNumberTagD: public LDeferredCode { | 3024 class DeferredNumberTagD: public LDeferredCode { |
3028 public: | 3025 public: |
3029 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 3026 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
3030 : LDeferredCode(codegen), instr_(instr) { } | 3027 : LDeferredCode(codegen), instr_(instr) { } |
3031 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } | 3028 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } |
(...skipping 24 matching lines...) Expand all Loading... |
3056 // TODO(3095996): Get rid of this. For now, we need to make the | 3053 // TODO(3095996): Get rid of this. For now, we need to make the |
3057 // result register contain a valid pointer because it is already | 3054 // result register contain a valid pointer because it is already |
3058 // contained in the register pointer map. | 3055 // contained in the register pointer map. |
3059 Register reg = ToRegister(instr->result()); | 3056 Register reg = ToRegister(instr->result()); |
3060 __ mov(reg, Operand(0)); | 3057 __ mov(reg, Operand(0)); |
3061 | 3058 |
3062 __ PushSafepointRegisters(); | 3059 __ PushSafepointRegisters(); |
3063 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 3060 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
3064 RecordSafepointWithRegisters( | 3061 RecordSafepointWithRegisters( |
3065 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); | 3062 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); |
3066 int reg_stack_index = __ SafepointRegisterStackIndex(reg.code()); | 3063 __ StoreToSafepointRegisterSlot(r0, reg); |
3067 __ str(r0, MemOperand(sp, reg_stack_index * kPointerSize)); | |
3068 __ PopSafepointRegisters(); | 3064 __ PopSafepointRegisters(); |
3069 } | 3065 } |
3070 | 3066 |
3071 | 3067 |
3072 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 3068 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
3073 LOperand* input = instr->InputAt(0); | 3069 LOperand* input = instr->InputAt(0); |
3074 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 3070 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
3075 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); | 3071 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); |
3076 __ SmiTag(ToRegister(input)); | 3072 __ SmiTag(ToRegister(input)); |
3077 } | 3073 } |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3722 ASSERT(!environment->HasBeenRegistered()); | 3718 ASSERT(!environment->HasBeenRegistered()); |
3723 RegisterEnvironmentForDeoptimization(environment); | 3719 RegisterEnvironmentForDeoptimization(environment); |
3724 ASSERT(osr_pc_offset_ == -1); | 3720 ASSERT(osr_pc_offset_ == -1); |
3725 osr_pc_offset_ = masm()->pc_offset(); | 3721 osr_pc_offset_ = masm()->pc_offset(); |
3726 } | 3722 } |
3727 | 3723 |
3728 | 3724 |
3729 #undef __ | 3725 #undef __ |
3730 | 3726 |
3731 } } // namespace v8::internal | 3727 } } // namespace v8::internal |
OLD | NEW |