Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 1254623002: Remove ExternalArray, derived types, and element kinds (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arm/lithium-codegen-arm.h" 7 #include "src/arm/lithium-codegen-arm.h"
8 #include "src/arm/lithium-gap-resolver-arm.h" 8 #include "src/arm/lithium-gap-resolver-arm.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after
3183 Abort(kArrayIndexConstantValueTooBig); 3183 Abort(kArrayIndexConstantValueTooBig);
3184 } 3184 }
3185 } else { 3185 } else {
3186 key = ToRegister(instr->key()); 3186 key = ToRegister(instr->key());
3187 } 3187 }
3188 int element_size_shift = ElementsKindToShiftSize(elements_kind); 3188 int element_size_shift = ElementsKindToShiftSize(elements_kind);
3189 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 3189 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3190 ? (element_size_shift - kSmiTagSize) : element_size_shift; 3190 ? (element_size_shift - kSmiTagSize) : element_size_shift;
3191 int base_offset = instr->base_offset(); 3191 int base_offset = instr->base_offset();
3192 3192
3193 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3193 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
3194 elements_kind == FLOAT32_ELEMENTS ||
3195 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
3196 elements_kind == FLOAT64_ELEMENTS) {
3197 DwVfpRegister result = ToDoubleRegister(instr->result()); 3194 DwVfpRegister result = ToDoubleRegister(instr->result());
3198 Operand operand = key_is_constant 3195 Operand operand = key_is_constant
3199 ? Operand(constant_key << element_size_shift) 3196 ? Operand(constant_key << element_size_shift)
3200 : Operand(key, LSL, shift_size); 3197 : Operand(key, LSL, shift_size);
3201 __ add(scratch0(), external_pointer, operand); 3198 __ add(scratch0(), external_pointer, operand);
3202 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3199 if (elements_kind == FLOAT32_ELEMENTS) {
3203 elements_kind == FLOAT32_ELEMENTS) {
3204 __ vldr(double_scratch0().low(), scratch0(), base_offset); 3200 __ vldr(double_scratch0().low(), scratch0(), base_offset);
3205 __ vcvt_f64_f32(result, double_scratch0().low()); 3201 __ vcvt_f64_f32(result, double_scratch0().low());
3206 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS 3202 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
3207 __ vldr(result, scratch0(), base_offset); 3203 __ vldr(result, scratch0(), base_offset);
3208 } 3204 }
3209 } else { 3205 } else {
3210 Register result = ToRegister(instr->result()); 3206 Register result = ToRegister(instr->result());
3211 MemOperand mem_operand = PrepareKeyedOperand( 3207 MemOperand mem_operand = PrepareKeyedOperand(
3212 key, external_pointer, key_is_constant, constant_key, 3208 key, external_pointer, key_is_constant, constant_key,
3213 element_size_shift, shift_size, base_offset); 3209 element_size_shift, shift_size, base_offset);
3214 switch (elements_kind) { 3210 switch (elements_kind) {
3215 case EXTERNAL_INT8_ELEMENTS:
3216 case INT8_ELEMENTS: 3211 case INT8_ELEMENTS:
3217 __ ldrsb(result, mem_operand); 3212 __ ldrsb(result, mem_operand);
3218 break; 3213 break;
3219 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3220 case EXTERNAL_UINT8_ELEMENTS:
3221 case UINT8_ELEMENTS: 3214 case UINT8_ELEMENTS:
3222 case UINT8_CLAMPED_ELEMENTS: 3215 case UINT8_CLAMPED_ELEMENTS:
3223 __ ldrb(result, mem_operand); 3216 __ ldrb(result, mem_operand);
3224 break; 3217 break;
3225 case EXTERNAL_INT16_ELEMENTS:
3226 case INT16_ELEMENTS: 3218 case INT16_ELEMENTS:
3227 __ ldrsh(result, mem_operand); 3219 __ ldrsh(result, mem_operand);
3228 break; 3220 break;
3229 case EXTERNAL_UINT16_ELEMENTS:
3230 case UINT16_ELEMENTS: 3221 case UINT16_ELEMENTS:
3231 __ ldrh(result, mem_operand); 3222 __ ldrh(result, mem_operand);
3232 break; 3223 break;
3233 case EXTERNAL_INT32_ELEMENTS:
3234 case INT32_ELEMENTS: 3224 case INT32_ELEMENTS:
3235 __ ldr(result, mem_operand); 3225 __ ldr(result, mem_operand);
3236 break; 3226 break;
3237 case EXTERNAL_UINT32_ELEMENTS:
3238 case UINT32_ELEMENTS: 3227 case UINT32_ELEMENTS:
3239 __ ldr(result, mem_operand); 3228 __ ldr(result, mem_operand);
3240 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3229 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3241 __ cmp(result, Operand(0x80000000)); 3230 __ cmp(result, Operand(0x80000000));
3242 DeoptimizeIf(cs, instr, Deoptimizer::kNegativeValue); 3231 DeoptimizeIf(cs, instr, Deoptimizer::kNegativeValue);
3243 } 3232 }
3244 break; 3233 break;
3245 case FLOAT32_ELEMENTS: 3234 case FLOAT32_ELEMENTS:
3246 case FLOAT64_ELEMENTS: 3235 case FLOAT64_ELEMENTS:
3247 case EXTERNAL_FLOAT32_ELEMENTS:
3248 case EXTERNAL_FLOAT64_ELEMENTS:
3249 case FAST_HOLEY_DOUBLE_ELEMENTS: 3236 case FAST_HOLEY_DOUBLE_ELEMENTS:
3250 case FAST_HOLEY_ELEMENTS: 3237 case FAST_HOLEY_ELEMENTS:
3251 case FAST_HOLEY_SMI_ELEMENTS: 3238 case FAST_HOLEY_SMI_ELEMENTS:
3252 case FAST_DOUBLE_ELEMENTS: 3239 case FAST_DOUBLE_ELEMENTS:
3253 case FAST_ELEMENTS: 3240 case FAST_ELEMENTS:
3254 case FAST_SMI_ELEMENTS: 3241 case FAST_SMI_ELEMENTS:
3255 case DICTIONARY_ELEMENTS: 3242 case DICTIONARY_ELEMENTS:
3256 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 3243 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
3257 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 3244 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
3258 UNREACHABLE(); 3245 UNREACHABLE();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
3348 __ cmp(result, Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); 3335 __ cmp(result, Operand(Smi::FromInt(Isolate::kArrayProtectorValid)));
3349 DeoptimizeIf(ne, instr, Deoptimizer::kHole); 3336 DeoptimizeIf(ne, instr, Deoptimizer::kHole);
3350 } 3337 }
3351 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); 3338 __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
3352 __ bind(&done); 3339 __ bind(&done);
3353 } 3340 }
3354 } 3341 }
3355 3342
3356 3343
3357 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { 3344 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3358 if (instr->is_typed_elements()) { 3345 if (instr->is_fixed_typed_array()) {
3359 DoLoadKeyedExternalArray(instr); 3346 DoLoadKeyedExternalArray(instr);
3360 } else if (instr->hydrogen()->representation().IsDouble()) { 3347 } else if (instr->hydrogen()->representation().IsDouble()) {
3361 DoLoadKeyedFixedDoubleArray(instr); 3348 DoLoadKeyedFixedDoubleArray(instr);
3362 } else { 3349 } else {
3363 DoLoadKeyedFixedArray(instr); 3350 DoLoadKeyedFixedArray(instr);
3364 } 3351 }
3365 } 3352 }
3366 3353
3367 3354
3368 MemOperand LCodeGen::PrepareKeyedOperand(Register key, 3355 MemOperand LCodeGen::PrepareKeyedOperand(Register key,
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
4310 Abort(kArrayIndexConstantValueTooBig); 4297 Abort(kArrayIndexConstantValueTooBig);
4311 } 4298 }
4312 } else { 4299 } else {
4313 key = ToRegister(instr->key()); 4300 key = ToRegister(instr->key());
4314 } 4301 }
4315 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4302 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4316 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4303 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4317 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4304 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4318 int base_offset = instr->base_offset(); 4305 int base_offset = instr->base_offset();
4319 4306
4320 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4307 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
4321 elements_kind == FLOAT32_ELEMENTS ||
4322 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4323 elements_kind == FLOAT64_ELEMENTS) {
4324 Register address = scratch0(); 4308 Register address = scratch0();
4325 DwVfpRegister value(ToDoubleRegister(instr->value())); 4309 DwVfpRegister value(ToDoubleRegister(instr->value()));
4326 if (key_is_constant) { 4310 if (key_is_constant) {
4327 if (constant_key != 0) { 4311 if (constant_key != 0) {
4328 __ add(address, external_pointer, 4312 __ add(address, external_pointer,
4329 Operand(constant_key << element_size_shift)); 4313 Operand(constant_key << element_size_shift));
4330 } else { 4314 } else {
4331 address = external_pointer; 4315 address = external_pointer;
4332 } 4316 }
4333 } else { 4317 } else {
4334 __ add(address, external_pointer, Operand(key, LSL, shift_size)); 4318 __ add(address, external_pointer, Operand(key, LSL, shift_size));
4335 } 4319 }
4336 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4320 if (elements_kind == FLOAT32_ELEMENTS) {
4337 elements_kind == FLOAT32_ELEMENTS) {
4338 __ vcvt_f32_f64(double_scratch0().low(), value); 4321 __ vcvt_f32_f64(double_scratch0().low(), value);
4339 __ vstr(double_scratch0().low(), address, base_offset); 4322 __ vstr(double_scratch0().low(), address, base_offset);
4340 } else { // Storing doubles, not floats. 4323 } else { // Storing doubles, not floats.
4341 __ vstr(value, address, base_offset); 4324 __ vstr(value, address, base_offset);
4342 } 4325 }
4343 } else { 4326 } else {
4344 Register value(ToRegister(instr->value())); 4327 Register value(ToRegister(instr->value()));
4345 MemOperand mem_operand = PrepareKeyedOperand( 4328 MemOperand mem_operand = PrepareKeyedOperand(
4346 key, external_pointer, key_is_constant, constant_key, 4329 key, external_pointer, key_is_constant, constant_key,
4347 element_size_shift, shift_size, 4330 element_size_shift, shift_size,
4348 base_offset); 4331 base_offset);
4349 switch (elements_kind) { 4332 switch (elements_kind) {
4350 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4351 case EXTERNAL_INT8_ELEMENTS:
4352 case EXTERNAL_UINT8_ELEMENTS:
4353 case UINT8_ELEMENTS: 4333 case UINT8_ELEMENTS:
4354 case UINT8_CLAMPED_ELEMENTS: 4334 case UINT8_CLAMPED_ELEMENTS:
4355 case INT8_ELEMENTS: 4335 case INT8_ELEMENTS:
4356 __ strb(value, mem_operand); 4336 __ strb(value, mem_operand);
4357 break; 4337 break;
4358 case EXTERNAL_INT16_ELEMENTS:
4359 case EXTERNAL_UINT16_ELEMENTS:
4360 case INT16_ELEMENTS: 4338 case INT16_ELEMENTS:
4361 case UINT16_ELEMENTS: 4339 case UINT16_ELEMENTS:
4362 __ strh(value, mem_operand); 4340 __ strh(value, mem_operand);
4363 break; 4341 break;
4364 case EXTERNAL_INT32_ELEMENTS:
4365 case EXTERNAL_UINT32_ELEMENTS:
4366 case INT32_ELEMENTS: 4342 case INT32_ELEMENTS:
4367 case UINT32_ELEMENTS: 4343 case UINT32_ELEMENTS:
4368 __ str(value, mem_operand); 4344 __ str(value, mem_operand);
4369 break; 4345 break;
4370 case FLOAT32_ELEMENTS: 4346 case FLOAT32_ELEMENTS:
4371 case FLOAT64_ELEMENTS: 4347 case FLOAT64_ELEMENTS:
4372 case EXTERNAL_FLOAT32_ELEMENTS:
4373 case EXTERNAL_FLOAT64_ELEMENTS:
4374 case FAST_DOUBLE_ELEMENTS: 4348 case FAST_DOUBLE_ELEMENTS:
4375 case FAST_ELEMENTS: 4349 case FAST_ELEMENTS:
4376 case FAST_SMI_ELEMENTS: 4350 case FAST_SMI_ELEMENTS:
4377 case FAST_HOLEY_DOUBLE_ELEMENTS: 4351 case FAST_HOLEY_DOUBLE_ELEMENTS:
4378 case FAST_HOLEY_ELEMENTS: 4352 case FAST_HOLEY_ELEMENTS:
4379 case FAST_HOLEY_SMI_ELEMENTS: 4353 case FAST_HOLEY_SMI_ELEMENTS:
4380 case DICTIONARY_ELEMENTS: 4354 case DICTIONARY_ELEMENTS:
4381 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 4355 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
4382 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 4356 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
4383 UNREACHABLE(); 4357 UNREACHABLE();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
4469 kSaveFPRegs, 4443 kSaveFPRegs,
4470 EMIT_REMEMBERED_SET, 4444 EMIT_REMEMBERED_SET,
4471 check_needed, 4445 check_needed,
4472 instr->hydrogen()->PointersToHereCheckForValue()); 4446 instr->hydrogen()->PointersToHereCheckForValue());
4473 } 4447 }
4474 } 4448 }
4475 4449
4476 4450
4477 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4451 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4478 // By cases: external, fast double 4452 // By cases: external, fast double
4479 if (instr->is_typed_elements()) { 4453 if (instr->is_fixed_typed_array()) {
4480 DoStoreKeyedExternalArray(instr); 4454 DoStoreKeyedExternalArray(instr);
4481 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4455 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4482 DoStoreKeyedFixedDoubleArray(instr); 4456 DoStoreKeyedFixedDoubleArray(instr);
4483 } else { 4457 } else {
4484 DoStoreKeyedFixedArray(instr); 4458 DoStoreKeyedFixedArray(instr);
4485 } 4459 }
4486 } 4460 }
4487 4461
4488 4462
4489 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 4463 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
6049 __ push(ToRegister(instr->function())); 6023 __ push(ToRegister(instr->function()));
6050 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6024 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6051 RecordSafepoint(Safepoint::kNoLazyDeopt); 6025 RecordSafepoint(Safepoint::kNoLazyDeopt);
6052 } 6026 }
6053 6027
6054 6028
6055 #undef __ 6029 #undef __
6056 6030
6057 } // namespace internal 6031 } // namespace internal
6058 } // namespace v8 6032 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698