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

Side by Side Diff: src/ppc/lithium-codegen-ppc.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/objects-printer.cc ('k') | src/ppc/lithium-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/cpu-profiler.h" 10 #include "src/cpu-profiler.h"
(...skipping 3275 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 if (constant_key & 0xF0000000) { 3286 if (constant_key & 0xF0000000) {
3287 Abort(kArrayIndexConstantValueTooBig); 3287 Abort(kArrayIndexConstantValueTooBig);
3288 } 3288 }
3289 } else { 3289 } else {
3290 key = ToRegister(instr->key()); 3290 key = ToRegister(instr->key());
3291 } 3291 }
3292 int element_size_shift = ElementsKindToShiftSize(elements_kind); 3292 int element_size_shift = ElementsKindToShiftSize(elements_kind);
3293 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi(); 3293 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
3294 int base_offset = instr->base_offset(); 3294 int base_offset = instr->base_offset();
3295 3295
3296 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3296 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
3297 elements_kind == FLOAT32_ELEMENTS ||
3298 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
3299 elements_kind == FLOAT64_ELEMENTS) {
3300 DoubleRegister result = ToDoubleRegister(instr->result()); 3297 DoubleRegister result = ToDoubleRegister(instr->result());
3301 if (key_is_constant) { 3298 if (key_is_constant) {
3302 __ Add(scratch0(), external_pointer, constant_key << element_size_shift, 3299 __ Add(scratch0(), external_pointer, constant_key << element_size_shift,
3303 r0); 3300 r0);
3304 } else { 3301 } else {
3305 __ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi); 3302 __ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi);
3306 __ add(scratch0(), external_pointer, r0); 3303 __ add(scratch0(), external_pointer, r0);
3307 } 3304 }
3308 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3305 if (elements_kind == FLOAT32_ELEMENTS) {
3309 elements_kind == FLOAT32_ELEMENTS) {
3310 __ lfs(result, MemOperand(scratch0(), base_offset)); 3306 __ lfs(result, MemOperand(scratch0(), base_offset));
3311 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS 3307 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
3312 __ lfd(result, MemOperand(scratch0(), base_offset)); 3308 __ lfd(result, MemOperand(scratch0(), base_offset));
3313 } 3309 }
3314 } else { 3310 } else {
3315 Register result = ToRegister(instr->result()); 3311 Register result = ToRegister(instr->result());
3316 MemOperand mem_operand = 3312 MemOperand mem_operand =
3317 PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi, 3313 PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi,
3318 constant_key, element_size_shift, base_offset); 3314 constant_key, element_size_shift, base_offset);
3319 switch (elements_kind) { 3315 switch (elements_kind) {
3320 case EXTERNAL_INT8_ELEMENTS:
3321 case INT8_ELEMENTS: 3316 case INT8_ELEMENTS:
3322 if (key_is_constant) { 3317 if (key_is_constant) {
3323 __ LoadByte(result, mem_operand, r0); 3318 __ LoadByte(result, mem_operand, r0);
3324 } else { 3319 } else {
3325 __ lbzx(result, mem_operand); 3320 __ lbzx(result, mem_operand);
3326 } 3321 }
3327 __ extsb(result, result); 3322 __ extsb(result, result);
3328 break; 3323 break;
3329 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3330 case EXTERNAL_UINT8_ELEMENTS:
3331 case UINT8_ELEMENTS: 3324 case UINT8_ELEMENTS:
3332 case UINT8_CLAMPED_ELEMENTS: 3325 case UINT8_CLAMPED_ELEMENTS:
3333 if (key_is_constant) { 3326 if (key_is_constant) {
3334 __ LoadByte(result, mem_operand, r0); 3327 __ LoadByte(result, mem_operand, r0);
3335 } else { 3328 } else {
3336 __ lbzx(result, mem_operand); 3329 __ lbzx(result, mem_operand);
3337 } 3330 }
3338 break; 3331 break;
3339 case EXTERNAL_INT16_ELEMENTS:
3340 case INT16_ELEMENTS: 3332 case INT16_ELEMENTS:
3341 if (key_is_constant) { 3333 if (key_is_constant) {
3342 __ LoadHalfWordArith(result, mem_operand, r0); 3334 __ LoadHalfWordArith(result, mem_operand, r0);
3343 } else { 3335 } else {
3344 __ lhax(result, mem_operand); 3336 __ lhax(result, mem_operand);
3345 } 3337 }
3346 break; 3338 break;
3347 case EXTERNAL_UINT16_ELEMENTS:
3348 case UINT16_ELEMENTS: 3339 case UINT16_ELEMENTS:
3349 if (key_is_constant) { 3340 if (key_is_constant) {
3350 __ LoadHalfWord(result, mem_operand, r0); 3341 __ LoadHalfWord(result, mem_operand, r0);
3351 } else { 3342 } else {
3352 __ lhzx(result, mem_operand); 3343 __ lhzx(result, mem_operand);
3353 } 3344 }
3354 break; 3345 break;
3355 case EXTERNAL_INT32_ELEMENTS:
3356 case INT32_ELEMENTS: 3346 case INT32_ELEMENTS:
3357 if (key_is_constant) { 3347 if (key_is_constant) {
3358 __ LoadWordArith(result, mem_operand, r0); 3348 __ LoadWordArith(result, mem_operand, r0);
3359 } else { 3349 } else {
3360 __ lwax(result, mem_operand); 3350 __ lwax(result, mem_operand);
3361 } 3351 }
3362 break; 3352 break;
3363 case EXTERNAL_UINT32_ELEMENTS:
3364 case UINT32_ELEMENTS: 3353 case UINT32_ELEMENTS:
3365 if (key_is_constant) { 3354 if (key_is_constant) {
3366 __ LoadWord(result, mem_operand, r0); 3355 __ LoadWord(result, mem_operand, r0);
3367 } else { 3356 } else {
3368 __ lwzx(result, mem_operand); 3357 __ lwzx(result, mem_operand);
3369 } 3358 }
3370 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3359 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3371 __ lis(r0, Operand(SIGN_EXT_IMM16(0x8000))); 3360 __ lis(r0, Operand(SIGN_EXT_IMM16(0x8000)));
3372 __ cmplw(result, r0); 3361 __ cmplw(result, r0);
3373 DeoptimizeIf(ge, instr, Deoptimizer::kNegativeValue); 3362 DeoptimizeIf(ge, instr, Deoptimizer::kNegativeValue);
3374 } 3363 }
3375 break; 3364 break;
3376 case FLOAT32_ELEMENTS: 3365 case FLOAT32_ELEMENTS:
3377 case FLOAT64_ELEMENTS: 3366 case FLOAT64_ELEMENTS:
3378 case EXTERNAL_FLOAT32_ELEMENTS:
3379 case EXTERNAL_FLOAT64_ELEMENTS:
3380 case FAST_HOLEY_DOUBLE_ELEMENTS: 3367 case FAST_HOLEY_DOUBLE_ELEMENTS:
3381 case FAST_HOLEY_ELEMENTS: 3368 case FAST_HOLEY_ELEMENTS:
3382 case FAST_HOLEY_SMI_ELEMENTS: 3369 case FAST_HOLEY_SMI_ELEMENTS:
3383 case FAST_DOUBLE_ELEMENTS: 3370 case FAST_DOUBLE_ELEMENTS:
3384 case FAST_ELEMENTS: 3371 case FAST_ELEMENTS:
3385 case FAST_SMI_ELEMENTS: 3372 case FAST_SMI_ELEMENTS:
3386 case DICTIONARY_ELEMENTS: 3373 case DICTIONARY_ELEMENTS:
3387 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 3374 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
3388 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 3375 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
3389 UNREACHABLE(); 3376 UNREACHABLE();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3506 __ CmpSmiLiteral(result, Smi::FromInt(Isolate::kArrayProtectorValid), r0); 3493 __ CmpSmiLiteral(result, Smi::FromInt(Isolate::kArrayProtectorValid), r0);
3507 DeoptimizeIf(ne, instr, Deoptimizer::kHole); 3494 DeoptimizeIf(ne, instr, Deoptimizer::kHole);
3508 } 3495 }
3509 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); 3496 __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
3510 __ bind(&done); 3497 __ bind(&done);
3511 } 3498 }
3512 } 3499 }
3513 3500
3514 3501
3515 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { 3502 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3516 if (instr->is_typed_elements()) { 3503 if (instr->is_fixed_typed_array()) {
3517 DoLoadKeyedExternalArray(instr); 3504 DoLoadKeyedExternalArray(instr);
3518 } else if (instr->hydrogen()->representation().IsDouble()) { 3505 } else if (instr->hydrogen()->representation().IsDouble()) {
3519 DoLoadKeyedFixedDoubleArray(instr); 3506 DoLoadKeyedFixedDoubleArray(instr);
3520 } else { 3507 } else {
3521 DoLoadKeyedFixedArray(instr); 3508 DoLoadKeyedFixedArray(instr);
3522 } 3509 }
3523 } 3510 }
3524 3511
3525 3512
3526 MemOperand LCodeGen::PrepareKeyedOperand(Register key, Register base, 3513 MemOperand LCodeGen::PrepareKeyedOperand(Register key, Register base,
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
4553 if (constant_key & 0xF0000000) { 4540 if (constant_key & 0xF0000000) {
4554 Abort(kArrayIndexConstantValueTooBig); 4541 Abort(kArrayIndexConstantValueTooBig);
4555 } 4542 }
4556 } else { 4543 } else {
4557 key = ToRegister(instr->key()); 4544 key = ToRegister(instr->key());
4558 } 4545 }
4559 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4546 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4560 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi(); 4547 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
4561 int base_offset = instr->base_offset(); 4548 int base_offset = instr->base_offset();
4562 4549
4563 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4550 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
4564 elements_kind == FLOAT32_ELEMENTS ||
4565 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4566 elements_kind == FLOAT64_ELEMENTS) {
4567 Register address = scratch0(); 4551 Register address = scratch0();
4568 DoubleRegister value(ToDoubleRegister(instr->value())); 4552 DoubleRegister value(ToDoubleRegister(instr->value()));
4569 if (key_is_constant) { 4553 if (key_is_constant) {
4570 if (constant_key != 0) { 4554 if (constant_key != 0) {
4571 __ Add(address, external_pointer, constant_key << element_size_shift, 4555 __ Add(address, external_pointer, constant_key << element_size_shift,
4572 r0); 4556 r0);
4573 } else { 4557 } else {
4574 address = external_pointer; 4558 address = external_pointer;
4575 } 4559 }
4576 } else { 4560 } else {
4577 __ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi); 4561 __ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi);
4578 __ add(address, external_pointer, r0); 4562 __ add(address, external_pointer, r0);
4579 } 4563 }
4580 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4564 if (elements_kind == FLOAT32_ELEMENTS) {
4581 elements_kind == FLOAT32_ELEMENTS) {
4582 __ frsp(double_scratch0(), value); 4565 __ frsp(double_scratch0(), value);
4583 __ stfs(double_scratch0(), MemOperand(address, base_offset)); 4566 __ stfs(double_scratch0(), MemOperand(address, base_offset));
4584 } else { // Storing doubles, not floats. 4567 } else { // Storing doubles, not floats.
4585 __ stfd(value, MemOperand(address, base_offset)); 4568 __ stfd(value, MemOperand(address, base_offset));
4586 } 4569 }
4587 } else { 4570 } else {
4588 Register value(ToRegister(instr->value())); 4571 Register value(ToRegister(instr->value()));
4589 MemOperand mem_operand = 4572 MemOperand mem_operand =
4590 PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi, 4573 PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi,
4591 constant_key, element_size_shift, base_offset); 4574 constant_key, element_size_shift, base_offset);
4592 switch (elements_kind) { 4575 switch (elements_kind) {
4593 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4594 case EXTERNAL_INT8_ELEMENTS:
4595 case EXTERNAL_UINT8_ELEMENTS:
4596 case UINT8_ELEMENTS: 4576 case UINT8_ELEMENTS:
4597 case UINT8_CLAMPED_ELEMENTS: 4577 case UINT8_CLAMPED_ELEMENTS:
4598 case INT8_ELEMENTS: 4578 case INT8_ELEMENTS:
4599 if (key_is_constant) { 4579 if (key_is_constant) {
4600 __ StoreByte(value, mem_operand, r0); 4580 __ StoreByte(value, mem_operand, r0);
4601 } else { 4581 } else {
4602 __ stbx(value, mem_operand); 4582 __ stbx(value, mem_operand);
4603 } 4583 }
4604 break; 4584 break;
4605 case EXTERNAL_INT16_ELEMENTS:
4606 case EXTERNAL_UINT16_ELEMENTS:
4607 case INT16_ELEMENTS: 4585 case INT16_ELEMENTS:
4608 case UINT16_ELEMENTS: 4586 case UINT16_ELEMENTS:
4609 if (key_is_constant) { 4587 if (key_is_constant) {
4610 __ StoreHalfWord(value, mem_operand, r0); 4588 __ StoreHalfWord(value, mem_operand, r0);
4611 } else { 4589 } else {
4612 __ sthx(value, mem_operand); 4590 __ sthx(value, mem_operand);
4613 } 4591 }
4614 break; 4592 break;
4615 case EXTERNAL_INT32_ELEMENTS:
4616 case EXTERNAL_UINT32_ELEMENTS:
4617 case INT32_ELEMENTS: 4593 case INT32_ELEMENTS:
4618 case UINT32_ELEMENTS: 4594 case UINT32_ELEMENTS:
4619 if (key_is_constant) { 4595 if (key_is_constant) {
4620 __ StoreWord(value, mem_operand, r0); 4596 __ StoreWord(value, mem_operand, r0);
4621 } else { 4597 } else {
4622 __ stwx(value, mem_operand); 4598 __ stwx(value, mem_operand);
4623 } 4599 }
4624 break; 4600 break;
4625 case FLOAT32_ELEMENTS: 4601 case FLOAT32_ELEMENTS:
4626 case FLOAT64_ELEMENTS: 4602 case FLOAT64_ELEMENTS:
4627 case EXTERNAL_FLOAT32_ELEMENTS:
4628 case EXTERNAL_FLOAT64_ELEMENTS:
4629 case FAST_DOUBLE_ELEMENTS: 4603 case FAST_DOUBLE_ELEMENTS:
4630 case FAST_ELEMENTS: 4604 case FAST_ELEMENTS:
4631 case FAST_SMI_ELEMENTS: 4605 case FAST_SMI_ELEMENTS:
4632 case FAST_HOLEY_DOUBLE_ELEMENTS: 4606 case FAST_HOLEY_DOUBLE_ELEMENTS:
4633 case FAST_HOLEY_ELEMENTS: 4607 case FAST_HOLEY_ELEMENTS:
4634 case FAST_HOLEY_SMI_ELEMENTS: 4608 case FAST_HOLEY_SMI_ELEMENTS:
4635 case DICTIONARY_ELEMENTS: 4609 case DICTIONARY_ELEMENTS:
4636 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 4610 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
4637 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 4611 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
4638 UNREACHABLE(); 4612 UNREACHABLE();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
4736 __ Add(key, store_base, offset, r0); 4710 __ Add(key, store_base, offset, r0);
4737 __ RecordWrite(elements, key, value, GetLinkRegisterState(), kSaveFPRegs, 4711 __ RecordWrite(elements, key, value, GetLinkRegisterState(), kSaveFPRegs,
4738 EMIT_REMEMBERED_SET, check_needed, 4712 EMIT_REMEMBERED_SET, check_needed,
4739 hinstr->PointersToHereCheckForValue()); 4713 hinstr->PointersToHereCheckForValue());
4740 } 4714 }
4741 } 4715 }
4742 4716
4743 4717
4744 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4718 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4745 // By cases: external, fast double 4719 // By cases: external, fast double
4746 if (instr->is_typed_elements()) { 4720 if (instr->is_fixed_typed_array()) {
4747 DoStoreKeyedExternalArray(instr); 4721 DoStoreKeyedExternalArray(instr);
4748 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4722 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4749 DoStoreKeyedFixedDoubleArray(instr); 4723 DoStoreKeyedFixedDoubleArray(instr);
4750 } else { 4724 } else {
4751 DoStoreKeyedFixedArray(instr); 4725 DoStoreKeyedFixedArray(instr);
4752 } 4726 }
4753 } 4727 }
4754 4728
4755 4729
4756 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 4730 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
6314 __ Push(scope_info); 6288 __ Push(scope_info);
6315 __ push(ToRegister(instr->function())); 6289 __ push(ToRegister(instr->function()));
6316 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6290 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6317 RecordSafepoint(Safepoint::kNoLazyDeopt); 6291 RecordSafepoint(Safepoint::kNoLazyDeopt);
6318 } 6292 }
6319 6293
6320 6294
6321 #undef __ 6295 #undef __
6322 } // namespace internal 6296 } // namespace internal
6323 } // namespace v8 6297 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/ppc/lithium-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698