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 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2296 DeoptimizeIf(below_equal, instr->environment()); | 2296 DeoptimizeIf(below_equal, instr->environment()); |
2297 | 2297 |
2298 // There are two words between the frame pointer and the last argument. | 2298 // There are two words between the frame pointer and the last argument. |
2299 // Subtracting from length accounts for one of them add one more. | 2299 // Subtracting from length accounts for one of them add one more. |
2300 __ mov(result, Operand(arguments, length, times_4, kPointerSize)); | 2300 __ mov(result, Operand(arguments, length, times_4, kPointerSize)); |
2301 } | 2301 } |
2302 | 2302 |
2303 | 2303 |
2304 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { | 2304 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
2305 Register elements = ToRegister(instr->elements()); | 2305 Register elements = ToRegister(instr->elements()); |
2306 Register key = ToRegister(instr->key()); | |
2307 Register result = ToRegister(instr->result()); | 2306 Register result = ToRegister(instr->result()); |
2308 ASSERT(result.is(elements)); | |
2309 | 2307 |
2310 // Load the result. | 2308 // Load the result. |
2311 __ mov(result, FieldOperand(elements, | 2309 if (instr->key()->IsConstantOperand()) { |
2312 key, | 2310 int key = ToInteger32(LConstantOperand::cast(instr->key())); |
2313 times_pointer_size, | 2311 __ mov(result, FieldOperand( |
2314 FixedArray::kHeaderSize)); | 2312 elements, (key << times_pointer_size) + FixedArray::kHeaderSize)); |
danno
2011/08/10 11:03:46
overflow check in the spirit of lithium-codegen-ia
Jakob Kummerow
2011/08/10 12:22:48
Done (by using BuildFastArrayOperand).
| |
2313 } else { | |
2314 __ mov(result, FieldOperand(elements, | |
2315 ToRegister(instr->key()), | |
2316 times_pointer_size, | |
2317 FixedArray::kHeaderSize)); | |
2318 } | |
2315 | 2319 |
2316 // Check for the hole value. | 2320 // Check for the hole value. |
2317 if (instr->hydrogen()->RequiresHoleCheck()) { | 2321 if (instr->hydrogen()->RequiresHoleCheck()) { |
2318 __ cmp(result, factory()->the_hole_value()); | 2322 __ cmp(result, factory()->the_hole_value()); |
2319 DeoptimizeIf(equal, instr->environment()); | 2323 DeoptimizeIf(equal, instr->environment()); |
2320 } | 2324 } |
2321 } | 2325 } |
2322 | 2326 |
2323 | 2327 |
2324 void LCodeGen::DoLoadKeyedFastDoubleElement( | 2328 void LCodeGen::DoLoadKeyedFastDoubleElement( |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3101 | 3105 |
3102 __ mov(ecx, instr->name()); | 3106 __ mov(ecx, instr->name()); |
3103 Handle<Code> ic = instr->strict_mode() | 3107 Handle<Code> ic = instr->strict_mode() |
3104 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3108 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
3105 : isolate()->builtins()->StoreIC_Initialize(); | 3109 : isolate()->builtins()->StoreIC_Initialize(); |
3106 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3110 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3107 } | 3111 } |
3108 | 3112 |
3109 | 3113 |
3110 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3114 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
3111 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); | 3115 if (instr->index()->IsConstantOperand()) { |
3112 DeoptimizeIf(above_equal, instr->environment()); | 3116 __ cmp(ToOperand(instr->length()), |
3117 ToImmediate(LConstantOperand::cast(instr->index()))); | |
3118 DeoptimizeIf(below_equal, instr->environment()); | |
danno
2011/08/10 11:03:46
overflow check in the spirit of lithium-codegen-ia
Jakob Kummerow
2011/08/10 12:22:48
As discussed offline, nothing to overflow-check he
| |
3119 } else { | |
3120 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); | |
3121 DeoptimizeIf(above_equal, instr->environment()); | |
3122 } | |
3113 } | 3123 } |
3114 | 3124 |
3115 | 3125 |
3116 void LCodeGen::DoStoreKeyedSpecializedArrayElement( | 3126 void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
3117 LStoreKeyedSpecializedArrayElement* instr) { | 3127 LStoreKeyedSpecializedArrayElement* instr) { |
3118 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 3128 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
3119 Operand operand(BuildFastArrayOperand(instr->external_pointer(), | 3129 Operand operand(BuildFastArrayOperand(instr->external_pointer(), |
3120 instr->key(), elements_kind, 0)); | 3130 instr->key(), elements_kind, 0)); |
3121 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { | 3131 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { |
3122 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); | 3132 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); |
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4399 env->deoptimization_index()); | 4409 env->deoptimization_index()); |
4400 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4410 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4401 } | 4411 } |
4402 | 4412 |
4403 | 4413 |
4404 #undef __ | 4414 #undef __ |
4405 | 4415 |
4406 } } // namespace v8::internal | 4416 } } // namespace v8::internal |
4407 | 4417 |
4408 #endif // V8_TARGET_ARCH_IA32 | 4418 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |