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

Side by Side Diff: src/ppc/lithium-codegen-ppc.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/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 3279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3290 if (constant_key & 0xF0000000) { 3290 if (constant_key & 0xF0000000) {
3291 Abort(kArrayIndexConstantValueTooBig); 3291 Abort(kArrayIndexConstantValueTooBig);
3292 } 3292 }
3293 } else { 3293 } else {
3294 key = ToRegister(instr->key()); 3294 key = ToRegister(instr->key());
3295 } 3295 }
3296 int element_size_shift = ElementsKindToShiftSize(elements_kind); 3296 int element_size_shift = ElementsKindToShiftSize(elements_kind);
3297 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi(); 3297 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
3298 int base_offset = instr->base_offset(); 3298 int base_offset = instr->base_offset();
3299 3299
3300 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3300 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
3301 elements_kind == FLOAT32_ELEMENTS ||
3302 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
3303 elements_kind == FLOAT64_ELEMENTS) {
3304 DoubleRegister result = ToDoubleRegister(instr->result()); 3301 DoubleRegister result = ToDoubleRegister(instr->result());
3305 if (key_is_constant) { 3302 if (key_is_constant) {
3306 __ Add(scratch0(), external_pointer, constant_key << element_size_shift, 3303 __ Add(scratch0(), external_pointer, constant_key << element_size_shift,
3307 r0); 3304 r0);
3308 } else { 3305 } else {
3309 __ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi); 3306 __ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi);
3310 __ add(scratch0(), external_pointer, r0); 3307 __ add(scratch0(), external_pointer, r0);
3311 } 3308 }
3312 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3309 if (elements_kind == FLOAT32_ELEMENTS) {
3313 elements_kind == FLOAT32_ELEMENTS) {
3314 __ lfs(result, MemOperand(scratch0(), base_offset)); 3310 __ lfs(result, MemOperand(scratch0(), base_offset));
3315 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS 3311 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
3316 __ lfd(result, MemOperand(scratch0(), base_offset)); 3312 __ lfd(result, MemOperand(scratch0(), base_offset));
3317 } 3313 }
3318 } else { 3314 } else {
3319 Register result = ToRegister(instr->result()); 3315 Register result = ToRegister(instr->result());
3320 MemOperand mem_operand = 3316 MemOperand mem_operand =
3321 PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi, 3317 PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi,
3322 constant_key, element_size_shift, base_offset); 3318 constant_key, element_size_shift, base_offset);
3323 switch (elements_kind) { 3319 switch (elements_kind) {
3324 case EXTERNAL_INT8_ELEMENTS:
3325 case INT8_ELEMENTS: 3320 case INT8_ELEMENTS:
3326 if (key_is_constant) { 3321 if (key_is_constant) {
3327 __ LoadByte(result, mem_operand, r0); 3322 __ LoadByte(result, mem_operand, r0);
3328 } else { 3323 } else {
3329 __ lbzx(result, mem_operand); 3324 __ lbzx(result, mem_operand);
3330 } 3325 }
3331 __ extsb(result, result); 3326 __ extsb(result, result);
3332 break; 3327 break;
3333 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3334 case EXTERNAL_UINT8_ELEMENTS:
3335 case UINT8_ELEMENTS: 3328 case UINT8_ELEMENTS:
3336 case UINT8_CLAMPED_ELEMENTS: 3329 case UINT8_CLAMPED_ELEMENTS:
3337 if (key_is_constant) { 3330 if (key_is_constant) {
3338 __ LoadByte(result, mem_operand, r0); 3331 __ LoadByte(result, mem_operand, r0);
3339 } else { 3332 } else {
3340 __ lbzx(result, mem_operand); 3333 __ lbzx(result, mem_operand);
3341 } 3334 }
3342 break; 3335 break;
3343 case EXTERNAL_INT16_ELEMENTS:
3344 case INT16_ELEMENTS: 3336 case INT16_ELEMENTS:
3345 if (key_is_constant) { 3337 if (key_is_constant) {
3346 __ LoadHalfWordArith(result, mem_operand, r0); 3338 __ LoadHalfWordArith(result, mem_operand, r0);
3347 } else { 3339 } else {
3348 __ lhax(result, mem_operand); 3340 __ lhax(result, mem_operand);
3349 } 3341 }
3350 break; 3342 break;
3351 case EXTERNAL_UINT16_ELEMENTS:
3352 case UINT16_ELEMENTS: 3343 case UINT16_ELEMENTS:
3353 if (key_is_constant) { 3344 if (key_is_constant) {
3354 __ LoadHalfWord(result, mem_operand, r0); 3345 __ LoadHalfWord(result, mem_operand, r0);
3355 } else { 3346 } else {
3356 __ lhzx(result, mem_operand); 3347 __ lhzx(result, mem_operand);
3357 } 3348 }
3358 break; 3349 break;
3359 case EXTERNAL_INT32_ELEMENTS:
3360 case INT32_ELEMENTS: 3350 case INT32_ELEMENTS:
3361 if (key_is_constant) { 3351 if (key_is_constant) {
3362 __ LoadWordArith(result, mem_operand, r0); 3352 __ LoadWordArith(result, mem_operand, r0);
3363 } else { 3353 } else {
3364 __ lwax(result, mem_operand); 3354 __ lwax(result, mem_operand);
3365 } 3355 }
3366 break; 3356 break;
3367 case EXTERNAL_UINT32_ELEMENTS:
3368 case UINT32_ELEMENTS: 3357 case UINT32_ELEMENTS:
3369 if (key_is_constant) { 3358 if (key_is_constant) {
3370 __ LoadWord(result, mem_operand, r0); 3359 __ LoadWord(result, mem_operand, r0);
3371 } else { 3360 } else {
3372 __ lwzx(result, mem_operand); 3361 __ lwzx(result, mem_operand);
3373 } 3362 }
3374 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3363 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3375 __ lis(r0, Operand(SIGN_EXT_IMM16(0x8000))); 3364 __ lis(r0, Operand(SIGN_EXT_IMM16(0x8000)));
3376 __ cmplw(result, r0); 3365 __ cmplw(result, r0);
3377 DeoptimizeIf(ge, instr, Deoptimizer::kNegativeValue); 3366 DeoptimizeIf(ge, instr, Deoptimizer::kNegativeValue);
3378 } 3367 }
3379 break; 3368 break;
3380 case FLOAT32_ELEMENTS: 3369 case FLOAT32_ELEMENTS:
3381 case FLOAT64_ELEMENTS: 3370 case FLOAT64_ELEMENTS:
3382 case EXTERNAL_FLOAT32_ELEMENTS:
3383 case EXTERNAL_FLOAT64_ELEMENTS:
3384 case FAST_HOLEY_DOUBLE_ELEMENTS: 3371 case FAST_HOLEY_DOUBLE_ELEMENTS:
3385 case FAST_HOLEY_ELEMENTS: 3372 case FAST_HOLEY_ELEMENTS:
3386 case FAST_HOLEY_SMI_ELEMENTS: 3373 case FAST_HOLEY_SMI_ELEMENTS:
3387 case FAST_DOUBLE_ELEMENTS: 3374 case FAST_DOUBLE_ELEMENTS:
3388 case FAST_ELEMENTS: 3375 case FAST_ELEMENTS:
3389 case FAST_SMI_ELEMENTS: 3376 case FAST_SMI_ELEMENTS:
3390 case DICTIONARY_ELEMENTS: 3377 case DICTIONARY_ELEMENTS:
3391 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 3378 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
3392 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 3379 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
3393 UNREACHABLE(); 3380 UNREACHABLE();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3510 __ CmpSmiLiteral(result, Smi::FromInt(Isolate::kArrayProtectorValid), r0); 3497 __ CmpSmiLiteral(result, Smi::FromInt(Isolate::kArrayProtectorValid), r0);
3511 DeoptimizeIf(ne, instr, Deoptimizer::kHole); 3498 DeoptimizeIf(ne, instr, Deoptimizer::kHole);
3512 } 3499 }
3513 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); 3500 __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
3514 __ bind(&done); 3501 __ bind(&done);
3515 } 3502 }
3516 } 3503 }
3517 3504
3518 3505
3519 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { 3506 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3520 if (instr->is_typed_elements()) { 3507 if (instr->is_fixed_typed_array()) {
3521 DoLoadKeyedExternalArray(instr); 3508 DoLoadKeyedExternalArray(instr);
3522 } else if (instr->hydrogen()->representation().IsDouble()) { 3509 } else if (instr->hydrogen()->representation().IsDouble()) {
3523 DoLoadKeyedFixedDoubleArray(instr); 3510 DoLoadKeyedFixedDoubleArray(instr);
3524 } else { 3511 } else {
3525 DoLoadKeyedFixedArray(instr); 3512 DoLoadKeyedFixedArray(instr);
3526 } 3513 }
3527 } 3514 }
3528 3515
3529 3516
3530 MemOperand LCodeGen::PrepareKeyedOperand(Register key, Register base, 3517 MemOperand LCodeGen::PrepareKeyedOperand(Register key, Register base,
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
4564 if (constant_key & 0xF0000000) { 4551 if (constant_key & 0xF0000000) {
4565 Abort(kArrayIndexConstantValueTooBig); 4552 Abort(kArrayIndexConstantValueTooBig);
4566 } 4553 }
4567 } else { 4554 } else {
4568 key = ToRegister(instr->key()); 4555 key = ToRegister(instr->key());
4569 } 4556 }
4570 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4557 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4571 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi(); 4558 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
4572 int base_offset = instr->base_offset(); 4559 int base_offset = instr->base_offset();
4573 4560
4574 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4561 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
4575 elements_kind == FLOAT32_ELEMENTS ||
4576 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4577 elements_kind == FLOAT64_ELEMENTS) {
4578 Register address = scratch0(); 4562 Register address = scratch0();
4579 DoubleRegister value(ToDoubleRegister(instr->value())); 4563 DoubleRegister value(ToDoubleRegister(instr->value()));
4580 if (key_is_constant) { 4564 if (key_is_constant) {
4581 if (constant_key != 0) { 4565 if (constant_key != 0) {
4582 __ Add(address, external_pointer, constant_key << element_size_shift, 4566 __ Add(address, external_pointer, constant_key << element_size_shift,
4583 r0); 4567 r0);
4584 } else { 4568 } else {
4585 address = external_pointer; 4569 address = external_pointer;
4586 } 4570 }
4587 } else { 4571 } else {
4588 __ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi); 4572 __ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi);
4589 __ add(address, external_pointer, r0); 4573 __ add(address, external_pointer, r0);
4590 } 4574 }
4591 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4575 if (elements_kind == FLOAT32_ELEMENTS) {
4592 elements_kind == FLOAT32_ELEMENTS) {
4593 __ frsp(double_scratch0(), value); 4576 __ frsp(double_scratch0(), value);
4594 __ stfs(double_scratch0(), MemOperand(address, base_offset)); 4577 __ stfs(double_scratch0(), MemOperand(address, base_offset));
4595 } else { // Storing doubles, not floats. 4578 } else { // Storing doubles, not floats.
4596 __ stfd(value, MemOperand(address, base_offset)); 4579 __ stfd(value, MemOperand(address, base_offset));
4597 } 4580 }
4598 } else { 4581 } else {
4599 Register value(ToRegister(instr->value())); 4582 Register value(ToRegister(instr->value()));
4600 MemOperand mem_operand = 4583 MemOperand mem_operand =
4601 PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi, 4584 PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi,
4602 constant_key, element_size_shift, base_offset); 4585 constant_key, element_size_shift, base_offset);
4603 switch (elements_kind) { 4586 switch (elements_kind) {
4604 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4605 case EXTERNAL_INT8_ELEMENTS:
4606 case EXTERNAL_UINT8_ELEMENTS:
4607 case UINT8_ELEMENTS: 4587 case UINT8_ELEMENTS:
4608 case UINT8_CLAMPED_ELEMENTS: 4588 case UINT8_CLAMPED_ELEMENTS:
4609 case INT8_ELEMENTS: 4589 case INT8_ELEMENTS:
4610 if (key_is_constant) { 4590 if (key_is_constant) {
4611 __ StoreByte(value, mem_operand, r0); 4591 __ StoreByte(value, mem_operand, r0);
4612 } else { 4592 } else {
4613 __ stbx(value, mem_operand); 4593 __ stbx(value, mem_operand);
4614 } 4594 }
4615 break; 4595 break;
4616 case EXTERNAL_INT16_ELEMENTS:
4617 case EXTERNAL_UINT16_ELEMENTS:
4618 case INT16_ELEMENTS: 4596 case INT16_ELEMENTS:
4619 case UINT16_ELEMENTS: 4597 case UINT16_ELEMENTS:
4620 if (key_is_constant) { 4598 if (key_is_constant) {
4621 __ StoreHalfWord(value, mem_operand, r0); 4599 __ StoreHalfWord(value, mem_operand, r0);
4622 } else { 4600 } else {
4623 __ sthx(value, mem_operand); 4601 __ sthx(value, mem_operand);
4624 } 4602 }
4625 break; 4603 break;
4626 case EXTERNAL_INT32_ELEMENTS:
4627 case EXTERNAL_UINT32_ELEMENTS:
4628 case INT32_ELEMENTS: 4604 case INT32_ELEMENTS:
4629 case UINT32_ELEMENTS: 4605 case UINT32_ELEMENTS:
4630 if (key_is_constant) { 4606 if (key_is_constant) {
4631 __ StoreWord(value, mem_operand, r0); 4607 __ StoreWord(value, mem_operand, r0);
4632 } else { 4608 } else {
4633 __ stwx(value, mem_operand); 4609 __ stwx(value, mem_operand);
4634 } 4610 }
4635 break; 4611 break;
4636 case FLOAT32_ELEMENTS: 4612 case FLOAT32_ELEMENTS:
4637 case FLOAT64_ELEMENTS: 4613 case FLOAT64_ELEMENTS:
4638 case EXTERNAL_FLOAT32_ELEMENTS:
4639 case EXTERNAL_FLOAT64_ELEMENTS:
4640 case FAST_DOUBLE_ELEMENTS: 4614 case FAST_DOUBLE_ELEMENTS:
4641 case FAST_ELEMENTS: 4615 case FAST_ELEMENTS:
4642 case FAST_SMI_ELEMENTS: 4616 case FAST_SMI_ELEMENTS:
4643 case FAST_HOLEY_DOUBLE_ELEMENTS: 4617 case FAST_HOLEY_DOUBLE_ELEMENTS:
4644 case FAST_HOLEY_ELEMENTS: 4618 case FAST_HOLEY_ELEMENTS:
4645 case FAST_HOLEY_SMI_ELEMENTS: 4619 case FAST_HOLEY_SMI_ELEMENTS:
4646 case DICTIONARY_ELEMENTS: 4620 case DICTIONARY_ELEMENTS:
4647 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 4621 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
4648 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 4622 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
4649 UNREACHABLE(); 4623 UNREACHABLE();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
4747 __ Add(key, store_base, offset, r0); 4721 __ Add(key, store_base, offset, r0);
4748 __ RecordWrite(elements, key, value, GetLinkRegisterState(), kSaveFPRegs, 4722 __ RecordWrite(elements, key, value, GetLinkRegisterState(), kSaveFPRegs,
4749 EMIT_REMEMBERED_SET, check_needed, 4723 EMIT_REMEMBERED_SET, check_needed,
4750 hinstr->PointersToHereCheckForValue()); 4724 hinstr->PointersToHereCheckForValue());
4751 } 4725 }
4752 } 4726 }
4753 4727
4754 4728
4755 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4729 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4756 // By cases: external, fast double 4730 // By cases: external, fast double
4757 if (instr->is_typed_elements()) { 4731 if (instr->is_fixed_typed_array()) {
4758 DoStoreKeyedExternalArray(instr); 4732 DoStoreKeyedExternalArray(instr);
4759 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4733 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4760 DoStoreKeyedFixedDoubleArray(instr); 4734 DoStoreKeyedFixedDoubleArray(instr);
4761 } else { 4735 } else {
4762 DoStoreKeyedFixedArray(instr); 4736 DoStoreKeyedFixedArray(instr);
4763 } 4737 }
4764 } 4738 }
4765 4739
4766 4740
4767 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 4741 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
6325 __ Push(scope_info); 6299 __ Push(scope_info);
6326 __ push(ToRegister(instr->function())); 6300 __ push(ToRegister(instr->function()));
6327 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6301 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6328 RecordSafepoint(Safepoint::kNoLazyDeopt); 6302 RecordSafepoint(Safepoint::kNoLazyDeopt);
6329 } 6303 }
6330 6304
6331 6305
6332 #undef __ 6306 #undef __
6333 } // namespace internal 6307 } // namespace internal
6334 } // namespace v8 6308 } // 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