| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
| 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 3096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3107 Abort(kArrayIndexConstantValueTooBig); | 3107 Abort(kArrayIndexConstantValueTooBig); |
| 3108 } | 3108 } |
| 3109 } else { | 3109 } else { |
| 3110 key = ToRegister(instr->key()); | 3110 key = ToRegister(instr->key()); |
| 3111 } | 3111 } |
| 3112 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 3112 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
| 3113 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) | 3113 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
| 3114 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 3114 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 3115 int base_offset = instr->base_offset(); | 3115 int base_offset = instr->base_offset(); |
| 3116 | 3116 |
| 3117 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 3117 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) { |
| 3118 elements_kind == FLOAT32_ELEMENTS || | |
| 3119 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | |
| 3120 elements_kind == FLOAT64_ELEMENTS) { | |
| 3121 FPURegister result = ToDoubleRegister(instr->result()); | 3118 FPURegister result = ToDoubleRegister(instr->result()); |
| 3122 if (key_is_constant) { | 3119 if (key_is_constant) { |
| 3123 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift); | 3120 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift); |
| 3124 } else { | 3121 } else { |
| 3125 __ sll(scratch0(), key, shift_size); | 3122 __ sll(scratch0(), key, shift_size); |
| 3126 __ Addu(scratch0(), scratch0(), external_pointer); | 3123 __ Addu(scratch0(), scratch0(), external_pointer); |
| 3127 } | 3124 } |
| 3128 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 3125 if (elements_kind == FLOAT32_ELEMENTS) { |
| 3129 elements_kind == FLOAT32_ELEMENTS) { | |
| 3130 __ lwc1(result, MemOperand(scratch0(), base_offset)); | 3126 __ lwc1(result, MemOperand(scratch0(), base_offset)); |
| 3131 __ cvt_d_s(result, result); | 3127 __ cvt_d_s(result, result); |
| 3132 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS | 3128 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS |
| 3133 __ ldc1(result, MemOperand(scratch0(), base_offset)); | 3129 __ ldc1(result, MemOperand(scratch0(), base_offset)); |
| 3134 } | 3130 } |
| 3135 } else { | 3131 } else { |
| 3136 Register result = ToRegister(instr->result()); | 3132 Register result = ToRegister(instr->result()); |
| 3137 MemOperand mem_operand = PrepareKeyedOperand( | 3133 MemOperand mem_operand = PrepareKeyedOperand( |
| 3138 key, external_pointer, key_is_constant, constant_key, | 3134 key, external_pointer, key_is_constant, constant_key, |
| 3139 element_size_shift, shift_size, base_offset); | 3135 element_size_shift, shift_size, base_offset); |
| 3140 switch (elements_kind) { | 3136 switch (elements_kind) { |
| 3141 case EXTERNAL_INT8_ELEMENTS: | |
| 3142 case INT8_ELEMENTS: | 3137 case INT8_ELEMENTS: |
| 3143 __ lb(result, mem_operand); | 3138 __ lb(result, mem_operand); |
| 3144 break; | 3139 break; |
| 3145 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
| 3146 case EXTERNAL_UINT8_ELEMENTS: | |
| 3147 case UINT8_ELEMENTS: | 3140 case UINT8_ELEMENTS: |
| 3148 case UINT8_CLAMPED_ELEMENTS: | 3141 case UINT8_CLAMPED_ELEMENTS: |
| 3149 __ lbu(result, mem_operand); | 3142 __ lbu(result, mem_operand); |
| 3150 break; | 3143 break; |
| 3151 case EXTERNAL_INT16_ELEMENTS: | |
| 3152 case INT16_ELEMENTS: | 3144 case INT16_ELEMENTS: |
| 3153 __ lh(result, mem_operand); | 3145 __ lh(result, mem_operand); |
| 3154 break; | 3146 break; |
| 3155 case EXTERNAL_UINT16_ELEMENTS: | |
| 3156 case UINT16_ELEMENTS: | 3147 case UINT16_ELEMENTS: |
| 3157 __ lhu(result, mem_operand); | 3148 __ lhu(result, mem_operand); |
| 3158 break; | 3149 break; |
| 3159 case EXTERNAL_INT32_ELEMENTS: | |
| 3160 case INT32_ELEMENTS: | 3150 case INT32_ELEMENTS: |
| 3161 __ lw(result, mem_operand); | 3151 __ lw(result, mem_operand); |
| 3162 break; | 3152 break; |
| 3163 case EXTERNAL_UINT32_ELEMENTS: | |
| 3164 case UINT32_ELEMENTS: | 3153 case UINT32_ELEMENTS: |
| 3165 __ lw(result, mem_operand); | 3154 __ lw(result, mem_operand); |
| 3166 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { | 3155 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
| 3167 DeoptimizeIf(Ugreater_equal, instr, Deoptimizer::kNegativeValue, | 3156 DeoptimizeIf(Ugreater_equal, instr, Deoptimizer::kNegativeValue, |
| 3168 result, Operand(0x80000000)); | 3157 result, Operand(0x80000000)); |
| 3169 } | 3158 } |
| 3170 break; | 3159 break; |
| 3171 case FLOAT32_ELEMENTS: | 3160 case FLOAT32_ELEMENTS: |
| 3172 case FLOAT64_ELEMENTS: | 3161 case FLOAT64_ELEMENTS: |
| 3173 case EXTERNAL_FLOAT32_ELEMENTS: | |
| 3174 case EXTERNAL_FLOAT64_ELEMENTS: | |
| 3175 case FAST_DOUBLE_ELEMENTS: | 3162 case FAST_DOUBLE_ELEMENTS: |
| 3176 case FAST_ELEMENTS: | 3163 case FAST_ELEMENTS: |
| 3177 case FAST_SMI_ELEMENTS: | 3164 case FAST_SMI_ELEMENTS: |
| 3178 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3165 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3179 case FAST_HOLEY_ELEMENTS: | 3166 case FAST_HOLEY_ELEMENTS: |
| 3180 case FAST_HOLEY_SMI_ELEMENTS: | 3167 case FAST_HOLEY_SMI_ELEMENTS: |
| 3181 case DICTIONARY_ELEMENTS: | 3168 case DICTIONARY_ELEMENTS: |
| 3182 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 3169 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 3183 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: | 3170 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
| 3184 UNREACHABLE(); | 3171 UNREACHABLE(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3276 DeoptimizeIf(ne, instr, Deoptimizer::kHole, result, | 3263 DeoptimizeIf(ne, instr, Deoptimizer::kHole, result, |
| 3277 Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); | 3264 Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); |
| 3278 } | 3265 } |
| 3279 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); | 3266 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
| 3280 __ bind(&done); | 3267 __ bind(&done); |
| 3281 } | 3268 } |
| 3282 } | 3269 } |
| 3283 | 3270 |
| 3284 | 3271 |
| 3285 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3272 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
| 3286 if (instr->is_typed_elements()) { | 3273 if (instr->is_fixed_typed_array()) { |
| 3287 DoLoadKeyedExternalArray(instr); | 3274 DoLoadKeyedExternalArray(instr); |
| 3288 } else if (instr->hydrogen()->representation().IsDouble()) { | 3275 } else if (instr->hydrogen()->representation().IsDouble()) { |
| 3289 DoLoadKeyedFixedDoubleArray(instr); | 3276 DoLoadKeyedFixedDoubleArray(instr); |
| 3290 } else { | 3277 } else { |
| 3291 DoLoadKeyedFixedArray(instr); | 3278 DoLoadKeyedFixedArray(instr); |
| 3292 } | 3279 } |
| 3293 } | 3280 } |
| 3294 | 3281 |
| 3295 | 3282 |
| 3296 MemOperand LCodeGen::PrepareKeyedOperand(Register key, | 3283 MemOperand LCodeGen::PrepareKeyedOperand(Register key, |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4271 Abort(kArrayIndexConstantValueTooBig); | 4258 Abort(kArrayIndexConstantValueTooBig); |
| 4272 } | 4259 } |
| 4273 } else { | 4260 } else { |
| 4274 key = ToRegister(instr->key()); | 4261 key = ToRegister(instr->key()); |
| 4275 } | 4262 } |
| 4276 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 4263 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
| 4277 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) | 4264 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
| 4278 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 4265 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 4279 int base_offset = instr->base_offset(); | 4266 int base_offset = instr->base_offset(); |
| 4280 | 4267 |
| 4281 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 4268 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) { |
| 4282 elements_kind == FLOAT32_ELEMENTS || | |
| 4283 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | |
| 4284 elements_kind == FLOAT64_ELEMENTS) { | |
| 4285 Register address = scratch0(); | 4269 Register address = scratch0(); |
| 4286 FPURegister value(ToDoubleRegister(instr->value())); | 4270 FPURegister value(ToDoubleRegister(instr->value())); |
| 4287 if (key_is_constant) { | 4271 if (key_is_constant) { |
| 4288 if (constant_key != 0) { | 4272 if (constant_key != 0) { |
| 4289 __ Addu(address, external_pointer, | 4273 __ Addu(address, external_pointer, |
| 4290 Operand(constant_key << element_size_shift)); | 4274 Operand(constant_key << element_size_shift)); |
| 4291 } else { | 4275 } else { |
| 4292 address = external_pointer; | 4276 address = external_pointer; |
| 4293 } | 4277 } |
| 4294 } else { | 4278 } else { |
| 4295 __ sll(address, key, shift_size); | 4279 __ sll(address, key, shift_size); |
| 4296 __ Addu(address, external_pointer, address); | 4280 __ Addu(address, external_pointer, address); |
| 4297 } | 4281 } |
| 4298 | 4282 |
| 4299 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 4283 if (elements_kind == FLOAT32_ELEMENTS) { |
| 4300 elements_kind == FLOAT32_ELEMENTS) { | |
| 4301 __ cvt_s_d(double_scratch0(), value); | 4284 __ cvt_s_d(double_scratch0(), value); |
| 4302 __ swc1(double_scratch0(), MemOperand(address, base_offset)); | 4285 __ swc1(double_scratch0(), MemOperand(address, base_offset)); |
| 4303 } else { // Storing doubles, not floats. | 4286 } else { // Storing doubles, not floats. |
| 4304 __ sdc1(value, MemOperand(address, base_offset)); | 4287 __ sdc1(value, MemOperand(address, base_offset)); |
| 4305 } | 4288 } |
| 4306 } else { | 4289 } else { |
| 4307 Register value(ToRegister(instr->value())); | 4290 Register value(ToRegister(instr->value())); |
| 4308 MemOperand mem_operand = PrepareKeyedOperand( | 4291 MemOperand mem_operand = PrepareKeyedOperand( |
| 4309 key, external_pointer, key_is_constant, constant_key, | 4292 key, external_pointer, key_is_constant, constant_key, |
| 4310 element_size_shift, shift_size, | 4293 element_size_shift, shift_size, |
| 4311 base_offset); | 4294 base_offset); |
| 4312 switch (elements_kind) { | 4295 switch (elements_kind) { |
| 4313 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
| 4314 case EXTERNAL_INT8_ELEMENTS: | |
| 4315 case EXTERNAL_UINT8_ELEMENTS: | |
| 4316 case UINT8_ELEMENTS: | 4296 case UINT8_ELEMENTS: |
| 4317 case UINT8_CLAMPED_ELEMENTS: | 4297 case UINT8_CLAMPED_ELEMENTS: |
| 4318 case INT8_ELEMENTS: | 4298 case INT8_ELEMENTS: |
| 4319 __ sb(value, mem_operand); | 4299 __ sb(value, mem_operand); |
| 4320 break; | 4300 break; |
| 4321 case EXTERNAL_INT16_ELEMENTS: | |
| 4322 case EXTERNAL_UINT16_ELEMENTS: | |
| 4323 case INT16_ELEMENTS: | 4301 case INT16_ELEMENTS: |
| 4324 case UINT16_ELEMENTS: | 4302 case UINT16_ELEMENTS: |
| 4325 __ sh(value, mem_operand); | 4303 __ sh(value, mem_operand); |
| 4326 break; | 4304 break; |
| 4327 case EXTERNAL_INT32_ELEMENTS: | |
| 4328 case EXTERNAL_UINT32_ELEMENTS: | |
| 4329 case INT32_ELEMENTS: | 4305 case INT32_ELEMENTS: |
| 4330 case UINT32_ELEMENTS: | 4306 case UINT32_ELEMENTS: |
| 4331 __ sw(value, mem_operand); | 4307 __ sw(value, mem_operand); |
| 4332 break; | 4308 break; |
| 4333 case FLOAT32_ELEMENTS: | 4309 case FLOAT32_ELEMENTS: |
| 4334 case FLOAT64_ELEMENTS: | 4310 case FLOAT64_ELEMENTS: |
| 4335 case EXTERNAL_FLOAT32_ELEMENTS: | |
| 4336 case EXTERNAL_FLOAT64_ELEMENTS: | |
| 4337 case FAST_DOUBLE_ELEMENTS: | 4311 case FAST_DOUBLE_ELEMENTS: |
| 4338 case FAST_ELEMENTS: | 4312 case FAST_ELEMENTS: |
| 4339 case FAST_SMI_ELEMENTS: | 4313 case FAST_SMI_ELEMENTS: |
| 4340 case FAST_HOLEY_DOUBLE_ELEMENTS: | 4314 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 4341 case FAST_HOLEY_ELEMENTS: | 4315 case FAST_HOLEY_ELEMENTS: |
| 4342 case FAST_HOLEY_SMI_ELEMENTS: | 4316 case FAST_HOLEY_SMI_ELEMENTS: |
| 4343 case DICTIONARY_ELEMENTS: | 4317 case DICTIONARY_ELEMENTS: |
| 4344 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 4318 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 4345 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: | 4319 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
| 4346 UNREACHABLE(); | 4320 UNREACHABLE(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4440 kSaveFPRegs, | 4414 kSaveFPRegs, |
| 4441 EMIT_REMEMBERED_SET, | 4415 EMIT_REMEMBERED_SET, |
| 4442 check_needed, | 4416 check_needed, |
| 4443 instr->hydrogen()->PointersToHereCheckForValue()); | 4417 instr->hydrogen()->PointersToHereCheckForValue()); |
| 4444 } | 4418 } |
| 4445 } | 4419 } |
| 4446 | 4420 |
| 4447 | 4421 |
| 4448 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4422 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
| 4449 // By cases: external, fast double | 4423 // By cases: external, fast double |
| 4450 if (instr->is_typed_elements()) { | 4424 if (instr->is_fixed_typed_array()) { |
| 4451 DoStoreKeyedExternalArray(instr); | 4425 DoStoreKeyedExternalArray(instr); |
| 4452 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4426 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
| 4453 DoStoreKeyedFixedDoubleArray(instr); | 4427 DoStoreKeyedFixedDoubleArray(instr); |
| 4454 } else { | 4428 } else { |
| 4455 DoStoreKeyedFixedArray(instr); | 4429 DoStoreKeyedFixedArray(instr); |
| 4456 } | 4430 } |
| 4457 } | 4431 } |
| 4458 | 4432 |
| 4459 | 4433 |
| 4460 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4434 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| (...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6092 __ Push(at, ToRegister(instr->function())); | 6066 __ Push(at, ToRegister(instr->function())); |
| 6093 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6067 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6094 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6068 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6095 } | 6069 } |
| 6096 | 6070 |
| 6097 | 6071 |
| 6098 #undef __ | 6072 #undef __ |
| 6099 | 6073 |
| 6100 } // namespace internal | 6074 } // namespace internal |
| 6101 } // namespace v8 | 6075 } // namespace v8 |
| OLD | NEW |