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

Unified Diff: src/ppc/lithium-codegen-ppc.cc

Issue 1250733005: SIMD.js Add the other SIMD Phase 1 types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make _IsSimdObject an assembly intrinsic in fullcodegen. 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 side-by-side diff with in-line comments
Download patch
Index: src/ppc/lithium-codegen-ppc.cc
diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc
index e5dd69aa12dc43416413dcc4ef516e4bbb1a9046..b6a23c040449ee76afa311088ddf11cde9604b84 100644
--- a/src/ppc/lithium-codegen-ppc.cc
+++ b/src/ppc/lithium-codegen-ppc.cc
@@ -2307,8 +2307,12 @@ void LCodeGen::DoBranch(LBranch* instr) {
if (expected.Contains(ToBooleanStub::SIMD_VALUE)) {
// SIMD value -> true.
- __ CompareInstanceType(map, ip, FLOAT32X4_TYPE);
- __ beq(instr->TrueLabel(chunk_));
+ Label not_simd;
+ __ CompareInstanceType(map, ip, FIRST_SIMD_VALUE_TYPE);
+ __ blt(&not_simd);
+ __ CompareInstanceType(map, ip, LAST_SIMD_VALUE_TYPE);
+ __ ble(instr->TrueLabel(chunk_));
+ __ bind(&not_simd);
}
if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) {
@@ -3064,17 +3068,16 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
DCHECK(ToRegister(instr->context()).is(cp));
DCHECK(ToRegister(instr->result()).is(r3));
- int const slot = instr->slot_index();
- int const depth = instr->depth();
- if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
- __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
- Handle<Code> stub =
- CodeFactory::LoadGlobalViaContext(isolate(), depth).code();
- CallCode(stub, RelocInfo::CODE_TARGET, instr);
- } else {
- __ Push(Smi::FromInt(slot));
- __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
- }
+ __ mov(LoadGlobalViaContextDescriptor::DepthRegister(),
+ Operand(Smi::FromInt(instr->depth())));
+ __ mov(LoadGlobalViaContextDescriptor::SlotRegister(),
+ Operand(Smi::FromInt(instr->slot_index())));
+ __ mov(LoadGlobalViaContextDescriptor::NameRegister(),
+ Operand(instr->name()));
+
+ Handle<Code> stub =
+ CodeFactory::LoadGlobalViaContext(isolate(), instr->depth()).code();
+ CallCode(stub, RelocInfo::CODE_TARGET, instr);
}
@@ -3294,7 +3297,10 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
int base_offset = instr->base_offset();
- if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
+ elements_kind == FLOAT32_ELEMENTS ||
+ elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
+ elements_kind == FLOAT64_ELEMENTS) {
DoubleRegister result = ToDoubleRegister(instr->result());
if (key_is_constant) {
__ Add(scratch0(), external_pointer, constant_key << element_size_shift,
@@ -3303,7 +3309,8 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
__ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi);
__ add(scratch0(), external_pointer, r0);
}
- if (elements_kind == FLOAT32_ELEMENTS) {
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
+ elements_kind == FLOAT32_ELEMENTS) {
__ lfs(result, MemOperand(scratch0(), base_offset));
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
__ lfd(result, MemOperand(scratch0(), base_offset));
@@ -3314,6 +3321,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi,
constant_key, element_size_shift, base_offset);
switch (elements_kind) {
+ case EXTERNAL_INT8_ELEMENTS:
case INT8_ELEMENTS:
if (key_is_constant) {
__ LoadByte(result, mem_operand, r0);
@@ -3322,6 +3330,8 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
}
__ extsb(result, result);
break;
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
case UINT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
if (key_is_constant) {
@@ -3330,6 +3340,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
__ lbzx(result, mem_operand);
}
break;
+ case EXTERNAL_INT16_ELEMENTS:
case INT16_ELEMENTS:
if (key_is_constant) {
__ LoadHalfWordArith(result, mem_operand, r0);
@@ -3337,6 +3348,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
__ lhax(result, mem_operand);
}
break;
+ case EXTERNAL_UINT16_ELEMENTS:
case UINT16_ELEMENTS:
if (key_is_constant) {
__ LoadHalfWord(result, mem_operand, r0);
@@ -3344,6 +3356,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
__ lhzx(result, mem_operand);
}
break;
+ case EXTERNAL_INT32_ELEMENTS:
case INT32_ELEMENTS:
if (key_is_constant) {
__ LoadWordArith(result, mem_operand, r0);
@@ -3351,6 +3364,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
__ lwax(result, mem_operand);
}
break;
+ case EXTERNAL_UINT32_ELEMENTS:
case UINT32_ELEMENTS:
if (key_is_constant) {
__ LoadWord(result, mem_operand, r0);
@@ -3365,6 +3379,8 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
break;
case FLOAT32_ELEMENTS:
case FLOAT64_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS:
case FAST_HOLEY_ELEMENTS:
case FAST_HOLEY_SMI_ELEMENTS:
@@ -3501,7 +3517,7 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
- if (instr->is_fixed_typed_array()) {
+ if (instr->is_typed_elements()) {
DoLoadKeyedExternalArray(instr);
} else if (instr->hydrogen()->representation().IsDouble()) {
DoLoadKeyedFixedDoubleArray(instr);
@@ -3762,11 +3778,12 @@ void LCodeGen::DoContext(LContext* instr) {
void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
DCHECK(ToRegister(instr->context()).is(cp));
+ __ push(cp); // The context is the first argument.
__ Move(scratch0(), instr->hydrogen()->pairs());
__ push(scratch0());
__ LoadSmiLiteral(scratch0(), Smi::FromInt(instr->hydrogen()->flags()));
__ push(scratch0());
- CallRuntime(Runtime::kDeclareGlobals, 2, instr);
+ CallRuntime(Runtime::kDeclareGlobals, 3, instr);
}
@@ -4472,21 +4489,17 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
DCHECK(ToRegister(instr->value())
.is(StoreGlobalViaContextDescriptor::ValueRegister()));
- int const slot = instr->slot_index();
- int const depth = instr->depth();
- if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
- __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
- Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
- isolate(), depth, instr->language_mode()).code();
- CallCode(stub, RelocInfo::CODE_TARGET, instr);
- } else {
- __ Push(Smi::FromInt(slot));
- __ push(StoreGlobalViaContextDescriptor::ValueRegister());
- __ CallRuntime(is_strict(instr->language_mode())
- ? Runtime::kStoreGlobalViaContext_Strict
- : Runtime::kStoreGlobalViaContext_Sloppy,
- 2);
- }
+ __ mov(StoreGlobalViaContextDescriptor::DepthRegister(),
+ Operand(Smi::FromInt(instr->depth())));
+ __ mov(StoreGlobalViaContextDescriptor::SlotRegister(),
+ Operand(Smi::FromInt(instr->slot_index())));
+ __ mov(StoreGlobalViaContextDescriptor::NameRegister(),
+ Operand(instr->name()));
+
+ Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
+ isolate(), instr->depth(), instr->language_mode())
+ .code();
+ CallCode(stub, RelocInfo::CODE_TARGET, instr);
}
@@ -4551,7 +4564,10 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
int base_offset = instr->base_offset();
- if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
+ elements_kind == FLOAT32_ELEMENTS ||
+ elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
+ elements_kind == FLOAT64_ELEMENTS) {
Register address = scratch0();
DoubleRegister value(ToDoubleRegister(instr->value()));
if (key_is_constant) {
@@ -4565,7 +4581,8 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
__ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi);
__ add(address, external_pointer, r0);
}
- if (elements_kind == FLOAT32_ELEMENTS) {
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
+ elements_kind == FLOAT32_ELEMENTS) {
__ frsp(double_scratch0(), value);
__ stfs(double_scratch0(), MemOperand(address, base_offset));
} else { // Storing doubles, not floats.
@@ -4577,6 +4594,9 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi,
constant_key, element_size_shift, base_offset);
switch (elements_kind) {
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_INT8_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
case UINT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
case INT8_ELEMENTS:
@@ -4586,6 +4606,8 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
__ stbx(value, mem_operand);
}
break;
+ case EXTERNAL_INT16_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case INT16_ELEMENTS:
case UINT16_ELEMENTS:
if (key_is_constant) {
@@ -4594,6 +4616,8 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
__ sthx(value, mem_operand);
}
break;
+ case EXTERNAL_INT32_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
case INT32_ELEMENTS:
case UINT32_ELEMENTS:
if (key_is_constant) {
@@ -4604,6 +4628,8 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
break;
case FLOAT32_ELEMENTS:
case FLOAT64_ELEMENTS:
+ case EXTERNAL_FLOAT32_ELEMENTS:
+ case EXTERNAL_FLOAT64_ELEMENTS:
case FAST_DOUBLE_ELEMENTS:
case FAST_ELEMENTS:
case FAST_SMI_ELEMENTS:
@@ -4721,7 +4747,7 @@ void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
// By cases: external, fast double
- if (instr->is_fixed_typed_array()) {
+ if (instr->is_typed_elements()) {
DoStoreKeyedExternalArray(instr);
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
DoStoreKeyedFixedDoubleArray(instr);
@@ -5992,6 +6018,36 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label, Label* false_label,
__ CompareObjectType(input, scratch, no_reg, FLOAT32X4_TYPE);
final_branch_condition = eq;
+ } else if (String::Equals(type_name, factory->int32x4_string())) {
+ __ JumpIfSmi(input, false_label);
+ __ CompareObjectType(input, scratch, no_reg, INT32X4_TYPE);
+ final_branch_condition = eq;
+
+ } else if (String::Equals(type_name, factory->bool32x4_string())) {
+ __ JumpIfSmi(input, false_label);
+ __ CompareObjectType(input, scratch, no_reg, BOOL32X4_TYPE);
+ final_branch_condition = eq;
+
+ } else if (String::Equals(type_name, factory->int16x8_string())) {
+ __ JumpIfSmi(input, false_label);
+ __ CompareObjectType(input, scratch, no_reg, INT16X8_TYPE);
+ final_branch_condition = eq;
+
+ } else if (String::Equals(type_name, factory->bool16x8_string())) {
+ __ JumpIfSmi(input, false_label);
+ __ CompareObjectType(input, scratch, no_reg, BOOL16X8_TYPE);
+ final_branch_condition = eq;
+
+ } else if (String::Equals(type_name, factory->int8x16_string())) {
+ __ JumpIfSmi(input, false_label);
+ __ CompareObjectType(input, scratch, no_reg, INT8X16_TYPE);
+ final_branch_condition = eq;
+
+ } else if (String::Equals(type_name, factory->bool8x16_string())) {
+ __ JumpIfSmi(input, false_label);
+ __ CompareObjectType(input, scratch, no_reg, BOOL8X16_TYPE);
+ final_branch_condition = eq;
+
} else {
__ b(false_label);
}
« src/macros.py ('K') | « src/ppc/code-stubs-ppc.cc ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698