| 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 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2252 __ sub(length, index); | 2252 __ sub(length, index); |
| 2253 DeoptimizeIf(below_equal, instr->environment()); | 2253 DeoptimizeIf(below_equal, instr->environment()); |
| 2254 | 2254 |
| 2255 // There are two words between the frame pointer and the last argument. | 2255 // There are two words between the frame pointer and the last argument. |
| 2256 // Subtracting from length accounts for one of them add one more. | 2256 // Subtracting from length accounts for one of them add one more. |
| 2257 __ mov(result, Operand(arguments, length, times_4, kPointerSize)); | 2257 __ mov(result, Operand(arguments, length, times_4, kPointerSize)); |
| 2258 } | 2258 } |
| 2259 | 2259 |
| 2260 | 2260 |
| 2261 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { | 2261 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
| 2262 Register elements = ToRegister(instr->elements()); | |
| 2263 Register key = ToRegister(instr->key()); | |
| 2264 Register result = ToRegister(instr->result()); | 2262 Register result = ToRegister(instr->result()); |
| 2265 ASSERT(result.is(elements)); | |
| 2266 | 2263 |
| 2267 // Load the result. | 2264 // Load the result. |
| 2268 __ mov(result, FieldOperand(elements, | 2265 __ mov(result, |
| 2269 key, | 2266 BuildFastArrayOperand(instr->elements(), instr->key(), |
| 2270 times_pointer_size, | 2267 JSObject::FAST_ELEMENTS, |
| 2271 FixedArray::kHeaderSize)); | 2268 FixedArray::kHeaderSize - kHeapObjectTag)); |
| 2272 | 2269 |
| 2273 // Check for the hole value. | 2270 // Check for the hole value. |
| 2274 if (instr->hydrogen()->RequiresHoleCheck()) { | 2271 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2275 __ cmp(result, factory()->the_hole_value()); | 2272 __ cmp(result, factory()->the_hole_value()); |
| 2276 DeoptimizeIf(equal, instr->environment()); | 2273 DeoptimizeIf(equal, instr->environment()); |
| 2277 } | 2274 } |
| 2278 } | 2275 } |
| 2279 | 2276 |
| 2280 | 2277 |
| 2281 void LCodeGen::DoLoadKeyedFastDoubleElement( | 2278 void LCodeGen::DoLoadKeyedFastDoubleElement( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2294 } | 2291 } |
| 2295 | 2292 |
| 2296 Operand double_load_operand = BuildFastArrayOperand( | 2293 Operand double_load_operand = BuildFastArrayOperand( |
| 2297 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS, | 2294 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS, |
| 2298 FixedDoubleArray::kHeaderSize - kHeapObjectTag); | 2295 FixedDoubleArray::kHeaderSize - kHeapObjectTag); |
| 2299 __ movdbl(result, double_load_operand); | 2296 __ movdbl(result, double_load_operand); |
| 2300 } | 2297 } |
| 2301 | 2298 |
| 2302 | 2299 |
| 2303 Operand LCodeGen::BuildFastArrayOperand( | 2300 Operand LCodeGen::BuildFastArrayOperand( |
| 2304 LOperand* external_pointer, | 2301 LOperand* elements_pointer, |
| 2305 LOperand* key, | 2302 LOperand* key, |
| 2306 JSObject::ElementsKind elements_kind, | 2303 JSObject::ElementsKind elements_kind, |
| 2307 uint32_t offset) { | 2304 uint32_t offset) { |
| 2308 Register external_pointer_reg = ToRegister(external_pointer); | 2305 Register elements_pointer_reg = ToRegister(elements_pointer); |
| 2309 int shift_size = ElementsKindToShiftSize(elements_kind); | 2306 int shift_size = ElementsKindToShiftSize(elements_kind); |
| 2310 if (key->IsConstantOperand()) { | 2307 if (key->IsConstantOperand()) { |
| 2311 int constant_value = ToInteger32(LConstantOperand::cast(key)); | 2308 int constant_value = ToInteger32(LConstantOperand::cast(key)); |
| 2312 if (constant_value & 0xF0000000) { | 2309 if (constant_value & 0xF0000000) { |
| 2313 Abort("array index constant value too big"); | 2310 Abort("array index constant value too big"); |
| 2314 } | 2311 } |
| 2315 return Operand(external_pointer_reg, | 2312 return Operand(elements_pointer_reg, |
| 2316 constant_value * (1 << shift_size) + offset); | 2313 constant_value * (1 << shift_size) + offset); |
| 2317 } else { | 2314 } else { |
| 2318 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); | 2315 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); |
| 2319 return Operand(external_pointer_reg, ToRegister(key), scale_factor, offset); | 2316 return Operand(elements_pointer_reg, ToRegister(key), scale_factor, offset); |
| 2320 } | 2317 } |
| 2321 } | 2318 } |
| 2322 | 2319 |
| 2323 | 2320 |
| 2324 void LCodeGen::DoLoadKeyedSpecializedArrayElement( | 2321 void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
| 2325 LLoadKeyedSpecializedArrayElement* instr) { | 2322 LLoadKeyedSpecializedArrayElement* instr) { |
| 2326 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 2323 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 2327 Operand operand(BuildFastArrayOperand(instr->external_pointer(), | 2324 Operand operand(BuildFastArrayOperand(instr->external_pointer(), |
| 2328 instr->key(), elements_kind, 0)); | 2325 instr->key(), elements_kind, 0)); |
| 2329 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { | 2326 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3086 | 3083 |
| 3087 __ mov(ecx, instr->name()); | 3084 __ mov(ecx, instr->name()); |
| 3088 Handle<Code> ic = instr->strict_mode() | 3085 Handle<Code> ic = instr->strict_mode() |
| 3089 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3086 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
| 3090 : isolate()->builtins()->StoreIC_Initialize(); | 3087 : isolate()->builtins()->StoreIC_Initialize(); |
| 3091 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3088 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3092 } | 3089 } |
| 3093 | 3090 |
| 3094 | 3091 |
| 3095 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3092 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 3096 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); | 3093 if (instr->index()->IsConstantOperand()) { |
| 3097 DeoptimizeIf(above_equal, instr->environment()); | 3094 __ cmp(ToOperand(instr->length()), |
| 3095 ToImmediate(LConstantOperand::cast(instr->index()))); |
| 3096 DeoptimizeIf(below_equal, instr->environment()); |
| 3097 } else { |
| 3098 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); |
| 3099 DeoptimizeIf(above_equal, instr->environment()); |
| 3100 } |
| 3098 } | 3101 } |
| 3099 | 3102 |
| 3100 | 3103 |
| 3101 void LCodeGen::DoStoreKeyedSpecializedArrayElement( | 3104 void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
| 3102 LStoreKeyedSpecializedArrayElement* instr) { | 3105 LStoreKeyedSpecializedArrayElement* instr) { |
| 3103 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 3106 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 3104 Operand operand(BuildFastArrayOperand(instr->external_pointer(), | 3107 Operand operand(BuildFastArrayOperand(instr->external_pointer(), |
| 3105 instr->key(), elements_kind, 0)); | 3108 instr->key(), elements_kind, 0)); |
| 3106 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { | 3109 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { |
| 3107 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); | 3110 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); |
| (...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4390 env->deoptimization_index()); | 4393 env->deoptimization_index()); |
| 4391 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4394 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4392 } | 4395 } |
| 4393 | 4396 |
| 4394 | 4397 |
| 4395 #undef __ | 4398 #undef __ |
| 4396 | 4399 |
| 4397 } } // namespace v8::internal | 4400 } } // namespace v8::internal |
| 4398 | 4401 |
| 4399 #endif // V8_TARGET_ARCH_IA32 | 4402 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |