| 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 3091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3102 Abort(kArrayIndexConstantValueTooBig); | 3102 Abort(kArrayIndexConstantValueTooBig); |
| 3103 } | 3103 } |
| 3104 } else { | 3104 } else { |
| 3105 key = ToRegister(instr->key()); | 3105 key = ToRegister(instr->key()); |
| 3106 } | 3106 } |
| 3107 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 3107 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
| 3108 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) | 3108 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
| 3109 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 3109 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 3110 int base_offset = instr->base_offset(); | 3110 int base_offset = instr->base_offset(); |
| 3111 | 3111 |
| 3112 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 3112 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) { |
| 3113 elements_kind == FLOAT32_ELEMENTS || | |
| 3114 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | |
| 3115 elements_kind == FLOAT64_ELEMENTS) { | |
| 3116 FPURegister result = ToDoubleRegister(instr->result()); | 3113 FPURegister result = ToDoubleRegister(instr->result()); |
| 3117 if (key_is_constant) { | 3114 if (key_is_constant) { |
| 3118 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift); | 3115 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift); |
| 3119 } else { | 3116 } else { |
| 3120 __ sll(scratch0(), key, shift_size); | 3117 __ sll(scratch0(), key, shift_size); |
| 3121 __ Addu(scratch0(), scratch0(), external_pointer); | 3118 __ Addu(scratch0(), scratch0(), external_pointer); |
| 3122 } | 3119 } |
| 3123 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 3120 if (elements_kind == FLOAT32_ELEMENTS) { |
| 3124 elements_kind == FLOAT32_ELEMENTS) { | |
| 3125 __ lwc1(result, MemOperand(scratch0(), base_offset)); | 3121 __ lwc1(result, MemOperand(scratch0(), base_offset)); |
| 3126 __ cvt_d_s(result, result); | 3122 __ cvt_d_s(result, result); |
| 3127 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS | 3123 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS |
| 3128 __ ldc1(result, MemOperand(scratch0(), base_offset)); | 3124 __ ldc1(result, MemOperand(scratch0(), base_offset)); |
| 3129 } | 3125 } |
| 3130 } else { | 3126 } else { |
| 3131 Register result = ToRegister(instr->result()); | 3127 Register result = ToRegister(instr->result()); |
| 3132 MemOperand mem_operand = PrepareKeyedOperand( | 3128 MemOperand mem_operand = PrepareKeyedOperand( |
| 3133 key, external_pointer, key_is_constant, constant_key, | 3129 key, external_pointer, key_is_constant, constant_key, |
| 3134 element_size_shift, shift_size, base_offset); | 3130 element_size_shift, shift_size, base_offset); |
| 3135 switch (elements_kind) { | 3131 switch (elements_kind) { |
| 3136 case EXTERNAL_INT8_ELEMENTS: | |
| 3137 case INT8_ELEMENTS: | 3132 case INT8_ELEMENTS: |
| 3138 __ lb(result, mem_operand); | 3133 __ lb(result, mem_operand); |
| 3139 break; | 3134 break; |
| 3140 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
| 3141 case EXTERNAL_UINT8_ELEMENTS: | |
| 3142 case UINT8_ELEMENTS: | 3135 case UINT8_ELEMENTS: |
| 3143 case UINT8_CLAMPED_ELEMENTS: | 3136 case UINT8_CLAMPED_ELEMENTS: |
| 3144 __ lbu(result, mem_operand); | 3137 __ lbu(result, mem_operand); |
| 3145 break; | 3138 break; |
| 3146 case EXTERNAL_INT16_ELEMENTS: | |
| 3147 case INT16_ELEMENTS: | 3139 case INT16_ELEMENTS: |
| 3148 __ lh(result, mem_operand); | 3140 __ lh(result, mem_operand); |
| 3149 break; | 3141 break; |
| 3150 case EXTERNAL_UINT16_ELEMENTS: | |
| 3151 case UINT16_ELEMENTS: | 3142 case UINT16_ELEMENTS: |
| 3152 __ lhu(result, mem_operand); | 3143 __ lhu(result, mem_operand); |
| 3153 break; | 3144 break; |
| 3154 case EXTERNAL_INT32_ELEMENTS: | |
| 3155 case INT32_ELEMENTS: | 3145 case INT32_ELEMENTS: |
| 3156 __ lw(result, mem_operand); | 3146 __ lw(result, mem_operand); |
| 3157 break; | 3147 break; |
| 3158 case EXTERNAL_UINT32_ELEMENTS: | |
| 3159 case UINT32_ELEMENTS: | 3148 case UINT32_ELEMENTS: |
| 3160 __ lw(result, mem_operand); | 3149 __ lw(result, mem_operand); |
| 3161 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { | 3150 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
| 3162 DeoptimizeIf(Ugreater_equal, instr, Deoptimizer::kNegativeValue, | 3151 DeoptimizeIf(Ugreater_equal, instr, Deoptimizer::kNegativeValue, |
| 3163 result, Operand(0x80000000)); | 3152 result, Operand(0x80000000)); |
| 3164 } | 3153 } |
| 3165 break; | 3154 break; |
| 3166 case FLOAT32_ELEMENTS: | 3155 case FLOAT32_ELEMENTS: |
| 3167 case FLOAT64_ELEMENTS: | 3156 case FLOAT64_ELEMENTS: |
| 3168 case EXTERNAL_FLOAT32_ELEMENTS: | |
| 3169 case EXTERNAL_FLOAT64_ELEMENTS: | |
| 3170 case FAST_DOUBLE_ELEMENTS: | 3157 case FAST_DOUBLE_ELEMENTS: |
| 3171 case FAST_ELEMENTS: | 3158 case FAST_ELEMENTS: |
| 3172 case FAST_SMI_ELEMENTS: | 3159 case FAST_SMI_ELEMENTS: |
| 3173 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3160 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3174 case FAST_HOLEY_ELEMENTS: | 3161 case FAST_HOLEY_ELEMENTS: |
| 3175 case FAST_HOLEY_SMI_ELEMENTS: | 3162 case FAST_HOLEY_SMI_ELEMENTS: |
| 3176 case DICTIONARY_ELEMENTS: | 3163 case DICTIONARY_ELEMENTS: |
| 3177 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 3164 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 3178 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: | 3165 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
| 3179 UNREACHABLE(); | 3166 UNREACHABLE(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3271 DeoptimizeIf(ne, instr, Deoptimizer::kHole, result, | 3258 DeoptimizeIf(ne, instr, Deoptimizer::kHole, result, |
| 3272 Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); | 3259 Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); |
| 3273 } | 3260 } |
| 3274 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); | 3261 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
| 3275 __ bind(&done); | 3262 __ bind(&done); |
| 3276 } | 3263 } |
| 3277 } | 3264 } |
| 3278 | 3265 |
| 3279 | 3266 |
| 3280 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3267 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
| 3281 if (instr->is_typed_elements()) { | 3268 if (instr->is_fixed_typed_array()) { |
| 3282 DoLoadKeyedExternalArray(instr); | 3269 DoLoadKeyedExternalArray(instr); |
| 3283 } else if (instr->hydrogen()->representation().IsDouble()) { | 3270 } else if (instr->hydrogen()->representation().IsDouble()) { |
| 3284 DoLoadKeyedFixedDoubleArray(instr); | 3271 DoLoadKeyedFixedDoubleArray(instr); |
| 3285 } else { | 3272 } else { |
| 3286 DoLoadKeyedFixedArray(instr); | 3273 DoLoadKeyedFixedArray(instr); |
| 3287 } | 3274 } |
| 3288 } | 3275 } |
| 3289 | 3276 |
| 3290 | 3277 |
| 3291 MemOperand LCodeGen::PrepareKeyedOperand(Register key, | 3278 MemOperand LCodeGen::PrepareKeyedOperand(Register key, |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4258 Abort(kArrayIndexConstantValueTooBig); | 4245 Abort(kArrayIndexConstantValueTooBig); |
| 4259 } | 4246 } |
| 4260 } else { | 4247 } else { |
| 4261 key = ToRegister(instr->key()); | 4248 key = ToRegister(instr->key()); |
| 4262 } | 4249 } |
| 4263 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 4250 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
| 4264 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) | 4251 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
| 4265 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 4252 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 4266 int base_offset = instr->base_offset(); | 4253 int base_offset = instr->base_offset(); |
| 4267 | 4254 |
| 4268 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 4255 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) { |
| 4269 elements_kind == FLOAT32_ELEMENTS || | |
| 4270 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | |
| 4271 elements_kind == FLOAT64_ELEMENTS) { | |
| 4272 Register address = scratch0(); | 4256 Register address = scratch0(); |
| 4273 FPURegister value(ToDoubleRegister(instr->value())); | 4257 FPURegister value(ToDoubleRegister(instr->value())); |
| 4274 if (key_is_constant) { | 4258 if (key_is_constant) { |
| 4275 if (constant_key != 0) { | 4259 if (constant_key != 0) { |
| 4276 __ Addu(address, external_pointer, | 4260 __ Addu(address, external_pointer, |
| 4277 Operand(constant_key << element_size_shift)); | 4261 Operand(constant_key << element_size_shift)); |
| 4278 } else { | 4262 } else { |
| 4279 address = external_pointer; | 4263 address = external_pointer; |
| 4280 } | 4264 } |
| 4281 } else { | 4265 } else { |
| 4282 __ sll(address, key, shift_size); | 4266 __ sll(address, key, shift_size); |
| 4283 __ Addu(address, external_pointer, address); | 4267 __ Addu(address, external_pointer, address); |
| 4284 } | 4268 } |
| 4285 | 4269 |
| 4286 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 4270 if (elements_kind == FLOAT32_ELEMENTS) { |
| 4287 elements_kind == FLOAT32_ELEMENTS) { | |
| 4288 __ cvt_s_d(double_scratch0(), value); | 4271 __ cvt_s_d(double_scratch0(), value); |
| 4289 __ swc1(double_scratch0(), MemOperand(address, base_offset)); | 4272 __ swc1(double_scratch0(), MemOperand(address, base_offset)); |
| 4290 } else { // Storing doubles, not floats. | 4273 } else { // Storing doubles, not floats. |
| 4291 __ sdc1(value, MemOperand(address, base_offset)); | 4274 __ sdc1(value, MemOperand(address, base_offset)); |
| 4292 } | 4275 } |
| 4293 } else { | 4276 } else { |
| 4294 Register value(ToRegister(instr->value())); | 4277 Register value(ToRegister(instr->value())); |
| 4295 MemOperand mem_operand = PrepareKeyedOperand( | 4278 MemOperand mem_operand = PrepareKeyedOperand( |
| 4296 key, external_pointer, key_is_constant, constant_key, | 4279 key, external_pointer, key_is_constant, constant_key, |
| 4297 element_size_shift, shift_size, | 4280 element_size_shift, shift_size, |
| 4298 base_offset); | 4281 base_offset); |
| 4299 switch (elements_kind) { | 4282 switch (elements_kind) { |
| 4300 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
| 4301 case EXTERNAL_INT8_ELEMENTS: | |
| 4302 case EXTERNAL_UINT8_ELEMENTS: | |
| 4303 case UINT8_ELEMENTS: | 4283 case UINT8_ELEMENTS: |
| 4304 case UINT8_CLAMPED_ELEMENTS: | 4284 case UINT8_CLAMPED_ELEMENTS: |
| 4305 case INT8_ELEMENTS: | 4285 case INT8_ELEMENTS: |
| 4306 __ sb(value, mem_operand); | 4286 __ sb(value, mem_operand); |
| 4307 break; | 4287 break; |
| 4308 case EXTERNAL_INT16_ELEMENTS: | |
| 4309 case EXTERNAL_UINT16_ELEMENTS: | |
| 4310 case INT16_ELEMENTS: | 4288 case INT16_ELEMENTS: |
| 4311 case UINT16_ELEMENTS: | 4289 case UINT16_ELEMENTS: |
| 4312 __ sh(value, mem_operand); | 4290 __ sh(value, mem_operand); |
| 4313 break; | 4291 break; |
| 4314 case EXTERNAL_INT32_ELEMENTS: | |
| 4315 case EXTERNAL_UINT32_ELEMENTS: | |
| 4316 case INT32_ELEMENTS: | 4292 case INT32_ELEMENTS: |
| 4317 case UINT32_ELEMENTS: | 4293 case UINT32_ELEMENTS: |
| 4318 __ sw(value, mem_operand); | 4294 __ sw(value, mem_operand); |
| 4319 break; | 4295 break; |
| 4320 case FLOAT32_ELEMENTS: | 4296 case FLOAT32_ELEMENTS: |
| 4321 case FLOAT64_ELEMENTS: | 4297 case FLOAT64_ELEMENTS: |
| 4322 case EXTERNAL_FLOAT32_ELEMENTS: | |
| 4323 case EXTERNAL_FLOAT64_ELEMENTS: | |
| 4324 case FAST_DOUBLE_ELEMENTS: | 4298 case FAST_DOUBLE_ELEMENTS: |
| 4325 case FAST_ELEMENTS: | 4299 case FAST_ELEMENTS: |
| 4326 case FAST_SMI_ELEMENTS: | 4300 case FAST_SMI_ELEMENTS: |
| 4327 case FAST_HOLEY_DOUBLE_ELEMENTS: | 4301 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 4328 case FAST_HOLEY_ELEMENTS: | 4302 case FAST_HOLEY_ELEMENTS: |
| 4329 case FAST_HOLEY_SMI_ELEMENTS: | 4303 case FAST_HOLEY_SMI_ELEMENTS: |
| 4330 case DICTIONARY_ELEMENTS: | 4304 case DICTIONARY_ELEMENTS: |
| 4331 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 4305 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 4332 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: | 4306 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
| 4333 UNREACHABLE(); | 4307 UNREACHABLE(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4427 kSaveFPRegs, | 4401 kSaveFPRegs, |
| 4428 EMIT_REMEMBERED_SET, | 4402 EMIT_REMEMBERED_SET, |
| 4429 check_needed, | 4403 check_needed, |
| 4430 instr->hydrogen()->PointersToHereCheckForValue()); | 4404 instr->hydrogen()->PointersToHereCheckForValue()); |
| 4431 } | 4405 } |
| 4432 } | 4406 } |
| 4433 | 4407 |
| 4434 | 4408 |
| 4435 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4409 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
| 4436 // By cases: external, fast double | 4410 // By cases: external, fast double |
| 4437 if (instr->is_typed_elements()) { | 4411 if (instr->is_fixed_typed_array()) { |
| 4438 DoStoreKeyedExternalArray(instr); | 4412 DoStoreKeyedExternalArray(instr); |
| 4439 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4413 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
| 4440 DoStoreKeyedFixedDoubleArray(instr); | 4414 DoStoreKeyedFixedDoubleArray(instr); |
| 4441 } else { | 4415 } else { |
| 4442 DoStoreKeyedFixedArray(instr); | 4416 DoStoreKeyedFixedArray(instr); |
| 4443 } | 4417 } |
| 4444 } | 4418 } |
| 4445 | 4419 |
| 4446 | 4420 |
| 4447 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4421 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| (...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6079 __ Push(at, ToRegister(instr->function())); | 6053 __ Push(at, ToRegister(instr->function())); |
| 6080 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6054 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6081 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6055 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6082 } | 6056 } |
| 6083 | 6057 |
| 6084 | 6058 |
| 6085 #undef __ | 6059 #undef __ |
| 6086 | 6060 |
| 6087 } // namespace internal | 6061 } // namespace internal |
| 6088 } // namespace v8 | 6062 } // namespace v8 |
| OLD | NEW |