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

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, 5 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 3168 matching lines...) Expand 10 before | Expand all | Expand 10 after
3179 Abort(kArrayIndexConstantValueTooBig); 3179 Abort(kArrayIndexConstantValueTooBig);
3180 } 3180 }
3181 } else { 3181 } else {
3182 key = ToRegister(instr->key()); 3182 key = ToRegister(instr->key());
3183 } 3183 }
3184 int element_size_shift = ElementsKindToShiftSize(elements_kind); 3184 int element_size_shift = ElementsKindToShiftSize(elements_kind);
3185 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 3185 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3186 ? (element_size_shift - kSmiTagSize) : element_size_shift; 3186 ? (element_size_shift - kSmiTagSize) : element_size_shift;
3187 int base_offset = instr->base_offset(); 3187 int base_offset = instr->base_offset();
3188 3188
3189 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3189 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
3190 elements_kind == FLOAT32_ELEMENTS ||
3191 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
3192 elements_kind == FLOAT64_ELEMENTS) {
3193 DwVfpRegister result = ToDoubleRegister(instr->result()); 3190 DwVfpRegister result = ToDoubleRegister(instr->result());
3194 Operand operand = key_is_constant 3191 Operand operand = key_is_constant
3195 ? Operand(constant_key << element_size_shift) 3192 ? Operand(constant_key << element_size_shift)
3196 : Operand(key, LSL, shift_size); 3193 : Operand(key, LSL, shift_size);
3197 __ add(scratch0(), external_pointer, operand); 3194 __ add(scratch0(), external_pointer, operand);
3198 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3195 if (elements_kind == FLOAT32_ELEMENTS) {
3199 elements_kind == FLOAT32_ELEMENTS) {
3200 __ vldr(double_scratch0().low(), scratch0(), base_offset); 3196 __ vldr(double_scratch0().low(), scratch0(), base_offset);
3201 __ vcvt_f64_f32(result, double_scratch0().low()); 3197 __ vcvt_f64_f32(result, double_scratch0().low());
3202 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS 3198 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
3203 __ vldr(result, scratch0(), base_offset); 3199 __ vldr(result, scratch0(), base_offset);
3204 } 3200 }
3205 } else { 3201 } else {
3206 Register result = ToRegister(instr->result()); 3202 Register result = ToRegister(instr->result());
3207 MemOperand mem_operand = PrepareKeyedOperand( 3203 MemOperand mem_operand = PrepareKeyedOperand(
3208 key, external_pointer, key_is_constant, constant_key, 3204 key, external_pointer, key_is_constant, constant_key,
3209 element_size_shift, shift_size, base_offset); 3205 element_size_shift, shift_size, base_offset);
3210 switch (elements_kind) { 3206 switch (elements_kind) {
3211 case EXTERNAL_INT8_ELEMENTS:
3212 case INT8_ELEMENTS: 3207 case INT8_ELEMENTS:
3213 __ ldrsb(result, mem_operand); 3208 __ ldrsb(result, mem_operand);
3214 break; 3209 break;
3215 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3216 case EXTERNAL_UINT8_ELEMENTS:
3217 case UINT8_ELEMENTS: 3210 case UINT8_ELEMENTS:
3218 case UINT8_CLAMPED_ELEMENTS: 3211 case UINT8_CLAMPED_ELEMENTS:
3219 __ ldrb(result, mem_operand); 3212 __ ldrb(result, mem_operand);
3220 break; 3213 break;
3221 case EXTERNAL_INT16_ELEMENTS:
3222 case INT16_ELEMENTS: 3214 case INT16_ELEMENTS:
3223 __ ldrsh(result, mem_operand); 3215 __ ldrsh(result, mem_operand);
3224 break; 3216 break;
3225 case EXTERNAL_UINT16_ELEMENTS:
3226 case UINT16_ELEMENTS: 3217 case UINT16_ELEMENTS:
3227 __ ldrh(result, mem_operand); 3218 __ ldrh(result, mem_operand);
3228 break; 3219 break;
3229 case EXTERNAL_INT32_ELEMENTS:
3230 case INT32_ELEMENTS: 3220 case INT32_ELEMENTS:
3231 __ ldr(result, mem_operand); 3221 __ ldr(result, mem_operand);
3232 break; 3222 break;
3233 case EXTERNAL_UINT32_ELEMENTS:
3234 case UINT32_ELEMENTS: 3223 case UINT32_ELEMENTS:
3235 __ ldr(result, mem_operand); 3224 __ ldr(result, mem_operand);
3236 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3225 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3237 __ cmp(result, Operand(0x80000000)); 3226 __ cmp(result, Operand(0x80000000));
3238 DeoptimizeIf(cs, instr, Deoptimizer::kNegativeValue); 3227 DeoptimizeIf(cs, instr, Deoptimizer::kNegativeValue);
3239 } 3228 }
3240 break; 3229 break;
3241 case FLOAT32_ELEMENTS: 3230 case FLOAT32_ELEMENTS:
3242 case FLOAT64_ELEMENTS: 3231 case FLOAT64_ELEMENTS:
3243 case EXTERNAL_FLOAT32_ELEMENTS:
3244 case EXTERNAL_FLOAT64_ELEMENTS:
3245 case FAST_HOLEY_DOUBLE_ELEMENTS: 3232 case FAST_HOLEY_DOUBLE_ELEMENTS:
3246 case FAST_HOLEY_ELEMENTS: 3233 case FAST_HOLEY_ELEMENTS:
3247 case FAST_HOLEY_SMI_ELEMENTS: 3234 case FAST_HOLEY_SMI_ELEMENTS:
3248 case FAST_DOUBLE_ELEMENTS: 3235 case FAST_DOUBLE_ELEMENTS:
3249 case FAST_ELEMENTS: 3236 case FAST_ELEMENTS:
3250 case FAST_SMI_ELEMENTS: 3237 case FAST_SMI_ELEMENTS:
3251 case DICTIONARY_ELEMENTS: 3238 case DICTIONARY_ELEMENTS:
3252 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 3239 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
3253 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 3240 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
3254 UNREACHABLE(); 3241 UNREACHABLE();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
3344 __ cmp(result, Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); 3331 __ cmp(result, Operand(Smi::FromInt(Isolate::kArrayProtectorValid)));
3345 DeoptimizeIf(ne, instr, Deoptimizer::kHole); 3332 DeoptimizeIf(ne, instr, Deoptimizer::kHole);
3346 } 3333 }
3347 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); 3334 __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
3348 __ bind(&done); 3335 __ bind(&done);
3349 } 3336 }
3350 } 3337 }
3351 3338
3352 3339
3353 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { 3340 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3354 if (instr->is_typed_elements()) { 3341 if (instr->is_fixed_typed_array()) {
3355 DoLoadKeyedExternalArray(instr); 3342 DoLoadKeyedExternalArray(instr);
3356 } else if (instr->hydrogen()->representation().IsDouble()) { 3343 } else if (instr->hydrogen()->representation().IsDouble()) {
3357 DoLoadKeyedFixedDoubleArray(instr); 3344 DoLoadKeyedFixedDoubleArray(instr);
3358 } else { 3345 } else {
3359 DoLoadKeyedFixedArray(instr); 3346 DoLoadKeyedFixedArray(instr);
3360 } 3347 }
3361 } 3348 }
3362 3349
3363 3350
3364 MemOperand LCodeGen::PrepareKeyedOperand(Register key, 3351 MemOperand LCodeGen::PrepareKeyedOperand(Register key,
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
4298 Abort(kArrayIndexConstantValueTooBig); 4285 Abort(kArrayIndexConstantValueTooBig);
4299 } 4286 }
4300 } else { 4287 } else {
4301 key = ToRegister(instr->key()); 4288 key = ToRegister(instr->key());
4302 } 4289 }
4303 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4290 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4304 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4291 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4305 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4292 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4306 int base_offset = instr->base_offset(); 4293 int base_offset = instr->base_offset();
4307 4294
4308 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4295 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
4309 elements_kind == FLOAT32_ELEMENTS ||
4310 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4311 elements_kind == FLOAT64_ELEMENTS) {
4312 Register address = scratch0(); 4296 Register address = scratch0();
4313 DwVfpRegister value(ToDoubleRegister(instr->value())); 4297 DwVfpRegister value(ToDoubleRegister(instr->value()));
4314 if (key_is_constant) { 4298 if (key_is_constant) {
4315 if (constant_key != 0) { 4299 if (constant_key != 0) {
4316 __ add(address, external_pointer, 4300 __ add(address, external_pointer,
4317 Operand(constant_key << element_size_shift)); 4301 Operand(constant_key << element_size_shift));
4318 } else { 4302 } else {
4319 address = external_pointer; 4303 address = external_pointer;
4320 } 4304 }
4321 } else { 4305 } else {
4322 __ add(address, external_pointer, Operand(key, LSL, shift_size)); 4306 __ add(address, external_pointer, Operand(key, LSL, shift_size));
4323 } 4307 }
4324 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4308 if (elements_kind == FLOAT32_ELEMENTS) {
4325 elements_kind == FLOAT32_ELEMENTS) {
4326 __ vcvt_f32_f64(double_scratch0().low(), value); 4309 __ vcvt_f32_f64(double_scratch0().low(), value);
4327 __ vstr(double_scratch0().low(), address, base_offset); 4310 __ vstr(double_scratch0().low(), address, base_offset);
4328 } else { // Storing doubles, not floats. 4311 } else { // Storing doubles, not floats.
4329 __ vstr(value, address, base_offset); 4312 __ vstr(value, address, base_offset);
4330 } 4313 }
4331 } else { 4314 } else {
4332 Register value(ToRegister(instr->value())); 4315 Register value(ToRegister(instr->value()));
4333 MemOperand mem_operand = PrepareKeyedOperand( 4316 MemOperand mem_operand = PrepareKeyedOperand(
4334 key, external_pointer, key_is_constant, constant_key, 4317 key, external_pointer, key_is_constant, constant_key,
4335 element_size_shift, shift_size, 4318 element_size_shift, shift_size,
4336 base_offset); 4319 base_offset);
4337 switch (elements_kind) { 4320 switch (elements_kind) {
4338 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4339 case EXTERNAL_INT8_ELEMENTS:
4340 case EXTERNAL_UINT8_ELEMENTS:
4341 case UINT8_ELEMENTS: 4321 case UINT8_ELEMENTS:
4342 case UINT8_CLAMPED_ELEMENTS: 4322 case UINT8_CLAMPED_ELEMENTS:
4343 case INT8_ELEMENTS: 4323 case INT8_ELEMENTS:
4344 __ strb(value, mem_operand); 4324 __ strb(value, mem_operand);
4345 break; 4325 break;
4346 case EXTERNAL_INT16_ELEMENTS:
4347 case EXTERNAL_UINT16_ELEMENTS:
4348 case INT16_ELEMENTS: 4326 case INT16_ELEMENTS:
4349 case UINT16_ELEMENTS: 4327 case UINT16_ELEMENTS:
4350 __ strh(value, mem_operand); 4328 __ strh(value, mem_operand);
4351 break; 4329 break;
4352 case EXTERNAL_INT32_ELEMENTS:
4353 case EXTERNAL_UINT32_ELEMENTS:
4354 case INT32_ELEMENTS: 4330 case INT32_ELEMENTS:
4355 case UINT32_ELEMENTS: 4331 case UINT32_ELEMENTS:
4356 __ str(value, mem_operand); 4332 __ str(value, mem_operand);
4357 break; 4333 break;
4358 case FLOAT32_ELEMENTS: 4334 case FLOAT32_ELEMENTS:
4359 case FLOAT64_ELEMENTS: 4335 case FLOAT64_ELEMENTS:
4360 case EXTERNAL_FLOAT32_ELEMENTS:
4361 case EXTERNAL_FLOAT64_ELEMENTS:
4362 case FAST_DOUBLE_ELEMENTS: 4336 case FAST_DOUBLE_ELEMENTS:
4363 case FAST_ELEMENTS: 4337 case FAST_ELEMENTS:
4364 case FAST_SMI_ELEMENTS: 4338 case FAST_SMI_ELEMENTS:
4365 case FAST_HOLEY_DOUBLE_ELEMENTS: 4339 case FAST_HOLEY_DOUBLE_ELEMENTS:
4366 case FAST_HOLEY_ELEMENTS: 4340 case FAST_HOLEY_ELEMENTS:
4367 case FAST_HOLEY_SMI_ELEMENTS: 4341 case FAST_HOLEY_SMI_ELEMENTS:
4368 case DICTIONARY_ELEMENTS: 4342 case DICTIONARY_ELEMENTS:
4369 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 4343 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
4370 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 4344 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
4371 UNREACHABLE(); 4345 UNREACHABLE();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
4457 kSaveFPRegs, 4431 kSaveFPRegs,
4458 EMIT_REMEMBERED_SET, 4432 EMIT_REMEMBERED_SET,
4459 check_needed, 4433 check_needed,
4460 instr->hydrogen()->PointersToHereCheckForValue()); 4434 instr->hydrogen()->PointersToHereCheckForValue());
4461 } 4435 }
4462 } 4436 }
4463 4437
4464 4438
4465 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4439 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4466 // By cases: external, fast double 4440 // By cases: external, fast double
4467 if (instr->is_typed_elements()) { 4441 if (instr->is_fixed_typed_array()) {
4468 DoStoreKeyedExternalArray(instr); 4442 DoStoreKeyedExternalArray(instr);
4469 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4443 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4470 DoStoreKeyedFixedDoubleArray(instr); 4444 DoStoreKeyedFixedDoubleArray(instr);
4471 } else { 4445 } else {
4472 DoStoreKeyedFixedArray(instr); 4446 DoStoreKeyedFixedArray(instr);
4473 } 4447 }
4474 } 4448 }
4475 4449
4476 4450
4477 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 4451 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
6037 __ push(ToRegister(instr->function())); 6011 __ push(ToRegister(instr->function()));
6038 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6012 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6039 RecordSafepoint(Safepoint::kNoLazyDeopt); 6013 RecordSafepoint(Safepoint::kNoLazyDeopt);
6040 } 6014 }
6041 6015
6042 6016
6043 #undef __ 6017 #undef __
6044 6018
6045 } // namespace internal 6019 } // namespace internal
6046 } // namespace v8 6020 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/arm64/lithium-arm64.cc » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698