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

Side by Side Diff: src/mips64/lithium-codegen-mips64.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
« no previous file with comments | « src/mips/lithium-mips.cc ('k') | src/mips64/lithium-mips64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/cpu-profiler.h" 9 #include "src/cpu-profiler.h"
10 #include "src/hydrogen-osr.h" 10 #include "src/hydrogen-osr.h"
(...skipping 3216 matching lines...) Expand 10 before | Expand all | Expand 10 after
3227 } 3227 }
3228 } else { 3228 } else {
3229 key = ToRegister(instr->key()); 3229 key = ToRegister(instr->key());
3230 } 3230 }
3231 int element_size_shift = ElementsKindToShiftSize(elements_kind); 3231 int element_size_shift = ElementsKindToShiftSize(elements_kind);
3232 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 3232 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3233 ? (element_size_shift - (kSmiTagSize + kSmiShiftSize)) 3233 ? (element_size_shift - (kSmiTagSize + kSmiShiftSize))
3234 : element_size_shift; 3234 : element_size_shift;
3235 int base_offset = instr->base_offset(); 3235 int base_offset = instr->base_offset();
3236 3236
3237 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3237 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
3238 elements_kind == FLOAT32_ELEMENTS ||
3239 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
3240 elements_kind == FLOAT64_ELEMENTS) {
3241 FPURegister result = ToDoubleRegister(instr->result()); 3238 FPURegister result = ToDoubleRegister(instr->result());
3242 if (key_is_constant) { 3239 if (key_is_constant) {
3243 __ Daddu(scratch0(), external_pointer, 3240 __ Daddu(scratch0(), external_pointer,
3244 constant_key << element_size_shift); 3241 constant_key << element_size_shift);
3245 } else { 3242 } else {
3246 if (shift_size < 0) { 3243 if (shift_size < 0) {
3247 if (shift_size == -32) { 3244 if (shift_size == -32) {
3248 __ dsra32(scratch0(), key, 0); 3245 __ dsra32(scratch0(), key, 0);
3249 } else { 3246 } else {
3250 __ dsra(scratch0(), key, -shift_size); 3247 __ dsra(scratch0(), key, -shift_size);
3251 } 3248 }
3252 } else { 3249 } else {
3253 __ dsll(scratch0(), key, shift_size); 3250 __ dsll(scratch0(), key, shift_size);
3254 } 3251 }
3255 __ Daddu(scratch0(), scratch0(), external_pointer); 3252 __ Daddu(scratch0(), scratch0(), external_pointer);
3256 } 3253 }
3257 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3254 if (elements_kind == FLOAT32_ELEMENTS) {
3258 elements_kind == FLOAT32_ELEMENTS) {
3259 __ lwc1(result, MemOperand(scratch0(), base_offset)); 3255 __ lwc1(result, MemOperand(scratch0(), base_offset));
3260 __ cvt_d_s(result, result); 3256 __ cvt_d_s(result, result);
3261 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS 3257 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
3262 __ ldc1(result, MemOperand(scratch0(), base_offset)); 3258 __ ldc1(result, MemOperand(scratch0(), base_offset));
3263 } 3259 }
3264 } else { 3260 } else {
3265 Register result = ToRegister(instr->result()); 3261 Register result = ToRegister(instr->result());
3266 MemOperand mem_operand = PrepareKeyedOperand( 3262 MemOperand mem_operand = PrepareKeyedOperand(
3267 key, external_pointer, key_is_constant, constant_key, 3263 key, external_pointer, key_is_constant, constant_key,
3268 element_size_shift, shift_size, base_offset); 3264 element_size_shift, shift_size, base_offset);
3269 switch (elements_kind) { 3265 switch (elements_kind) {
3270 case EXTERNAL_INT8_ELEMENTS:
3271 case INT8_ELEMENTS: 3266 case INT8_ELEMENTS:
3272 __ lb(result, mem_operand); 3267 __ lb(result, mem_operand);
3273 break; 3268 break;
3274 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3275 case EXTERNAL_UINT8_ELEMENTS:
3276 case UINT8_ELEMENTS: 3269 case UINT8_ELEMENTS:
3277 case UINT8_CLAMPED_ELEMENTS: 3270 case UINT8_CLAMPED_ELEMENTS:
3278 __ lbu(result, mem_operand); 3271 __ lbu(result, mem_operand);
3279 break; 3272 break;
3280 case EXTERNAL_INT16_ELEMENTS:
3281 case INT16_ELEMENTS: 3273 case INT16_ELEMENTS:
3282 __ lh(result, mem_operand); 3274 __ lh(result, mem_operand);
3283 break; 3275 break;
3284 case EXTERNAL_UINT16_ELEMENTS:
3285 case UINT16_ELEMENTS: 3276 case UINT16_ELEMENTS:
3286 __ lhu(result, mem_operand); 3277 __ lhu(result, mem_operand);
3287 break; 3278 break;
3288 case EXTERNAL_INT32_ELEMENTS:
3289 case INT32_ELEMENTS: 3279 case INT32_ELEMENTS:
3290 __ lw(result, mem_operand); 3280 __ lw(result, mem_operand);
3291 break; 3281 break;
3292 case EXTERNAL_UINT32_ELEMENTS:
3293 case UINT32_ELEMENTS: 3282 case UINT32_ELEMENTS:
3294 __ lw(result, mem_operand); 3283 __ lw(result, mem_operand);
3295 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3284 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3296 DeoptimizeIf(Ugreater_equal, instr, Deoptimizer::kNegativeValue, 3285 DeoptimizeIf(Ugreater_equal, instr, Deoptimizer::kNegativeValue,
3297 result, Operand(0x80000000)); 3286 result, Operand(0x80000000));
3298 } 3287 }
3299 break; 3288 break;
3300 case FLOAT32_ELEMENTS: 3289 case FLOAT32_ELEMENTS:
3301 case FLOAT64_ELEMENTS: 3290 case FLOAT64_ELEMENTS:
3302 case EXTERNAL_FLOAT32_ELEMENTS:
3303 case EXTERNAL_FLOAT64_ELEMENTS:
3304 case FAST_DOUBLE_ELEMENTS: 3291 case FAST_DOUBLE_ELEMENTS:
3305 case FAST_ELEMENTS: 3292 case FAST_ELEMENTS:
3306 case FAST_SMI_ELEMENTS: 3293 case FAST_SMI_ELEMENTS:
3307 case FAST_HOLEY_DOUBLE_ELEMENTS: 3294 case FAST_HOLEY_DOUBLE_ELEMENTS:
3308 case FAST_HOLEY_ELEMENTS: 3295 case FAST_HOLEY_ELEMENTS:
3309 case FAST_HOLEY_SMI_ELEMENTS: 3296 case FAST_HOLEY_SMI_ELEMENTS:
3310 case DICTIONARY_ELEMENTS: 3297 case DICTIONARY_ELEMENTS:
3311 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 3298 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
3312 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 3299 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
3313 UNREACHABLE(); 3300 UNREACHABLE();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 DeoptimizeIf(ne, instr, Deoptimizer::kHole, result, 3418 DeoptimizeIf(ne, instr, Deoptimizer::kHole, result,
3432 Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); 3419 Operand(Smi::FromInt(Isolate::kArrayProtectorValid)));
3433 } 3420 }
3434 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); 3421 __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
3435 __ bind(&done); 3422 __ bind(&done);
3436 } 3423 }
3437 } 3424 }
3438 3425
3439 3426
3440 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { 3427 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3441 if (instr->is_typed_elements()) { 3428 if (instr->is_fixed_typed_array()) {
3442 DoLoadKeyedExternalArray(instr); 3429 DoLoadKeyedExternalArray(instr);
3443 } else if (instr->hydrogen()->representation().IsDouble()) { 3430 } else if (instr->hydrogen()->representation().IsDouble()) {
3444 DoLoadKeyedFixedDoubleArray(instr); 3431 DoLoadKeyedFixedDoubleArray(instr);
3445 } else { 3432 } else {
3446 DoLoadKeyedFixedArray(instr); 3433 DoLoadKeyedFixedArray(instr);
3447 } 3434 }
3448 } 3435 }
3449 3436
3450 3437
3451 MemOperand LCodeGen::PrepareKeyedOperand(Register key, 3438 MemOperand LCodeGen::PrepareKeyedOperand(Register key,
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
4465 } 4452 }
4466 } else { 4453 } else {
4467 key = ToRegister(instr->key()); 4454 key = ToRegister(instr->key());
4468 } 4455 }
4469 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4456 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4470 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4457 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4471 ? (element_size_shift - (kSmiTagSize + kSmiShiftSize)) 4458 ? (element_size_shift - (kSmiTagSize + kSmiShiftSize))
4472 : element_size_shift; 4459 : element_size_shift;
4473 int base_offset = instr->base_offset(); 4460 int base_offset = instr->base_offset();
4474 4461
4475 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4462 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
4476 elements_kind == FLOAT32_ELEMENTS ||
4477 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4478 elements_kind == FLOAT64_ELEMENTS) {
4479 Register address = scratch0(); 4463 Register address = scratch0();
4480 FPURegister value(ToDoubleRegister(instr->value())); 4464 FPURegister value(ToDoubleRegister(instr->value()));
4481 if (key_is_constant) { 4465 if (key_is_constant) {
4482 if (constant_key != 0) { 4466 if (constant_key != 0) {
4483 __ Daddu(address, external_pointer, 4467 __ Daddu(address, external_pointer,
4484 Operand(constant_key << element_size_shift)); 4468 Operand(constant_key << element_size_shift));
4485 } else { 4469 } else {
4486 address = external_pointer; 4470 address = external_pointer;
4487 } 4471 }
4488 } else { 4472 } else {
4489 if (shift_size < 0) { 4473 if (shift_size < 0) {
4490 if (shift_size == -32) { 4474 if (shift_size == -32) {
4491 __ dsra32(address, key, 0); 4475 __ dsra32(address, key, 0);
4492 } else { 4476 } else {
4493 __ dsra(address, key, -shift_size); 4477 __ dsra(address, key, -shift_size);
4494 } 4478 }
4495 } else { 4479 } else {
4496 __ dsll(address, key, shift_size); 4480 __ dsll(address, key, shift_size);
4497 } 4481 }
4498 __ Daddu(address, external_pointer, address); 4482 __ Daddu(address, external_pointer, address);
4499 } 4483 }
4500 4484
4501 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4485 if (elements_kind == FLOAT32_ELEMENTS) {
4502 elements_kind == FLOAT32_ELEMENTS) {
4503 __ cvt_s_d(double_scratch0(), value); 4486 __ cvt_s_d(double_scratch0(), value);
4504 __ swc1(double_scratch0(), MemOperand(address, base_offset)); 4487 __ swc1(double_scratch0(), MemOperand(address, base_offset));
4505 } else { // Storing doubles, not floats. 4488 } else { // Storing doubles, not floats.
4506 __ sdc1(value, MemOperand(address, base_offset)); 4489 __ sdc1(value, MemOperand(address, base_offset));
4507 } 4490 }
4508 } else { 4491 } else {
4509 Register value(ToRegister(instr->value())); 4492 Register value(ToRegister(instr->value()));
4510 MemOperand mem_operand = PrepareKeyedOperand( 4493 MemOperand mem_operand = PrepareKeyedOperand(
4511 key, external_pointer, key_is_constant, constant_key, 4494 key, external_pointer, key_is_constant, constant_key,
4512 element_size_shift, shift_size, 4495 element_size_shift, shift_size,
4513 base_offset); 4496 base_offset);
4514 switch (elements_kind) { 4497 switch (elements_kind) {
4515 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4516 case EXTERNAL_INT8_ELEMENTS:
4517 case EXTERNAL_UINT8_ELEMENTS:
4518 case UINT8_ELEMENTS: 4498 case UINT8_ELEMENTS:
4519 case UINT8_CLAMPED_ELEMENTS: 4499 case UINT8_CLAMPED_ELEMENTS:
4520 case INT8_ELEMENTS: 4500 case INT8_ELEMENTS:
4521 __ sb(value, mem_operand); 4501 __ sb(value, mem_operand);
4522 break; 4502 break;
4523 case EXTERNAL_INT16_ELEMENTS:
4524 case EXTERNAL_UINT16_ELEMENTS:
4525 case INT16_ELEMENTS: 4503 case INT16_ELEMENTS:
4526 case UINT16_ELEMENTS: 4504 case UINT16_ELEMENTS:
4527 __ sh(value, mem_operand); 4505 __ sh(value, mem_operand);
4528 break; 4506 break;
4529 case EXTERNAL_INT32_ELEMENTS:
4530 case EXTERNAL_UINT32_ELEMENTS:
4531 case INT32_ELEMENTS: 4507 case INT32_ELEMENTS:
4532 case UINT32_ELEMENTS: 4508 case UINT32_ELEMENTS:
4533 __ sw(value, mem_operand); 4509 __ sw(value, mem_operand);
4534 break; 4510 break;
4535 case FLOAT32_ELEMENTS: 4511 case FLOAT32_ELEMENTS:
4536 case FLOAT64_ELEMENTS: 4512 case FLOAT64_ELEMENTS:
4537 case EXTERNAL_FLOAT32_ELEMENTS:
4538 case EXTERNAL_FLOAT64_ELEMENTS:
4539 case FAST_DOUBLE_ELEMENTS: 4513 case FAST_DOUBLE_ELEMENTS:
4540 case FAST_ELEMENTS: 4514 case FAST_ELEMENTS:
4541 case FAST_SMI_ELEMENTS: 4515 case FAST_SMI_ELEMENTS:
4542 case FAST_HOLEY_DOUBLE_ELEMENTS: 4516 case FAST_HOLEY_DOUBLE_ELEMENTS:
4543 case FAST_HOLEY_ELEMENTS: 4517 case FAST_HOLEY_ELEMENTS:
4544 case FAST_HOLEY_SMI_ELEMENTS: 4518 case FAST_HOLEY_SMI_ELEMENTS:
4545 case DICTIONARY_ELEMENTS: 4519 case DICTIONARY_ELEMENTS:
4546 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 4520 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
4547 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 4521 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
4548 UNREACHABLE(); 4522 UNREACHABLE();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
4655 kSaveFPRegs, 4629 kSaveFPRegs,
4656 EMIT_REMEMBERED_SET, 4630 EMIT_REMEMBERED_SET,
4657 check_needed, 4631 check_needed,
4658 instr->hydrogen()->PointersToHereCheckForValue()); 4632 instr->hydrogen()->PointersToHereCheckForValue());
4659 } 4633 }
4660 } 4634 }
4661 4635
4662 4636
4663 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4637 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4664 // By cases: external, fast double 4638 // By cases: external, fast double
4665 if (instr->is_typed_elements()) { 4639 if (instr->is_fixed_typed_array()) {
4666 DoStoreKeyedExternalArray(instr); 4640 DoStoreKeyedExternalArray(instr);
4667 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4641 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4668 DoStoreKeyedFixedDoubleArray(instr); 4642 DoStoreKeyedFixedDoubleArray(instr);
4669 } else { 4643 } else {
4670 DoStoreKeyedFixedArray(instr); 4644 DoStoreKeyedFixedArray(instr);
4671 } 4645 }
4672 } 4646 }
4673 4647
4674 4648
4675 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 4649 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
6274 __ Push(at, ToRegister(instr->function())); 6248 __ Push(at, ToRegister(instr->function()));
6275 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6249 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6276 RecordSafepoint(Safepoint::kNoLazyDeopt); 6250 RecordSafepoint(Safepoint::kNoLazyDeopt);
6277 } 6251 }
6278 6252
6279 6253
6280 #undef __ 6254 #undef __
6281 6255
6282 } // namespace internal 6256 } // namespace internal
6283 } // namespace v8 6257 } // namespace v8
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.cc ('k') | src/mips64/lithium-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698