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

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

Issue 1262583002: Reland of "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 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after
3224 } 3224 }
3225 } else { 3225 } else {
3226 key = ToRegister(instr->key()); 3226 key = ToRegister(instr->key());
3227 } 3227 }
3228 int element_size_shift = ElementsKindToShiftSize(elements_kind); 3228 int element_size_shift = ElementsKindToShiftSize(elements_kind);
3229 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 3229 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3230 ? (element_size_shift - (kSmiTagSize + kSmiShiftSize)) 3230 ? (element_size_shift - (kSmiTagSize + kSmiShiftSize))
3231 : element_size_shift; 3231 : element_size_shift;
3232 int base_offset = instr->base_offset(); 3232 int base_offset = instr->base_offset();
3233 3233
3234 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3234 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
3235 elements_kind == FLOAT32_ELEMENTS ||
3236 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
3237 elements_kind == FLOAT64_ELEMENTS) {
3238 FPURegister result = ToDoubleRegister(instr->result()); 3235 FPURegister result = ToDoubleRegister(instr->result());
3239 if (key_is_constant) { 3236 if (key_is_constant) {
3240 __ Daddu(scratch0(), external_pointer, 3237 __ Daddu(scratch0(), external_pointer,
3241 constant_key << element_size_shift); 3238 constant_key << element_size_shift);
3242 } else { 3239 } else {
3243 if (shift_size < 0) { 3240 if (shift_size < 0) {
3244 if (shift_size == -32) { 3241 if (shift_size == -32) {
3245 __ dsra32(scratch0(), key, 0); 3242 __ dsra32(scratch0(), key, 0);
3246 } else { 3243 } else {
3247 __ dsra(scratch0(), key, -shift_size); 3244 __ dsra(scratch0(), key, -shift_size);
3248 } 3245 }
3249 } else { 3246 } else {
3250 __ dsll(scratch0(), key, shift_size); 3247 __ dsll(scratch0(), key, shift_size);
3251 } 3248 }
3252 __ Daddu(scratch0(), scratch0(), external_pointer); 3249 __ Daddu(scratch0(), scratch0(), external_pointer);
3253 } 3250 }
3254 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3251 if (elements_kind == FLOAT32_ELEMENTS) {
3255 elements_kind == FLOAT32_ELEMENTS) {
3256 __ lwc1(result, MemOperand(scratch0(), base_offset)); 3252 __ lwc1(result, MemOperand(scratch0(), base_offset));
3257 __ cvt_d_s(result, result); 3253 __ cvt_d_s(result, result);
3258 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS 3254 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
3259 __ ldc1(result, MemOperand(scratch0(), base_offset)); 3255 __ ldc1(result, MemOperand(scratch0(), base_offset));
3260 } 3256 }
3261 } else { 3257 } else {
3262 Register result = ToRegister(instr->result()); 3258 Register result = ToRegister(instr->result());
3263 MemOperand mem_operand = PrepareKeyedOperand( 3259 MemOperand mem_operand = PrepareKeyedOperand(
3264 key, external_pointer, key_is_constant, constant_key, 3260 key, external_pointer, key_is_constant, constant_key,
3265 element_size_shift, shift_size, base_offset); 3261 element_size_shift, shift_size, base_offset);
3266 switch (elements_kind) { 3262 switch (elements_kind) {
3267 case EXTERNAL_INT8_ELEMENTS:
3268 case INT8_ELEMENTS: 3263 case INT8_ELEMENTS:
3269 __ lb(result, mem_operand); 3264 __ lb(result, mem_operand);
3270 break; 3265 break;
3271 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3272 case EXTERNAL_UINT8_ELEMENTS:
3273 case UINT8_ELEMENTS: 3266 case UINT8_ELEMENTS:
3274 case UINT8_CLAMPED_ELEMENTS: 3267 case UINT8_CLAMPED_ELEMENTS:
3275 __ lbu(result, mem_operand); 3268 __ lbu(result, mem_operand);
3276 break; 3269 break;
3277 case EXTERNAL_INT16_ELEMENTS:
3278 case INT16_ELEMENTS: 3270 case INT16_ELEMENTS:
3279 __ lh(result, mem_operand); 3271 __ lh(result, mem_operand);
3280 break; 3272 break;
3281 case EXTERNAL_UINT16_ELEMENTS:
3282 case UINT16_ELEMENTS: 3273 case UINT16_ELEMENTS:
3283 __ lhu(result, mem_operand); 3274 __ lhu(result, mem_operand);
3284 break; 3275 break;
3285 case EXTERNAL_INT32_ELEMENTS:
3286 case INT32_ELEMENTS: 3276 case INT32_ELEMENTS:
3287 __ lw(result, mem_operand); 3277 __ lw(result, mem_operand);
3288 break; 3278 break;
3289 case EXTERNAL_UINT32_ELEMENTS:
3290 case UINT32_ELEMENTS: 3279 case UINT32_ELEMENTS:
3291 __ lw(result, mem_operand); 3280 __ lw(result, mem_operand);
3292 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3281 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3293 DeoptimizeIf(Ugreater_equal, instr, Deoptimizer::kNegativeValue, 3282 DeoptimizeIf(Ugreater_equal, instr, Deoptimizer::kNegativeValue,
3294 result, Operand(0x80000000)); 3283 result, Operand(0x80000000));
3295 } 3284 }
3296 break; 3285 break;
3297 case FLOAT32_ELEMENTS: 3286 case FLOAT32_ELEMENTS:
3298 case FLOAT64_ELEMENTS: 3287 case FLOAT64_ELEMENTS:
3299 case EXTERNAL_FLOAT32_ELEMENTS:
3300 case EXTERNAL_FLOAT64_ELEMENTS:
3301 case FAST_DOUBLE_ELEMENTS: 3288 case FAST_DOUBLE_ELEMENTS:
3302 case FAST_ELEMENTS: 3289 case FAST_ELEMENTS:
3303 case FAST_SMI_ELEMENTS: 3290 case FAST_SMI_ELEMENTS:
3304 case FAST_HOLEY_DOUBLE_ELEMENTS: 3291 case FAST_HOLEY_DOUBLE_ELEMENTS:
3305 case FAST_HOLEY_ELEMENTS: 3292 case FAST_HOLEY_ELEMENTS:
3306 case FAST_HOLEY_SMI_ELEMENTS: 3293 case FAST_HOLEY_SMI_ELEMENTS:
3307 case DICTIONARY_ELEMENTS: 3294 case DICTIONARY_ELEMENTS:
3308 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 3295 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
3309 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 3296 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
3310 UNREACHABLE(); 3297 UNREACHABLE();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3428 DeoptimizeIf(ne, instr, Deoptimizer::kHole, result, 3415 DeoptimizeIf(ne, instr, Deoptimizer::kHole, result,
3429 Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); 3416 Operand(Smi::FromInt(Isolate::kArrayProtectorValid)));
3430 } 3417 }
3431 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); 3418 __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
3432 __ bind(&done); 3419 __ bind(&done);
3433 } 3420 }
3434 } 3421 }
3435 3422
3436 3423
3437 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { 3424 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3438 if (instr->is_typed_elements()) { 3425 if (instr->is_fixed_typed_array()) {
3439 DoLoadKeyedExternalArray(instr); 3426 DoLoadKeyedExternalArray(instr);
3440 } else if (instr->hydrogen()->representation().IsDouble()) { 3427 } else if (instr->hydrogen()->representation().IsDouble()) {
3441 DoLoadKeyedFixedDoubleArray(instr); 3428 DoLoadKeyedFixedDoubleArray(instr);
3442 } else { 3429 } else {
3443 DoLoadKeyedFixedArray(instr); 3430 DoLoadKeyedFixedArray(instr);
3444 } 3431 }
3445 } 3432 }
3446 3433
3447 3434
3448 MemOperand LCodeGen::PrepareKeyedOperand(Register key, 3435 MemOperand LCodeGen::PrepareKeyedOperand(Register key,
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
4459 } 4446 }
4460 } else { 4447 } else {
4461 key = ToRegister(instr->key()); 4448 key = ToRegister(instr->key());
4462 } 4449 }
4463 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4450 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4464 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4451 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4465 ? (element_size_shift - (kSmiTagSize + kSmiShiftSize)) 4452 ? (element_size_shift - (kSmiTagSize + kSmiShiftSize))
4466 : element_size_shift; 4453 : element_size_shift;
4467 int base_offset = instr->base_offset(); 4454 int base_offset = instr->base_offset();
4468 4455
4469 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4456 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
4470 elements_kind == FLOAT32_ELEMENTS ||
4471 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4472 elements_kind == FLOAT64_ELEMENTS) {
4473 Register address = scratch0(); 4457 Register address = scratch0();
4474 FPURegister value(ToDoubleRegister(instr->value())); 4458 FPURegister value(ToDoubleRegister(instr->value()));
4475 if (key_is_constant) { 4459 if (key_is_constant) {
4476 if (constant_key != 0) { 4460 if (constant_key != 0) {
4477 __ Daddu(address, external_pointer, 4461 __ Daddu(address, external_pointer,
4478 Operand(constant_key << element_size_shift)); 4462 Operand(constant_key << element_size_shift));
4479 } else { 4463 } else {
4480 address = external_pointer; 4464 address = external_pointer;
4481 } 4465 }
4482 } else { 4466 } else {
4483 if (shift_size < 0) { 4467 if (shift_size < 0) {
4484 if (shift_size == -32) { 4468 if (shift_size == -32) {
4485 __ dsra32(address, key, 0); 4469 __ dsra32(address, key, 0);
4486 } else { 4470 } else {
4487 __ dsra(address, key, -shift_size); 4471 __ dsra(address, key, -shift_size);
4488 } 4472 }
4489 } else { 4473 } else {
4490 __ dsll(address, key, shift_size); 4474 __ dsll(address, key, shift_size);
4491 } 4475 }
4492 __ Daddu(address, external_pointer, address); 4476 __ Daddu(address, external_pointer, address);
4493 } 4477 }
4494 4478
4495 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4479 if (elements_kind == FLOAT32_ELEMENTS) {
4496 elements_kind == FLOAT32_ELEMENTS) {
4497 __ cvt_s_d(double_scratch0(), value); 4480 __ cvt_s_d(double_scratch0(), value);
4498 __ swc1(double_scratch0(), MemOperand(address, base_offset)); 4481 __ swc1(double_scratch0(), MemOperand(address, base_offset));
4499 } else { // Storing doubles, not floats. 4482 } else { // Storing doubles, not floats.
4500 __ sdc1(value, MemOperand(address, base_offset)); 4483 __ sdc1(value, MemOperand(address, base_offset));
4501 } 4484 }
4502 } else { 4485 } else {
4503 Register value(ToRegister(instr->value())); 4486 Register value(ToRegister(instr->value()));
4504 MemOperand mem_operand = PrepareKeyedOperand( 4487 MemOperand mem_operand = PrepareKeyedOperand(
4505 key, external_pointer, key_is_constant, constant_key, 4488 key, external_pointer, key_is_constant, constant_key,
4506 element_size_shift, shift_size, 4489 element_size_shift, shift_size,
4507 base_offset); 4490 base_offset);
4508 switch (elements_kind) { 4491 switch (elements_kind) {
4509 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4510 case EXTERNAL_INT8_ELEMENTS:
4511 case EXTERNAL_UINT8_ELEMENTS:
4512 case UINT8_ELEMENTS: 4492 case UINT8_ELEMENTS:
4513 case UINT8_CLAMPED_ELEMENTS: 4493 case UINT8_CLAMPED_ELEMENTS:
4514 case INT8_ELEMENTS: 4494 case INT8_ELEMENTS:
4515 __ sb(value, mem_operand); 4495 __ sb(value, mem_operand);
4516 break; 4496 break;
4517 case EXTERNAL_INT16_ELEMENTS:
4518 case EXTERNAL_UINT16_ELEMENTS:
4519 case INT16_ELEMENTS: 4497 case INT16_ELEMENTS:
4520 case UINT16_ELEMENTS: 4498 case UINT16_ELEMENTS:
4521 __ sh(value, mem_operand); 4499 __ sh(value, mem_operand);
4522 break; 4500 break;
4523 case EXTERNAL_INT32_ELEMENTS:
4524 case EXTERNAL_UINT32_ELEMENTS:
4525 case INT32_ELEMENTS: 4501 case INT32_ELEMENTS:
4526 case UINT32_ELEMENTS: 4502 case UINT32_ELEMENTS:
4527 __ sw(value, mem_operand); 4503 __ sw(value, mem_operand);
4528 break; 4504 break;
4529 case FLOAT32_ELEMENTS: 4505 case FLOAT32_ELEMENTS:
4530 case FLOAT64_ELEMENTS: 4506 case FLOAT64_ELEMENTS:
4531 case EXTERNAL_FLOAT32_ELEMENTS:
4532 case EXTERNAL_FLOAT64_ELEMENTS:
4533 case FAST_DOUBLE_ELEMENTS: 4507 case FAST_DOUBLE_ELEMENTS:
4534 case FAST_ELEMENTS: 4508 case FAST_ELEMENTS:
4535 case FAST_SMI_ELEMENTS: 4509 case FAST_SMI_ELEMENTS:
4536 case FAST_HOLEY_DOUBLE_ELEMENTS: 4510 case FAST_HOLEY_DOUBLE_ELEMENTS:
4537 case FAST_HOLEY_ELEMENTS: 4511 case FAST_HOLEY_ELEMENTS:
4538 case FAST_HOLEY_SMI_ELEMENTS: 4512 case FAST_HOLEY_SMI_ELEMENTS:
4539 case DICTIONARY_ELEMENTS: 4513 case DICTIONARY_ELEMENTS:
4540 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 4514 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
4541 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 4515 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
4542 UNREACHABLE(); 4516 UNREACHABLE();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
4649 kSaveFPRegs, 4623 kSaveFPRegs,
4650 EMIT_REMEMBERED_SET, 4624 EMIT_REMEMBERED_SET,
4651 check_needed, 4625 check_needed,
4652 instr->hydrogen()->PointersToHereCheckForValue()); 4626 instr->hydrogen()->PointersToHereCheckForValue());
4653 } 4627 }
4654 } 4628 }
4655 4629
4656 4630
4657 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4631 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4658 // By cases: external, fast double 4632 // By cases: external, fast double
4659 if (instr->is_typed_elements()) { 4633 if (instr->is_fixed_typed_array()) {
4660 DoStoreKeyedExternalArray(instr); 4634 DoStoreKeyedExternalArray(instr);
4661 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4635 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4662 DoStoreKeyedFixedDoubleArray(instr); 4636 DoStoreKeyedFixedDoubleArray(instr);
4663 } else { 4637 } else {
4664 DoStoreKeyedFixedArray(instr); 4638 DoStoreKeyedFixedArray(instr);
4665 } 4639 }
4666 } 4640 }
4667 4641
4668 4642
4669 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 4643 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
6268 __ Push(at, ToRegister(instr->function())); 6242 __ Push(at, ToRegister(instr->function()));
6269 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6243 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6270 RecordSafepoint(Safepoint::kNoLazyDeopt); 6244 RecordSafepoint(Safepoint::kNoLazyDeopt);
6271 } 6245 }
6272 6246
6273 6247
6274 #undef __ 6248 #undef __
6275 6249
6276 } // namespace internal 6250 } // namespace internal
6277 } // namespace v8 6251 } // 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