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

Unified Diff: src/arm/lithium-codegen-arm.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/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index 51d56caef78ce68f544351afdc768e3e7fd70057..2c98c78b64a925b62f7a6f13321fb3ce1615789d 100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -2270,8 +2270,12 @@ void LCodeGen::DoBranch(LBranch* instr) {
if (expected.Contains(ToBooleanStub::SIMD_VALUE)) {
// SIMD value -> true.
- __ CompareInstanceType(map, ip, FLOAT32X4_TYPE);
- __ b(eq, instr->TrueLabel(chunk_));
+ Label not_simd;
+ __ CompareInstanceType(map, ip, FIRST_SIMD_VALUE_TYPE);
+ __ b(lt, &not_simd);
+ __ CompareInstanceType(map, ip, LAST_SIMD_VALUE_TYPE);
+ __ b(le, instr->TrueLabel(chunk_));
+ __ bind(&not_simd);
}
if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) {
@@ -2987,17 +2991,16 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
DCHECK(ToRegister(instr->context()).is(cp));
DCHECK(ToRegister(instr->result()).is(r0));
- 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);
}
@@ -3187,13 +3190,17 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
? (element_size_shift - kSmiTagSize) : element_size_shift;
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) {
DwVfpRegister result = ToDoubleRegister(instr->result());
Operand operand = key_is_constant
? Operand(constant_key << element_size_shift)
: Operand(key, LSL, shift_size);
__ add(scratch0(), external_pointer, operand);
- if (elements_kind == FLOAT32_ELEMENTS) {
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
+ elements_kind == FLOAT32_ELEMENTS) {
__ vldr(double_scratch0().low(), scratch0(), base_offset);
__ vcvt_f64_f32(result, double_scratch0().low());
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
@@ -3205,22 +3212,29 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
key, external_pointer, key_is_constant, constant_key,
element_size_shift, shift_size, base_offset);
switch (elements_kind) {
+ case EXTERNAL_INT8_ELEMENTS:
case INT8_ELEMENTS:
__ ldrsb(result, mem_operand);
break;
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
+ case EXTERNAL_UINT8_ELEMENTS:
case UINT8_ELEMENTS:
case UINT8_CLAMPED_ELEMENTS:
__ ldrb(result, mem_operand);
break;
+ case EXTERNAL_INT16_ELEMENTS:
case INT16_ELEMENTS:
__ ldrsh(result, mem_operand);
break;
+ case EXTERNAL_UINT16_ELEMENTS:
case UINT16_ELEMENTS:
__ ldrh(result, mem_operand);
break;
+ case EXTERNAL_INT32_ELEMENTS:
case INT32_ELEMENTS:
__ ldr(result, mem_operand);
break;
+ case EXTERNAL_UINT32_ELEMENTS:
case UINT32_ELEMENTS:
__ ldr(result, mem_operand);
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
@@ -3230,6 +3244,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:
@@ -3339,7 +3355,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);
@@ -3582,11 +3598,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());
__ mov(scratch0(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
__ push(scratch0());
- CallRuntime(Runtime::kDeclareGlobals, 2, instr);
+ CallRuntime(Runtime::kDeclareGlobals, 3, instr);
}
@@ -4236,22 +4253,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);
}
@@ -4297,7 +4309,10 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
? (element_size_shift - kSmiTagSize) : element_size_shift;
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();
DwVfpRegister value(ToDoubleRegister(instr->value()));
if (key_is_constant) {
@@ -4310,7 +4325,8 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
} else {
__ add(address, external_pointer, Operand(key, LSL, shift_size));
}
- if (elements_kind == FLOAT32_ELEMENTS) {
+ if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
+ elements_kind == FLOAT32_ELEMENTS) {
__ vcvt_f32_f64(double_scratch0().low(), value);
__ vstr(double_scratch0().low(), address, base_offset);
} else { // Storing doubles, not floats.
@@ -4323,21 +4339,30 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
element_size_shift, shift_size,
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:
__ strb(value, mem_operand);
break;
+ case EXTERNAL_INT16_ELEMENTS:
+ case EXTERNAL_UINT16_ELEMENTS:
case INT16_ELEMENTS:
case UINT16_ELEMENTS:
__ strh(value, mem_operand);
break;
+ case EXTERNAL_INT32_ELEMENTS:
+ case EXTERNAL_UINT32_ELEMENTS:
case INT32_ELEMENTS:
case UINT32_ELEMENTS:
__ str(value, mem_operand);
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:
@@ -4443,7 +4468,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);
@@ -5707,6 +5732,36 @@ Condition LCodeGen::EmitTypeofIs(Label* true_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);
}
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm64/code-stubs-arm64.cc » ('j') | src/macros.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698