Chromium Code Reviews| 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 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2223 FixedArray::kHeaderSize)); | 2223 FixedArray::kHeaderSize)); |
| 2224 | 2224 |
| 2225 // Check for the hole value. | 2225 // Check for the hole value. |
| 2226 if (instr->hydrogen()->RequiresHoleCheck()) { | 2226 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2227 __ cmp(result, factory()->the_hole_value()); | 2227 __ cmp(result, factory()->the_hole_value()); |
| 2228 DeoptimizeIf(equal, instr->environment()); | 2228 DeoptimizeIf(equal, instr->environment()); |
| 2229 } | 2229 } |
| 2230 } | 2230 } |
| 2231 | 2231 |
| 2232 | 2232 |
| 2233 Operand LCodeGen::BuildExternalArrayOperand( | 2233 void LCodeGen::DoLoadKeyedFastDoubleElement( |
| 2234 LLoadKeyedFastDoubleElement* instr) { | |
| 2235 Register elements = ToRegister(instr->elements()); | |
| 2236 XMMRegister result(ToDoubleRegister(instr->result())); | |
|
Mads Ager (chromium)
2011/07/19 08:03:51
I would use = as for elements.
danno
2011/07/19 12:50:17
Done.
| |
| 2237 | |
| 2238 if (instr->hydrogen()->RequiresHoleCheck()) { | |
| 2239 Operand hole_check_operand(BuildFastArrayOperand( | |
|
Mads Ager (chromium)
2011/07/19 08:03:51
For these operand creations I would use = instead
danno
2011/07/19 12:50:17
Done.
| |
| 2240 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS, | |
| 2241 FixedDoubleArray::kHeaderSize - kSmiTagMask + sizeof(kHoleNanLower32))); | |
|
Mads Ager (chromium)
2011/07/19 08:03:51
kHeapObjectTag instead of kSmiTagMask?
danno
2011/07/19 12:50:17
Done.
| |
| 2242 __ cmp(hole_check_operand, Immediate(kHoleNanUpper32)); | |
| 2243 DeoptimizeIf(equal, instr->environment()); | |
| 2244 } | |
| 2245 | |
| 2246 Operand double_load_operand(BuildFastArrayOperand( | |
| 2247 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS, | |
| 2248 FixedDoubleArray::kHeaderSize - kSmiTagMask)); | |
| 2249 __ movdbl(result, double_load_operand); | |
| 2250 } | |
| 2251 | |
| 2252 | |
| 2253 Operand LCodeGen::BuildFastArrayOperand( | |
| 2234 LOperand* external_pointer, | 2254 LOperand* external_pointer, |
| 2235 LOperand* key, | 2255 LOperand* key, |
| 2236 JSObject::ElementsKind elements_kind) { | 2256 JSObject::ElementsKind elements_kind, |
| 2257 uint32_t offset) { | |
| 2237 Register external_pointer_reg = ToRegister(external_pointer); | 2258 Register external_pointer_reg = ToRegister(external_pointer); |
| 2238 int shift_size = ElementsKindToShiftSize(elements_kind); | 2259 int shift_size = ElementsKindToShiftSize(elements_kind); |
| 2239 if (key->IsConstantOperand()) { | 2260 if (key->IsConstantOperand()) { |
| 2240 int constant_value = ToInteger32(LConstantOperand::cast(key)); | 2261 int constant_value = ToInteger32(LConstantOperand::cast(key)); |
| 2241 if (constant_value & 0xF0000000) { | 2262 if (constant_value & 0xF0000000) { |
| 2242 Abort("array index constant value too big"); | 2263 Abort("array index constant value too big"); |
| 2243 } | 2264 } |
| 2244 return Operand(external_pointer_reg, constant_value * (1 << shift_size)); | 2265 return Operand(external_pointer_reg, |
| 2266 constant_value * (1 << shift_size) + offset); | |
| 2245 } else { | 2267 } else { |
| 2246 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); | 2268 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); |
| 2247 return Operand(external_pointer_reg, ToRegister(key), scale_factor, 0); | 2269 return Operand(external_pointer_reg, ToRegister(key), scale_factor, offset); |
| 2248 } | 2270 } |
| 2249 } | 2271 } |
| 2250 | 2272 |
| 2251 | 2273 |
| 2252 void LCodeGen::DoLoadKeyedSpecializedArrayElement( | 2274 void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
| 2253 LLoadKeyedSpecializedArrayElement* instr) { | 2275 LLoadKeyedSpecializedArrayElement* instr) { |
| 2254 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 2276 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 2255 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), | 2277 Operand operand(BuildFastArrayOperand(instr->external_pointer(), |
| 2256 instr->key(), elements_kind)); | 2278 instr->key(), elements_kind, 0)); |
| 2257 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { | 2279 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { |
| 2258 XMMRegister result(ToDoubleRegister(instr->result())); | 2280 XMMRegister result(ToDoubleRegister(instr->result())); |
| 2259 __ movss(result, operand); | 2281 __ movss(result, operand); |
| 2260 __ cvtss2sd(result, result); | 2282 __ cvtss2sd(result, result); |
| 2261 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { | 2283 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { |
| 2262 __ movdbl(ToDoubleRegister(instr->result()), operand); | 2284 __ movdbl(ToDoubleRegister(instr->result()), operand); |
| 2263 } else { | 2285 } else { |
| 2264 Register result(ToRegister(instr->result())); | 2286 Register result(ToRegister(instr->result())); |
| 2265 switch (elements_kind) { | 2287 switch (elements_kind) { |
| 2266 case JSObject::EXTERNAL_BYTE_ELEMENTS: | 2288 case JSObject::EXTERNAL_BYTE_ELEMENTS: |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2994 | 3016 |
| 2995 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3017 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 2996 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); | 3018 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); |
| 2997 DeoptimizeIf(above_equal, instr->environment()); | 3019 DeoptimizeIf(above_equal, instr->environment()); |
| 2998 } | 3020 } |
| 2999 | 3021 |
| 3000 | 3022 |
| 3001 void LCodeGen::DoStoreKeyedSpecializedArrayElement( | 3023 void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
| 3002 LStoreKeyedSpecializedArrayElement* instr) { | 3024 LStoreKeyedSpecializedArrayElement* instr) { |
| 3003 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 3025 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 3004 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), | 3026 Operand operand(BuildFastArrayOperand(instr->external_pointer(), |
| 3005 instr->key(), elements_kind)); | 3027 instr->key(), elements_kind, 0)); |
| 3006 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { | 3028 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { |
| 3007 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); | 3029 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); |
| 3008 __ movss(operand, xmm0); | 3030 __ movss(operand, xmm0); |
| 3009 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { | 3031 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { |
| 3010 __ movdbl(operand, ToDoubleRegister(instr->value())); | 3032 __ movdbl(operand, ToDoubleRegister(instr->value())); |
| 3011 } else { | 3033 } else { |
| 3012 Register value = ToRegister(instr->value()); | 3034 Register value = ToRegister(instr->value()); |
| 3013 switch (elements_kind) { | 3035 switch (elements_kind) { |
| 3014 case JSObject::EXTERNAL_PIXEL_ELEMENTS: | 3036 case JSObject::EXTERNAL_PIXEL_ELEMENTS: |
| 3015 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3037 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3062 __ lea(key, | 3084 __ lea(key, |
| 3063 FieldOperand(elements, | 3085 FieldOperand(elements, |
| 3064 key, | 3086 key, |
| 3065 times_pointer_size, | 3087 times_pointer_size, |
| 3066 FixedArray::kHeaderSize)); | 3088 FixedArray::kHeaderSize)); |
| 3067 __ RecordWrite(elements, key, value); | 3089 __ RecordWrite(elements, key, value); |
| 3068 } | 3090 } |
| 3069 } | 3091 } |
| 3070 | 3092 |
| 3071 | 3093 |
| 3094 void LCodeGen::DoStoreKeyedFastDoubleElement( | |
| 3095 LStoreKeyedFastDoubleElement* instr) { | |
| 3096 XMMRegister value(ToDoubleRegister(instr->value())); | |
| 3097 Register elements = ToRegister(instr->elements()); | |
| 3098 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; | |
| 3099 Label have_value; | |
| 3100 | |
| 3101 __ ucomisd(value, value); | |
| 3102 __ j(parity_odd, &have_value); // NaN. | |
| 3103 | |
| 3104 ExternalReference canonical_nan_reference = | |
| 3105 ExternalReference::address_of_canonical_non_hole_nan(); | |
| 3106 __ movdbl(value, Operand::StaticVariable(canonical_nan_reference)); | |
| 3107 __ bind(&have_value); | |
| 3108 | |
| 3109 Operand double_store_operand(BuildFastArrayOperand( | |
| 3110 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS, | |
| 3111 FixedDoubleArray::kHeaderSize - kSmiTagMask)); | |
|
Mads Ager (chromium)
2011/07/19 08:03:51
kHeapObjectTag
danno
2011/07/19 12:50:17
Done.
| |
| 3112 __ movdbl(double_store_operand, value); | |
| 3113 } | |
| 3114 | |
| 3115 | |
| 3072 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 3116 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| 3073 ASSERT(ToRegister(instr->context()).is(esi)); | 3117 ASSERT(ToRegister(instr->context()).is(esi)); |
| 3074 ASSERT(ToRegister(instr->object()).is(edx)); | 3118 ASSERT(ToRegister(instr->object()).is(edx)); |
| 3075 ASSERT(ToRegister(instr->key()).is(ecx)); | 3119 ASSERT(ToRegister(instr->key()).is(ecx)); |
| 3076 ASSERT(ToRegister(instr->value()).is(eax)); | 3120 ASSERT(ToRegister(instr->value()).is(eax)); |
| 3077 | 3121 |
| 3078 Handle<Code> ic = instr->strict_mode() | 3122 Handle<Code> ic = instr->strict_mode() |
| 3079 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 3123 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
| 3080 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 3124 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
| 3081 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3125 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| (...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4263 env->deoptimization_index()); | 4307 env->deoptimization_index()); |
| 4264 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4308 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4265 } | 4309 } |
| 4266 | 4310 |
| 4267 | 4311 |
| 4268 #undef __ | 4312 #undef __ |
| 4269 | 4313 |
| 4270 } } // namespace v8::internal | 4314 } } // namespace v8::internal |
| 4271 | 4315 |
| 4272 #endif // V8_TARGET_ARCH_IA32 | 4316 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |