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