| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 | 1073 |
| 1074 void LCodeGen::DeoptimizeIfNotZero(Register rt, LEnvironment* environment) { | 1074 void LCodeGen::DeoptimizeIfNotZero(Register rt, LEnvironment* environment) { |
| 1075 DeoptimizeBranch(environment, reg_not_zero, rt); | 1075 DeoptimizeBranch(environment, reg_not_zero, rt); |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 | 1078 |
| 1079 void LCodeGen::DeoptimizeIfNegative(Register rt, LEnvironment* environment) { | 1079 void LCodeGen::DeoptimizeIfNegative(Register rt, LEnvironment* environment) { |
| 1080 int sign_bit = rt.Is64Bits() ? kXSignBit : kWSignBit; | 1080 int sign_bit = rt.Is64Bits() ? kXSignBit : kWSignBit; |
| 1081 DeoptimizeBranch(environment, reg_bit_set, rt, sign_bit); | 1081 DeoptimizeIfBitSet(rt, sign_bit, environment); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 | 1084 |
| 1085 void LCodeGen::DeoptimizeIfSmi(Register rt, | 1085 void LCodeGen::DeoptimizeIfSmi(Register rt, |
| 1086 LEnvironment* environment) { | 1086 LEnvironment* environment) { |
| 1087 DeoptimizeBranch(environment, reg_bit_clear, rt, MaskToBit(kSmiTagMask)); | 1087 DeoptimizeIfBitClear(rt, MaskToBit(kSmiTagMask), environment); |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 | 1090 |
| 1091 void LCodeGen::DeoptimizeIfNotSmi(Register rt, LEnvironment* environment) { | 1091 void LCodeGen::DeoptimizeIfNotSmi(Register rt, LEnvironment* environment) { |
| 1092 DeoptimizeBranch(environment, reg_bit_set, rt, MaskToBit(kSmiTagMask)); | 1092 DeoptimizeIfBitSet(rt, MaskToBit(kSmiTagMask), environment); |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 | 1095 |
| 1096 void LCodeGen::DeoptimizeIfRoot(Register rt, | 1096 void LCodeGen::DeoptimizeIfRoot(Register rt, |
| 1097 Heap::RootListIndex index, | 1097 Heap::RootListIndex index, |
| 1098 LEnvironment* environment) { | 1098 LEnvironment* environment) { |
| 1099 __ CompareRoot(rt, index); | 1099 __ CompareRoot(rt, index); |
| 1100 DeoptimizeIf(eq, environment); | 1100 DeoptimizeIf(eq, environment); |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 | 1103 |
| 1104 void LCodeGen::DeoptimizeIfNotRoot(Register rt, | 1104 void LCodeGen::DeoptimizeIfNotRoot(Register rt, |
| 1105 Heap::RootListIndex index, | 1105 Heap::RootListIndex index, |
| 1106 LEnvironment* environment) { | 1106 LEnvironment* environment) { |
| 1107 __ CompareRoot(rt, index); | 1107 __ CompareRoot(rt, index); |
| 1108 DeoptimizeIf(ne, environment); | 1108 DeoptimizeIf(ne, environment); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 | 1111 |
| 1112 void LCodeGen::DeoptimizeIfMinusZero(DoubleRegister input, | 1112 void LCodeGen::DeoptimizeIfMinusZero(DoubleRegister input, |
| 1113 LEnvironment* environment) { | 1113 LEnvironment* environment) { |
| 1114 __ TestForMinusZero(input); | 1114 __ TestForMinusZero(input); |
| 1115 DeoptimizeIf(vs, environment); | 1115 DeoptimizeIf(vs, environment); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 | 1118 |
| 1119 void LCodeGen::DeoptimizeIfBitSet(Register rt, |
| 1120 int bit, |
| 1121 LEnvironment* environment) { |
| 1122 DeoptimizeBranch(environment, reg_bit_set, rt, bit); |
| 1123 } |
| 1124 |
| 1125 |
| 1126 void LCodeGen::DeoptimizeIfBitClear(Register rt, |
| 1127 int bit, |
| 1128 LEnvironment* environment) { |
| 1129 DeoptimizeBranch(environment, reg_bit_clear, rt, bit); |
| 1130 } |
| 1131 |
| 1132 |
| 1119 void LCodeGen::EnsureSpaceForLazyDeopt(int space_needed) { | 1133 void LCodeGen::EnsureSpaceForLazyDeopt(int space_needed) { |
| 1120 if (!info()->IsStub()) { | 1134 if (!info()->IsStub()) { |
| 1121 // Ensure that we have enough space after the previous lazy-bailout | 1135 // Ensure that we have enough space after the previous lazy-bailout |
| 1122 // instruction for patching the code here. | 1136 // instruction for patching the code here. |
| 1123 intptr_t current_pc = masm()->pc_offset(); | 1137 intptr_t current_pc = masm()->pc_offset(); |
| 1124 | 1138 |
| 1125 if (current_pc < (last_lazy_deopt_pc_ + space_needed)) { | 1139 if (current_pc < (last_lazy_deopt_pc_ + space_needed)) { |
| 1126 ptrdiff_t padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 1140 ptrdiff_t padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 1127 ASSERT((padding_size % kInstructionSize) == 0); | 1141 ASSERT((padding_size % kInstructionSize) == 0); |
| 1128 InstructionAccurateScope instruction_accurate( | 1142 InstructionAccurateScope instruction_accurate( |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2177 __ Ccmp(scratch, last, CFlag, hs); | 2191 __ Ccmp(scratch, last, CFlag, hs); |
| 2178 DeoptimizeIf(hi, instr->environment()); | 2192 DeoptimizeIf(hi, instr->environment()); |
| 2179 } | 2193 } |
| 2180 } else { | 2194 } else { |
| 2181 uint8_t mask; | 2195 uint8_t mask; |
| 2182 uint8_t tag; | 2196 uint8_t tag; |
| 2183 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag); | 2197 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag); |
| 2184 | 2198 |
| 2185 if (IsPowerOf2(mask)) { | 2199 if (IsPowerOf2(mask)) { |
| 2186 ASSERT((tag == 0) || (tag == mask)); | 2200 ASSERT((tag == 0) || (tag == mask)); |
| 2187 // TODO(all): We might be able to use tbz/tbnz if we can guarantee that | 2201 if (tag == 0) { |
| 2188 // the deopt handler is reachable by a tbz instruction. | 2202 DeoptimizeIfBitSet(scratch, MaskToBit(mask), instr->environment()); |
| 2189 __ Tst(scratch, mask); | 2203 } else { |
| 2190 DeoptimizeIf(tag == 0 ? ne : eq, instr->environment()); | 2204 DeoptimizeIfBitClear(scratch, MaskToBit(mask), instr->environment()); |
| 2205 } |
| 2191 } else { | 2206 } else { |
| 2192 if (tag == 0) { | 2207 if (tag == 0) { |
| 2193 __ Tst(scratch, mask); | 2208 __ Tst(scratch, mask); |
| 2194 } else { | 2209 } else { |
| 2195 __ And(scratch, scratch, mask); | 2210 __ And(scratch, scratch, mask); |
| 2196 __ Cmp(scratch, tag); | 2211 __ Cmp(scratch, tag); |
| 2197 } | 2212 } |
| 2198 DeoptimizeIf(ne, instr->environment()); | 2213 DeoptimizeIf(ne, instr->environment()); |
| 2199 } | 2214 } |
| 2200 } | 2215 } |
| (...skipping 3655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5856 __ Bind(&out_of_object); | 5871 __ Bind(&out_of_object); |
| 5857 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5872 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5858 // Index is equal to negated out of object property index plus 1. | 5873 // Index is equal to negated out of object property index plus 1. |
| 5859 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5874 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5860 __ Ldr(result, FieldMemOperand(result, | 5875 __ Ldr(result, FieldMemOperand(result, |
| 5861 FixedArray::kHeaderSize - kPointerSize)); | 5876 FixedArray::kHeaderSize - kPointerSize)); |
| 5862 __ Bind(&done); | 5877 __ Bind(&done); |
| 5863 } | 5878 } |
| 5864 | 5879 |
| 5865 } } // namespace v8::internal | 5880 } } // namespace v8::internal |
| OLD | NEW |