[simd.js] Single SIMD128_VALUE_TYPE for all Simd128Values.

There's no need to have one InstanceType per SIMD primitive type (this
will not scale long-term).  Also reduce the amount of code duplication
and make it more robust wrt adding new SIMD types.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/1273353003

Cr-Commit-Position: refs/heads/master@{#30107}
This commit is contained in:
bmeurer 2015-08-11 02:45:25 -07:00 committed by Commit bot
parent ce51974943
commit f4c079d450
37 changed files with 329 additions and 846 deletions

View File

@ -6953,10 +6953,10 @@ class Internals {
static const int kNodeIsIndependentShift = 3;
static const int kNodeIsPartiallyDependentShift = 4;
static const int kJSObjectType = 0xbc;
static const int kJSObjectType = 0xb6;
static const int kFirstNonstringType = 0x80;
static const int kOddballType = 0x83;
static const int kForeignType = 0x8d;
static const int kForeignType = 0x87;
static const int kUndefinedOddballKind = 5;
static const int kNullOddballKind = 3;

View File

@ -249,7 +249,6 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow,
// They are both equal and they are not both Smis so both of them are not
// Smis. If it's not a heap number, then return equal.
if (cond == lt || cond == gt) {
Label not_simd;
// Call runtime on identical JSObjects.
__ CompareObjectType(r0, r4, r4, FIRST_SPEC_OBJECT_TYPE);
__ b(ge, slow);
@ -257,11 +256,8 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow,
__ cmp(r4, Operand(SYMBOL_TYPE));
__ b(eq, slow);
// Call runtime on identical SIMD values since we must throw a TypeError.
__ cmp(r4, Operand(FIRST_SIMD_VALUE_TYPE));
__ b(lt, &not_simd);
__ cmp(r4, Operand(LAST_SIMD_VALUE_TYPE));
__ b(le, slow);
__ bind(&not_simd);
__ cmp(r4, Operand(SIMD128_VALUE_TYPE));
__ b(eq, slow);
if (is_strong(strength)) {
// Call the runtime on anything that is converted in the semantics, since
// we need to throw a TypeError. Smis have already been ruled out.
@ -275,18 +271,14 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow,
__ b(eq, &heap_number);
// Comparing JS objects with <=, >= is complicated.
if (cond != eq) {
Label not_simd;
__ cmp(r4, Operand(FIRST_SPEC_OBJECT_TYPE));
__ b(ge, slow);
// Call runtime on identical symbols since we need to throw a TypeError.
__ cmp(r4, Operand(SYMBOL_TYPE));
__ b(eq, slow);
// Call runtime on identical SIMD values since we must throw a TypeError.
__ cmp(r4, Operand(FIRST_SIMD_VALUE_TYPE));
__ b(lt, &not_simd);
__ cmp(r4, Operand(LAST_SIMD_VALUE_TYPE));
__ b(le, slow);
__ bind(&not_simd);
__ cmp(r4, Operand(SIMD128_VALUE_TYPE));
__ b(eq, slow);
if (is_strong(strength)) {
// Call the runtime on anything that is converted in the semantics,
// since we need to throw a TypeError. Smis and heap numbers have

View File

@ -2270,12 +2270,8 @@ void LCodeGen::DoBranch(LBranch* instr) {
if (expected.Contains(ToBooleanStub::SIMD_VALUE)) {
// SIMD value -> true.
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);
__ CompareInstanceType(map, ip, SIMD128_VALUE_TYPE);
__ b(eq, instr->TrueLabel(chunk_));
}
if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) {
@ -5706,40 +5702,16 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
__ tst(scratch, Operand(1 << Map::kIsUndetectable));
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->float32x4_string())) {
__ JumpIfSmi(input, 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);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(type_name, factory->type##_string())) { \
__ JumpIfSmi(input, false_label); \
__ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); \
__ CompareRoot(scratch, Heap::k##Type##MapRootIndex); \
final_branch_condition = eq;
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
__ b(false_label);

View File

@ -221,7 +221,6 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Register left,
// Smis. If it's not a heap number, then return equal.
Register right_type = scratch;
if ((cond == lt) || (cond == gt)) {
Label not_simd;
// Call runtime on identical JSObjects. Otherwise return equal.
__ JumpIfObjectType(right, right_type, right_type, FIRST_SPEC_OBJECT_TYPE,
slow, ge);
@ -229,11 +228,8 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Register left,
__ Cmp(right_type, SYMBOL_TYPE);
__ B(eq, slow);
// Call runtime on identical SIMD values since we must throw a TypeError.
__ Cmp(right_type, FIRST_SIMD_VALUE_TYPE);
__ B(lt, &not_simd);
__ Cmp(right_type, LAST_SIMD_VALUE_TYPE);
__ B(le, slow);
__ Bind(&not_simd);
__ Cmp(right_type, SIMD128_VALUE_TYPE);
__ B(eq, slow);
if (is_strong(strength)) {
// Call the runtime on anything that is converted in the semantics, since
// we need to throw a TypeError. Smis have already been ruled out.
@ -245,7 +241,6 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Register left,
} else if (cond == eq) {
__ JumpIfHeapNumber(right, &heap_number);
} else {
Label not_simd;
__ JumpIfObjectType(right, right_type, right_type, HEAP_NUMBER_TYPE,
&heap_number);
// Comparing JS objects with <=, >= is complicated.
@ -255,11 +250,8 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Register left,
__ Cmp(right_type, SYMBOL_TYPE);
__ B(eq, slow);
// Call runtime on identical SIMD values since we must throw a TypeError.
__ Cmp(right_type, FIRST_SIMD_VALUE_TYPE);
__ B(lt, &not_simd);
__ Cmp(right_type, LAST_SIMD_VALUE_TYPE);
__ B(le, slow);
__ Bind(&not_simd);
__ Cmp(right_type, SIMD128_VALUE_TYPE);
__ B(eq, slow);
if (is_strong(strength)) {
// Call the runtime on anything that is converted in the semantics,
// since we need to throw a TypeError. Smis and heap numbers have

View File

@ -1933,12 +1933,8 @@ void LCodeGen::DoBranch(LBranch* instr) {
if (expected.Contains(ToBooleanStub::SIMD_VALUE)) {
// SIMD value -> true.
Label not_simd;
__ CompareInstanceType(map, scratch, FIRST_SIMD_VALUE_TYPE);
__ B(lt, &not_simd);
__ CompareInstanceType(map, scratch, LAST_SIMD_VALUE_TYPE);
__ B(le, true_label);
__ Bind(&not_simd);
__ CompareInstanceType(map, scratch, SIMD128_VALUE_TYPE);
__ B(eq, true_label);
}
if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) {
@ -5997,68 +5993,19 @@ void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
__ Ldrb(scratch, FieldMemOperand(map, Map::kBitFieldOffset));
EmitTestAndBranch(instr, eq, scratch, 1 << Map::kIsUndetectable);
} else if (String::Equals(type_name, factory->float32x4_string())) {
DCHECK((instr->temp1() != NULL) && (instr->temp2() != NULL));
Register map = ToRegister(instr->temp1());
Register scratch = ToRegister(instr->temp2());
__ JumpIfSmi(value, false_label);
__ CompareObjectType(value, map, scratch, FLOAT32X4_TYPE);
EmitBranch(instr, eq);
} else if (String::Equals(type_name, factory->int32x4_string())) {
DCHECK((instr->temp1() != NULL) && (instr->temp2() != NULL));
Register map = ToRegister(instr->temp1());
Register scratch = ToRegister(instr->temp2());
__ JumpIfSmi(value, false_label);
__ CompareObjectType(value, map, scratch, INT32X4_TYPE);
EmitBranch(instr, eq);
} else if (String::Equals(type_name, factory->bool32x4_string())) {
DCHECK((instr->temp1() != NULL) && (instr->temp2() != NULL));
Register map = ToRegister(instr->temp1());
Register scratch = ToRegister(instr->temp2());
__ JumpIfSmi(value, false_label);
__ CompareObjectType(value, map, scratch, BOOL32X4_TYPE);
EmitBranch(instr, eq);
} else if (String::Equals(type_name, factory->int16x8_string())) {
DCHECK((instr->temp1() != NULL) && (instr->temp2() != NULL));
Register map = ToRegister(instr->temp1());
Register scratch = ToRegister(instr->temp2());
__ JumpIfSmi(value, false_label);
__ CompareObjectType(value, map, scratch, INT16X8_TYPE);
EmitBranch(instr, eq);
} else if (String::Equals(type_name, factory->bool16x8_string())) {
DCHECK((instr->temp1() != NULL) && (instr->temp2() != NULL));
Register map = ToRegister(instr->temp1());
Register scratch = ToRegister(instr->temp2());
__ JumpIfSmi(value, false_label);
__ CompareObjectType(value, map, scratch, BOOL16X8_TYPE);
EmitBranch(instr, eq);
} else if (String::Equals(type_name, factory->int8x16_string())) {
DCHECK((instr->temp1() != NULL) && (instr->temp2() != NULL));
Register map = ToRegister(instr->temp1());
Register scratch = ToRegister(instr->temp2());
__ JumpIfSmi(value, false_label);
__ CompareObjectType(value, map, scratch, INT8X16_TYPE);
EmitBranch(instr, eq);
} else if (String::Equals(type_name, factory->bool8x16_string())) {
DCHECK((instr->temp1() != NULL) && (instr->temp2() != NULL));
Register map = ToRegister(instr->temp1());
Register scratch = ToRegister(instr->temp2());
__ JumpIfSmi(value, false_label);
__ CompareObjectType(value, map, scratch, BOOL8X16_TYPE);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(type_name, factory->type##_string())) { \
DCHECK((instr->temp1() != NULL) && (instr->temp2() != NULL)); \
Register map = ToRegister(instr->temp1()); \
\
__ JumpIfSmi(value, false_label); \
__ Ldr(map, FieldMemOperand(value, HeapObject::kMapOffset)); \
__ CompareRoot(map, Heap::k##Type##MapRootIndex); \
EmitBranch(instr, eq);
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
__ B(false_label);

View File

@ -1981,14 +1981,14 @@ void Genesis::InitializeGlobal_harmony_simd() {
// Install SIMD type functions. Set the instance class names since
// InstallFunction only does this when we install on the GlobalObject.
#define SIMD128_INSTALL_FUNCTION(name, type, lane_count, lane_type) \
Handle<JSFunction> type##_function = InstallFunction( \
simd_object, #name, JS_VALUE_TYPE, JSValue::kSize, \
isolate->initial_object_prototype(), Builtins::kIllegal); \
native_context()->set_##type##_function(*type##_function); \
type##_function->SetInstanceClassName(*factory->name##_string());
#define SIMD128_INSTALL_FUNCTION(TYPE, Type, type, lane_count, lane_type) \
Handle<JSFunction> type##_function = InstallFunction( \
simd_object, #Type, JS_VALUE_TYPE, JSValue::kSize, \
isolate->initial_object_prototype(), Builtins::kIllegal); \
native_context()->set_##type##_function(*type##_function); \
type##_function->SetInstanceClassName(*factory->Type##_string());
SIMD128_TYPES(SIMD128_INSTALL_FUNCTION)
#undef SIMD128_INSTALL_FUNCTION
}

View File

@ -399,53 +399,50 @@ HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() {
is_function.Else();
{
IfBuilder is_float32x4(this);
is_float32x4.If<HCompareNumericAndBranch>(
instance_type, Add<HConstant>(FLOAT32X4_TYPE), Token::EQ);
is_float32x4.If<HCompareObjectEqAndBranch>(
map, Add<HConstant>(factory->float32x4_map()));
is_float32x4.Then();
{ Push(Add<HConstant>(factory->float32x4_string())); }
is_float32x4.Else();
{
IfBuilder is_int32x4(this);
is_int32x4.If<HCompareNumericAndBranch>(
instance_type, Add<HConstant>(INT32X4_TYPE), Token::EQ);
is_int32x4.If<HCompareObjectEqAndBranch>(
map, Add<HConstant>(factory->int32x4_map()));
is_int32x4.Then();
{ Push(Add<HConstant>(factory->int32x4_string())); }
is_int32x4.Else();
{
IfBuilder is_bool32x4(this);
is_bool32x4.If<HCompareNumericAndBranch>(
instance_type, Add<HConstant>(BOOL32X4_TYPE), Token::EQ);
is_bool32x4.If<HCompareObjectEqAndBranch>(
map, Add<HConstant>(factory->bool32x4_map()));
is_bool32x4.Then();
{ Push(Add<HConstant>(factory->bool32x4_string())); }
is_bool32x4.Else();
{
IfBuilder is_int16x8(this);
is_int16x8.If<HCompareNumericAndBranch>(
instance_type, Add<HConstant>(INT16X8_TYPE), Token::EQ);
is_int16x8.If<HCompareObjectEqAndBranch>(
map, Add<HConstant>(factory->int16x8_map()));
is_int16x8.Then();
{ Push(Add<HConstant>(factory->int16x8_string())); }
is_int16x8.Else();
{
IfBuilder is_bool16x8(this);
is_bool16x8.If<HCompareNumericAndBranch>(
instance_type, Add<HConstant>(BOOL16X8_TYPE),
Token::EQ);
is_bool16x8.If<HCompareObjectEqAndBranch>(
map, Add<HConstant>(factory->bool16x8_map()));
is_bool16x8.Then();
{ Push(Add<HConstant>(factory->bool16x8_string())); }
is_bool16x8.Else();
{
IfBuilder is_int8x16(this);
is_int8x16.If<HCompareNumericAndBranch>(
instance_type, Add<HConstant>(INT8X16_TYPE),
Token::EQ);
is_int8x16.If<HCompareObjectEqAndBranch>(
map, Add<HConstant>(factory->int8x16_map()));
is_int8x16.Then();
{ Push(Add<HConstant>(factory->int8x16_string())); }
is_int8x16.Else();
{
IfBuilder is_bool8x16(this);
is_bool8x16.If<HCompareNumericAndBranch>(
instance_type, Add<HConstant>(BOOL8X16_TYPE),
Token::EQ);
is_bool8x16.If<HCompareObjectEqAndBranch>(
map, Add<HConstant>(factory->bool8x16_map()));
is_bool8x16.Then();
{ Push(Add<HConstant>(factory->bool8x16_string())); }
is_bool8x16.Else();

View File

@ -3442,14 +3442,9 @@ void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) {
&if_false, &fall_through);
__ JumpIfSmi(r0, if_false);
Register map = r1;
Register type_reg = r2;
__ ldr(map, FieldMemOperand(r0, HeapObject::kMapOffset));
__ ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
__ sub(type_reg, type_reg, Operand(FIRST_SIMD_VALUE_TYPE));
__ cmp(type_reg, Operand(LAST_SIMD_VALUE_TYPE - FIRST_SIMD_VALUE_TYPE));
__ CompareObjectType(r0, r1, r1, SIMD128_VALUE_TYPE);
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
Split(ls, if_true, if_false, fall_through);
Split(eq, if_true, if_false, fall_through);
context()->Plug(if_true, if_false);
}
@ -5047,34 +5042,6 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ JumpIfSmi(r0, if_false);
__ CompareObjectType(r0, r0, r1, SYMBOL_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->float32x4_string())) {
__ JumpIfSmi(r0, if_false);
__ CompareObjectType(r0, r0, r1, FLOAT32X4_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int32x4_string())) {
__ JumpIfSmi(r0, if_false);
__ CompareObjectType(r0, r0, r1, INT32X4_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool32x4_string())) {
__ JumpIfSmi(r0, if_false);
__ CompareObjectType(r0, r0, r1, BOOL32X4_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int16x8_string())) {
__ JumpIfSmi(r0, if_false);
__ CompareObjectType(r0, r0, r1, INT16X8_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool16x8_string())) {
__ JumpIfSmi(r0, if_false);
__ CompareObjectType(r0, r0, r1, BOOL16X8_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int8x16_string())) {
__ JumpIfSmi(r0, if_false);
__ CompareObjectType(r0, r0, r1, INT8X16_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool8x16_string())) {
__ JumpIfSmi(r0, if_false);
__ CompareObjectType(r0, r0, r1, BOOL8X16_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->boolean_string())) {
__ CompareRoot(r0, Heap::kTrueValueRootIndex);
__ b(eq, if_true);
@ -5110,6 +5077,16 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset));
__ tst(r1, Operand(1 << Map::kIsUndetectable));
Split(eq, if_true, if_false, fall_through);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(check, factory->type##_string())) { \
__ JumpIfSmi(r0, if_false); \
__ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); \
__ CompareRoot(r0, Heap::k##Type##MapRootIndex); \
Split(eq, if_true, if_false, fall_through);
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
if (if_false != fall_through) __ jmp(if_false);
}

View File

@ -3132,14 +3132,9 @@ void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) {
&if_false, &fall_through);
__ JumpIfSmi(x0, if_false);
Register map = x10;
Register type_reg = x11;
__ Ldr(map, FieldMemOperand(x0, HeapObject::kMapOffset));
__ Ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
__ Sub(type_reg, type_reg, Operand(FIRST_SIMD_VALUE_TYPE));
__ Cmp(type_reg, Operand(LAST_SIMD_VALUE_TYPE - FIRST_SIMD_VALUE_TYPE));
__ CompareObjectType(x0, x10, x11, SIMD128_VALUE_TYPE);
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
Split(ls, if_true, if_false, fall_through);
Split(eq, if_true, if_false, fall_through);
context()->Plug(if_true, if_false);
}
@ -4743,42 +4738,6 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ JumpIfSmi(x0, if_false);
__ CompareObjectType(x0, x0, x1, SYMBOL_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->float32x4_string())) {
ASM_LOCATION(
"FullCodeGenerator::EmitLiteralCompareTypeof float32x4_string");
__ JumpIfSmi(x0, if_false);
__ CompareObjectType(x0, x0, x1, FLOAT32X4_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int32x4_string())) {
ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof int32x4_string");
__ JumpIfSmi(x0, if_false);
__ CompareObjectType(x0, x0, x1, INT32X4_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool32x4_string())) {
ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof bool32x4_string");
__ JumpIfSmi(x0, if_false);
__ CompareObjectType(x0, x0, x1, BOOL32X4_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int16x8_string())) {
ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof int16x8_string");
__ JumpIfSmi(x0, if_false);
__ CompareObjectType(x0, x0, x1, INT16X8_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool16x8_string())) {
ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof bool16x8_string");
__ JumpIfSmi(x0, if_false);
__ CompareObjectType(x0, x0, x1, BOOL16X8_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int8x16_string())) {
ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof int8x16_string");
__ JumpIfSmi(x0, if_false);
__ CompareObjectType(x0, x0, x1, INT8X16_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool8x16_string())) {
ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof bool8x16_string");
__ JumpIfSmi(x0, if_false);
__ CompareObjectType(x0, x0, x1, BOOL8X16_TYPE);
Split(eq, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->boolean_string())) {
ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof boolean_string");
__ JumpIfRoot(x0, Heap::kTrueValueRootIndex, if_true);
@ -4801,7 +4760,6 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ JumpIfObjectType(x0, x10, x11, JS_FUNCTION_TYPE, if_true);
__ CompareAndSplit(x11, JS_FUNCTION_PROXY_TYPE, eq, if_true, if_false,
fall_through);
} else if (String::Equals(check, factory->object_string())) {
ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof object_string");
__ JumpIfSmi(x0, if_false);
@ -4817,7 +4775,18 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ TestAndSplit(x10, 1 << Map::kIsUndetectable, if_true, if_false,
fall_through);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(check, factory->type##_string())) { \
ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof " \
#type "_string"); \
__ JumpIfSmi(x0, if_true); \
__ Ldr(x0, FieldMemOperand(x0, HeapObject::kMapOffset)); \
__ CompareRoot(x0, Heap::k##Type##MapRootIndex); \
Split(eq, if_true, if_false, fall_through);
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof other");
if (if_false != fall_through) __ B(if_false);

View File

@ -3333,13 +3333,9 @@ void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) {
&if_false, &fall_through);
__ JumpIfSmi(eax, if_false);
Register map = ebx;
__ mov(map, FieldOperand(eax, HeapObject::kMapOffset));
__ CmpInstanceType(map, FIRST_SIMD_VALUE_TYPE);
__ j(less, if_false);
__ CmpInstanceType(map, LAST_SIMD_VALUE_TYPE);
__ CmpObjectType(eax, SIMD128_VALUE_TYPE, ebx);
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
Split(less_equal, if_true, if_false, fall_through);
Split(equal, if_true, if_false, fall_through);
context()->Plug(if_true, if_false);
}
@ -4985,34 +4981,6 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ JumpIfSmi(eax, if_false);
__ CmpObjectType(eax, SYMBOL_TYPE, edx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->float32x4_string())) {
__ JumpIfSmi(eax, if_false);
__ CmpObjectType(eax, FLOAT32X4_TYPE, edx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int32x4_string())) {
__ JumpIfSmi(eax, if_false);
__ CmpObjectType(eax, INT32X4_TYPE, edx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool32x4_string())) {
__ JumpIfSmi(eax, if_false);
__ CmpObjectType(eax, BOOL32X4_TYPE, edx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int16x8_string())) {
__ JumpIfSmi(eax, if_false);
__ CmpObjectType(eax, INT16X8_TYPE, edx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool16x8_string())) {
__ JumpIfSmi(eax, if_false);
__ CmpObjectType(eax, BOOL16X8_TYPE, edx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int8x16_string())) {
__ JumpIfSmi(eax, if_false);
__ CmpObjectType(eax, INT8X16_TYPE, edx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool8x16_string())) {
__ JumpIfSmi(eax, if_false);
__ CmpObjectType(eax, BOOL8X16_TYPE, edx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->boolean_string())) {
__ cmp(eax, isolate()->factory()->true_value());
__ j(equal, if_true);
@ -5046,6 +5014,16 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ test_b(FieldOperand(edx, Map::kBitFieldOffset),
1 << Map::kIsUndetectable);
Split(zero, if_true, if_false, fall_through);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(check, factory->type##_string())) { \
__ JumpIfSmi(eax, if_false); \
__ cmp(FieldOperand(eax, HeapObject::kMapOffset), \
isolate()->factory()->type##_map()); \
Split(equal, if_true, if_false, fall_through);
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
if (if_false != fall_through) __ jmp(if_false);
}

View File

@ -3432,13 +3432,9 @@ void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) {
&if_false, &fall_through);
__ JumpIfSmi(v0, if_false);
Register map = a1;
Register type_reg = a2;
__ GetObjectType(v0, map, type_reg);
__ Subu(type_reg, type_reg, Operand(FIRST_SIMD_VALUE_TYPE));
__ GetObjectType(v0, a1, a1);
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
Split(ls, type_reg, Operand(LAST_SIMD_VALUE_TYPE - FIRST_SIMD_VALUE_TYPE),
if_true, if_false, fall_through);
Split(eq, a1, Operand(SIMD128_VALUE_TYPE), if_true, if_false, fall_through);
context()->Plug(if_true, if_false);
}
@ -5072,34 +5068,6 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(SYMBOL_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->float32x4_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(FLOAT32X4_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int32x4_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(INT32X4_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool32x4_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(BOOL32X4_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int16x8_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(INT16X8_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool16x8_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(BOOL16X8_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int8x16_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(INT8X16_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool8x16_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(BOOL8X16_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->boolean_string())) {
__ LoadRoot(at, Heap::kTrueValueRootIndex);
__ Branch(if_true, eq, v0, Operand(at));
@ -5134,6 +5102,16 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset));
__ And(a1, a1, Operand(1 << Map::kIsUndetectable));
Split(eq, a1, Operand(zero_reg), if_true, if_false, fall_through);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(check, factory->type##_string())) { \
__ JumpIfSmi(v0, if_false); \
__ lw(v0, FieldMemOperand(v0, HeapObject::kMapOffset)); \
__ LoadRoot(at, Heap::k##Type##MapRootIndex); \
Split(eq, v0, Operand(at), if_true, if_false, fall_through);
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
if (if_false != fall_through) __ jmp(if_false);
}

View File

@ -3433,13 +3433,9 @@ void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) {
&if_false, &fall_through);
__ JumpIfSmi(v0, if_false);
Register map = a1;
Register type_reg = a2;
__ GetObjectType(v0, map, type_reg);
__ Subu(type_reg, type_reg, Operand(FIRST_SIMD_VALUE_TYPE));
__ GetObjectType(v0, a1, a1);
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
Split(ls, type_reg, Operand(LAST_SIMD_VALUE_TYPE - FIRST_SIMD_VALUE_TYPE),
if_true, if_false, fall_through);
Split(eq, a1, Operand(SIMD128_VALUE_TYPE), if_true, if_false, fall_through);
context()->Plug(if_true, if_false);
}
@ -5074,34 +5070,6 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(SYMBOL_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->float32x4_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(FLOAT32X4_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int32x4_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(INT32X4_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool32x4_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(BOOL32X4_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int16x8_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(INT16X8_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool16x8_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(BOOL16X8_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int8x16_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(INT8X16_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool8x16_string())) {
__ JumpIfSmi(v0, if_false);
__ GetObjectType(v0, v0, a1);
Split(eq, a1, Operand(BOOL8X16_TYPE), if_true, if_false, fall_through);
} else if (String::Equals(check, factory->boolean_string())) {
__ LoadRoot(at, Heap::kTrueValueRootIndex);
__ Branch(if_true, eq, v0, Operand(at));
@ -5136,6 +5104,16 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset));
__ And(a1, a1, Operand(1 << Map::kIsUndetectable));
Split(eq, a1, Operand(zero_reg), if_true, if_false, fall_through);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(check, factory->type##_string())) { \
__ JumpIfSmi(v0, if_false); \
__ ld(v0, FieldMemOperand(v0, HeapObject::kMapOffset)); \
__ LoadRoot(at, Heap::k##Type##MapRootIndex); \
Split(eq, v0, Operand(at), if_true, if_false, fall_through);
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
if (if_false != fall_through) __ jmp(if_false);
}

View File

@ -3326,13 +3326,9 @@ void FullCodeGenerator::EmitIsSimdValue(CallRuntime* expr) {
&if_false, &fall_through);
__ JumpIfSmi(rax, if_false);
Register map = rbx;
__ movp(map, FieldOperand(rax, HeapObject::kMapOffset));
__ CmpInstanceType(map, FIRST_SIMD_VALUE_TYPE);
__ j(less, if_false);
__ CmpInstanceType(map, LAST_SIMD_VALUE_TYPE);
__ CmpObjectType(rax, SIMD128_VALUE_TYPE, rbx);
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
Split(less_equal, if_true, if_false, fall_through);
Split(equal, if_true, if_false, fall_through);
context()->Plug(if_true, if_false);
}
@ -4995,34 +4991,6 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ JumpIfSmi(rax, if_false);
__ CmpObjectType(rax, SYMBOL_TYPE, rdx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->float32x4_string())) {
__ JumpIfSmi(rax, if_false);
__ CmpObjectType(rax, FLOAT32X4_TYPE, rdx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int32x4_string())) {
__ JumpIfSmi(rax, if_false);
__ CmpObjectType(rax, INT32X4_TYPE, rdx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool32x4_string())) {
__ JumpIfSmi(rax, if_false);
__ CmpObjectType(rax, BOOL32X4_TYPE, rdx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int16x8_string())) {
__ JumpIfSmi(rax, if_false);
__ CmpObjectType(rax, INT16X8_TYPE, rdx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool16x8_string())) {
__ JumpIfSmi(rax, if_false);
__ CmpObjectType(rax, BOOL16X8_TYPE, rdx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->int8x16_string())) {
__ JumpIfSmi(rax, if_false);
__ CmpObjectType(rax, INT8X16_TYPE, rdx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->bool8x16_string())) {
__ JumpIfSmi(rax, if_false);
__ CmpObjectType(rax, BOOL8X16_TYPE, rdx);
Split(equal, if_true, if_false, fall_through);
} else if (String::Equals(check, factory->boolean_string())) {
__ CompareRoot(rax, Heap::kTrueValueRootIndex);
__ j(equal, if_true);
@ -5056,6 +5024,16 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ testb(FieldOperand(rdx, Map::kBitFieldOffset),
Immediate(1 << Map::kIsUndetectable));
Split(zero, if_true, if_false, fall_through);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(check, factory->type##_string())) { \
__ JumpIfSmi(rax, if_false); \
__ movp(rax, FieldOperand(rax, HeapObject::kMapOffset)); \
__ CompareRoot(rax, Heap::k##Type##MapRootIndex); \
Split(equal, if_true, if_false, fall_through);
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
if (if_false != fall_through) __ jmp(if_false);
}

View File

@ -2877,14 +2877,11 @@ bool Heap::CreateInitialMaps() {
ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number)
ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize,
mutable_heap_number)
ALLOCATE_MAP(FLOAT32X4_TYPE, Float32x4::kSize, float32x4)
ALLOCATE_MAP(INT32X4_TYPE, Int32x4::kSize, int32x4)
ALLOCATE_MAP(BOOL32X4_TYPE, Bool32x4::kSize, bool32x4)
ALLOCATE_MAP(INT16X8_TYPE, Int16x8::kSize, int16x8)
ALLOCATE_MAP(BOOL16X8_TYPE, Bool16x8::kSize, bool16x8)
ALLOCATE_MAP(INT8X16_TYPE, Int8x16::kSize, int8x16)
ALLOCATE_MAP(BOOL8X16_TYPE, Bool8x16::kSize, bool8x16)
ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol)
#define ALLOCATE_SIMD128_MAP(TYPE, Type, type, lane_count, lane_type) \
ALLOCATE_MAP(SIMD128_VALUE_TYPE, Type::kSize, type)
SIMD128_TYPES(ALLOCATE_SIMD128_MAP)
#undef ALLOCATE_SIMD128_MAP
ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign)
ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole);
@ -3023,30 +3020,30 @@ AllocationResult Heap::AllocateHeapNumber(double value, MutableMode mode,
return result;
}
#define SIMD_ALLOCATE_DEFINITION(type, type_name, lane_count, lane_type) \
AllocationResult Heap::Allocate##type(lane_type lanes[lane_count], \
PretenureFlag pretenure) { \
int size = type::kSize; \
STATIC_ASSERT(type::kSize <= Page::kMaxRegularHeapObjectSize); \
\
AllocationSpace space = SelectSpace(size, pretenure); \
\
HeapObject* result; \
{ \
AllocationResult allocation = \
AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); \
if (!allocation.To(&result)) return allocation; \
} \
\
result->set_map_no_write_barrier(type_name##_map()); \
type* instance = type::cast(result); \
for (int i = 0; i < lane_count; i++) { \
instance->set_lane(i, lanes[i]); \
} \
return result; \
#define SIMD_ALLOCATE_DEFINITION(TYPE, Type, type, lane_count, lane_type) \
AllocationResult Heap::Allocate##Type(lane_type lanes[lane_count], \
PretenureFlag pretenure) { \
int size = Type::kSize; \
STATIC_ASSERT(Type::kSize <= Page::kMaxRegularHeapObjectSize); \
\
AllocationSpace space = SelectSpace(size, pretenure); \
\
HeapObject* result; \
{ \
AllocationResult allocation = \
AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); \
if (!allocation.To(&result)) return allocation; \
} \
\
result->set_map_no_write_barrier(type##_map()); \
Type* instance = Type::cast(result); \
for (int i = 0; i < lane_count; i++) { \
instance->set_lane(i, lanes[i]); \
} \
return result; \
}
SIMD128_TYPES(SIMD_ALLOCATE_DEFINITION)
#undef SIMD_ALLOCATE_DEFINITION
AllocationResult Heap::AllocateCell(Object* value) {

View File

@ -1672,11 +1672,11 @@ class Heap {
PretenureFlag pretenure = NOT_TENURED);
// Allocates SIMD values from the given lane values.
#define SIMD_ALLOCATE_DECLARATION(type, type_name, lane_count, lane_type) \
AllocationResult Allocate##type(lane_type lanes[lane_count], \
#define SIMD_ALLOCATE_DECLARATION(TYPE, Type, type, lane_count, lane_type) \
AllocationResult Allocate##Type(lane_type lanes[lane_count], \
PretenureFlag pretenure = NOT_TENURED);
SIMD128_TYPES(SIMD_ALLOCATE_DECLARATION)
#undef SIMD_ALLOCATE_DECLARATION
// Allocates a byte array of the specified length
MUST_USE_RESULT AllocationResult

View File

@ -139,13 +139,7 @@ StaticVisitorBase::VisitorId StaticVisitorBase::GetVisitorId(
case HEAP_NUMBER_TYPE:
case MUTABLE_HEAP_NUMBER_TYPE:
case FLOAT32X4_TYPE:
case INT32X4_TYPE:
case BOOL32X4_TYPE:
case INT16X8_TYPE:
case BOOL16X8_TYPE:
case INT8X16_TYPE:
case BOOL8X16_TYPE:
case SIMD128_VALUE_TYPE:
return GetVisitorIdForSize(kVisitDataObject, kVisitDataObjectGeneric,
instance_size, has_unboxed_fields);

View File

@ -1326,20 +1326,17 @@ static String* TypeOfString(HConstant* constant, Isolate* isolate) {
}
case SYMBOL_TYPE:
return heap->symbol_string();
case FLOAT32X4_TYPE:
return heap->float32x4_string();
case INT32X4_TYPE:
return heap->int32x4_string();
case BOOL32X4_TYPE:
return heap->bool32x4_string();
case INT16X8_TYPE:
return heap->int16x8_string();
case BOOL16X8_TYPE:
return heap->bool16x8_string();
case INT8X16_TYPE:
return heap->int8x16_string();
case BOOL8X16_TYPE:
return heap->bool8x16_string();
case SIMD128_VALUE_TYPE: {
Unique<Map> map = constant->ObjectMap();
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
if (map.IsKnownGlobal(heap->type##_map())) { \
return heap->type##_string(); \
}
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
UNREACHABLE();
return nullptr;
}
case JS_FUNCTION_TYPE:
case JS_FUNCTION_PROXY_TYPE:
return heap->function_string();

View File

@ -2129,25 +2129,10 @@ HValue* HGraphBuilder::BuildToObject(HValue* receiver) {
Context::SYMBOL_FUNCTION_INDEX));
Push(constructor);
}
receiver_is_symbol.Else();
{
IfBuilder receiver_is_float32x4(this);
receiver_is_float32x4.If<HCompareNumericAndBranch>(
receiver_instance_type, Add<HConstant>(FLOAT32X4_TYPE),
Token::EQ);
receiver_is_float32x4.Then();
{
// Load global Float32x4 function.
HValue* constructor = Add<HLoadNamedField>(
native_context, nullptr,
HObjectAccess::ForContextSlot(
Context::FLOAT32X4_FUNCTION_INDEX));
Push(constructor);
}
receiver_is_float32x4.ElseDeopt(
Deoptimizer::kUndefinedOrNullInToObject);
receiver_is_float32x4.JoinContinuation(&wrap);
}
// TODO(bmeurer): Don't inline this into crankshaft code, as it will
// deoptimize on all SIMD128 objects.
receiver_is_symbol.ElseDeopt(
Deoptimizer::kUndefinedOrNullInToObject);
receiver_is_symbol.JoinContinuation(&wrap);
}
receiver_is_string.JoinContinuation(&wrap);

View File

@ -1689,12 +1689,11 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
}
// Test for NaN. Compare heap numbers in a general way,
// to hanlde NaNs correctly.
// to handle NaNs correctly.
__ cmp(FieldOperand(edx, HeapObject::kMapOffset),
Immediate(isolate()->factory()->heap_number_map()));
__ j(equal, &generic_heap_number_comparison, Label::kNear);
if (cc != equal) {
Label not_simd;
__ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset));
__ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
// Call runtime on identical JSObjects. Otherwise return equal.
@ -1704,11 +1703,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
__ cmpb(ecx, static_cast<uint8_t>(SYMBOL_TYPE));
__ j(equal, &runtime_call, Label::kFar);
// Call runtime on identical SIMD values since we must throw a TypeError.
__ cmpb(ecx, static_cast<uint8_t>(FIRST_SIMD_VALUE_TYPE));
__ j(less, &not_simd, Label::kFar);
__ cmpb(ecx, static_cast<uint8_t>(LAST_SIMD_VALUE_TYPE));
__ j(less_equal, &runtime_call, Label::kFar);
__ bind(&not_simd);
__ cmpb(ecx, static_cast<uint8_t>(SIMD128_VALUE_TYPE));
__ j(equal, &runtime_call, Label::kFar);
if (is_strong(strength())) {
// We have already tested for smis and heap numbers, so if both
// arguments are not strings we must proceed to the slow case.

View File

@ -2170,12 +2170,8 @@ void LCodeGen::DoBranch(LBranch* instr) {
if (expected.Contains(ToBooleanStub::SIMD_VALUE)) {
// SIMD value -> true.
Label not_simd;
__ CmpInstanceType(map, FIRST_SIMD_VALUE_TYPE);
__ j(less, &not_simd, Label::kNear);
__ CmpInstanceType(map, LAST_SIMD_VALUE_TYPE);
__ j(less_equal, instr->TrueLabel(chunk_));
__ bind(&not_simd);
__ CmpInstanceType(map, SIMD128_VALUE_TYPE);
__ j(equal, instr->TrueLabel(chunk_));
}
if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) {
@ -5543,40 +5539,16 @@ Condition LCodeGen::EmitTypeofIs(LTypeofIsAndBranch* instr, Register input) {
1 << Map::kIsUndetectable);
final_branch_condition = zero;
} else if (String::Equals(type_name, factory()->float32x4_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, FLOAT32X4_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory()->int32x4_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, INT32X4_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory()->bool32x4_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, BOOL32X4_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory()->int16x8_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, INT16X8_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory()->bool16x8_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, BOOL16X8_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory()->int8x16_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, INT8X16_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory()->bool8x16_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, BOOL8X16_TYPE, input);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(type_name, factory()->type##_string())) { \
__ JumpIfSmi(input, false_label, false_distance); \
__ cmp(FieldOperand(input, HeapObject::kMapOffset), \
factory()->type##_map()); \
final_branch_condition = equal;
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
__ jmp(false_label, false_distance);

View File

@ -107,22 +107,15 @@ Register NamedLoadHandlerCompiler::FrontendHeader(Register object_reg,
function_index = Context::SYMBOL_FUNCTION_INDEX;
} else if (map()->instance_type() == HEAP_NUMBER_TYPE) {
function_index = Context::NUMBER_FUNCTION_INDEX;
} else if (map()->instance_type() == FLOAT32X4_TYPE) {
function_index = Context::FLOAT32X4_FUNCTION_INDEX;
} else if (map()->instance_type() == INT32X4_TYPE) {
function_index = Context::INT32X4_FUNCTION_INDEX;
} else if (map()->instance_type() == BOOL32X4_TYPE) {
function_index = Context::BOOL32X4_FUNCTION_INDEX;
} else if (map()->instance_type() == INT16X8_TYPE) {
function_index = Context::INT16X8_FUNCTION_INDEX;
} else if (map()->instance_type() == BOOL16X8_TYPE) {
function_index = Context::BOOL16X8_FUNCTION_INDEX;
} else if (map()->instance_type() == INT8X16_TYPE) {
function_index = Context::INT8X16_FUNCTION_INDEX;
} else if (map()->instance_type() == BOOL8X16_TYPE) {
function_index = Context::BOOL8X16_FUNCTION_INDEX;
} else if (*map() == isolate()->heap()->boolean_map()) {
function_index = Context::BOOLEAN_FUNCTION_INDEX;
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (map().is_identical_to(isolate()->factory()->type##_map())) { \
function_index = Context::TYPE##_FUNCTION_INDEX;
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
check_type = SKIP_RECEIVER;
}

View File

@ -130,29 +130,23 @@ JSFunction* IC::GetRootConstructor(Map* receiver_map, Context* native_context) {
Isolate* isolate = receiver_map->GetIsolate();
if (receiver_map == isolate->heap()->boolean_map()) {
return native_context->boolean_function();
} else if (receiver_map->instance_type() == HEAP_NUMBER_TYPE) {
return native_context->number_function();
} else if (receiver_map->instance_type() < FIRST_NONSTRING_TYPE) {
return native_context->string_function();
} else if (receiver_map->instance_type() == SYMBOL_TYPE) {
return native_context->symbol_function();
} else if (receiver_map->instance_type() == FLOAT32X4_TYPE) {
return native_context->float32x4_function();
} else if (receiver_map->instance_type() == INT32X4_TYPE) {
return native_context->int32x4_function();
} else if (receiver_map->instance_type() == BOOL32X4_TYPE) {
return native_context->bool32x4_function();
} else if (receiver_map->instance_type() == INT16X8_TYPE) {
return native_context->int16x8_function();
} else if (receiver_map->instance_type() == BOOL16X8_TYPE) {
return native_context->bool16x8_function();
} else if (receiver_map->instance_type() == INT8X16_TYPE) {
return native_context->int8x16_function();
} else if (receiver_map->instance_type() == BOOL8X16_TYPE) {
return native_context->bool8x16_function();
} else {
return NULL;
}
if (receiver_map->instance_type() == HEAP_NUMBER_TYPE) {
return native_context->number_function();
}
if (receiver_map->instance_type() < FIRST_NONSTRING_TYPE) {
return native_context->string_function();
}
if (receiver_map->instance_type() == SYMBOL_TYPE) {
return native_context->symbol_function();
}
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
if (receiver_map == isolate->heap()->type##_map()) { \
return native_context->type##_function(); \
}
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
return nullptr;
}

View File

@ -291,15 +291,12 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow,
// Smis. If it's not a heap number, then return equal.
__ GetObjectType(a0, t4, t4);
if (cc == less || cc == greater) {
Label not_simd;
// Call runtime on identical JSObjects.
__ Branch(slow, greater, t4, Operand(FIRST_SPEC_OBJECT_TYPE));
// Call runtime on identical symbols since we need to throw a TypeError.
__ Branch(slow, eq, t4, Operand(SYMBOL_TYPE));
// Call runtime on identical SIMD values since we must throw a TypeError.
__ Branch(&not_simd, lt, t4, Operand(FIRST_SIMD_VALUE_TYPE));
__ Branch(slow, le, t4, Operand(LAST_SIMD_VALUE_TYPE));
__ bind(&not_simd);
__ Branch(slow, eq, t4, Operand(SIMD128_VALUE_TYPE));
if (is_strong(strength)) {
// Call the runtime on anything that is converted in the semantics, since
// we need to throw a TypeError. Smis have already been ruled out.
@ -308,7 +305,6 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow,
__ Branch(slow, ne, t4, Operand(zero_reg));
}
} else {
Label not_simd;
__ Branch(&heap_number, eq, t4, Operand(HEAP_NUMBER_TYPE));
// Comparing JS objects with <=, >= is complicated.
if (cc != eq) {
@ -316,9 +312,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow,
// Call runtime on identical symbols since we need to throw a TypeError.
__ Branch(slow, eq, t4, Operand(SYMBOL_TYPE));
// Call runtime on identical SIMD values since we must throw a TypeError.
__ Branch(&not_simd, lt, t4, Operand(FIRST_SIMD_VALUE_TYPE));
__ Branch(slow, le, t4, Operand(LAST_SIMD_VALUE_TYPE));
__ bind(&not_simd);
__ Branch(slow, eq, t4, Operand(SIMD128_VALUE_TYPE));
if (is_strong(strength)) {
// Call the runtime on anything that is converted in the semantics,
// since we need to throw a TypeError. Smis and heap numbers have

View File

@ -2183,13 +2183,10 @@ void LCodeGen::DoBranch(LBranch* instr) {
if (expected.Contains(ToBooleanStub::SIMD_VALUE)) {
// SIMD value -> true.
Label not_simd;
const Register scratch = scratch1();
__ lbu(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset));
__ Branch(&not_simd, lt, scratch, Operand(FIRST_SIMD_VALUE_TYPE));
__ Branch(instr->TrueLabel(chunk_), le, scratch,
Operand(LAST_SIMD_VALUE_TYPE));
__ bind(&not_simd);
__ Branch(instr->TrueLabel(chunk_), eq, scratch,
Operand(SIMD128_VALUE_TYPE));
}
if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) {
@ -5744,54 +5741,18 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
*cmp2 = Operand(zero_reg);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->float32x4_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(FLOAT32X4_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->int32x4_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(INT32X4_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->bool32x4_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(BOOL32X4_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->int16x8_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(INT16X8_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->bool16x8_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(BOOL16X8_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->int8x16_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(INT8X16_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->bool8x16_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(BOOL8X16_TYPE);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(type_name, factory->type##_string())) { \
__ JumpIfSmi(input, false_label); \
__ lw(input, FieldMemOperand(input, HeapObject::kMapOffset)); \
__ LoadRoot(at, Heap::k##Type##MapRootIndex); \
*cmp1 = input; \
*cmp2 = Operand(at); \
final_branch_condition = eq;
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
*cmp1 = at;

View File

@ -287,15 +287,12 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow,
// Smis. If it's not a heap number, then return equal.
__ GetObjectType(a0, t0, t0);
if (cc == less || cc == greater) {
Label not_simd;
// Call runtime on identical JSObjects.
__ Branch(slow, greater, t0, Operand(FIRST_SPEC_OBJECT_TYPE));
// Call runtime on identical symbols since we need to throw a TypeError.
__ Branch(slow, eq, t0, Operand(SYMBOL_TYPE));
// Call runtime on identical SIMD values since we must throw a TypeError.
__ Branch(&not_simd, lt, t0, Operand(FIRST_SIMD_VALUE_TYPE));
__ Branch(slow, le, t0, Operand(LAST_SIMD_VALUE_TYPE));
__ bind(&not_simd);
__ Branch(slow, eq, t0, Operand(SIMD128_VALUE_TYPE));
if (is_strong(strength)) {
// Call the runtime on anything that is converted in the semantics, since
// we need to throw a TypeError. Smis have already been ruled out.
@ -307,14 +304,11 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow,
__ Branch(&heap_number, eq, t0, Operand(HEAP_NUMBER_TYPE));
// Comparing JS objects with <=, >= is complicated.
if (cc != eq) {
Label not_simd;
__ Branch(slow, greater, t0, Operand(FIRST_SPEC_OBJECT_TYPE));
// Call runtime on identical symbols since we need to throw a TypeError.
__ Branch(slow, eq, t0, Operand(SYMBOL_TYPE));
// Call runtime on identical SIMD values since we must throw a TypeError.
__ Branch(&not_simd, lt, t0, Operand(FIRST_SIMD_VALUE_TYPE));
__ Branch(slow, le, t0, Operand(LAST_SIMD_VALUE_TYPE));
__ bind(&not_simd);
__ Branch(slow, eq, t0, Operand(SIMD128_VALUE_TYPE));
if (is_strong(strength)) {
// Call the runtime on anything that is converted in the semantics,
// since we need to throw a TypeError. Smis and heap numbers have

View File

@ -2284,13 +2284,10 @@ void LCodeGen::DoBranch(LBranch* instr) {
if (expected.Contains(ToBooleanStub::SIMD_VALUE)) {
// SIMD value -> true.
Label not_simd;
const Register scratch = scratch1();
__ lbu(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset));
__ Branch(&not_simd, lt, scratch, Operand(FIRST_SIMD_VALUE_TYPE));
__ Branch(instr->TrueLabel(chunk_), le, scratch,
Operand(LAST_SIMD_VALUE_TYPE));
__ bind(&not_simd);
__ Branch(instr->TrueLabel(chunk_), eq, scratch,
Operand(SIMD128_VALUE_TYPE));
}
if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) {
@ -5878,55 +5875,6 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
*cmp2 = Operand(SYMBOL_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->float32x4_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(FLOAT32X4_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->int32x4_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(INT32X4_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->bool32x4_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(BOOL32X4_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->int16x8_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(INT16X8_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->bool16x8_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(BOOL16X8_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->int8x16_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(INT8X16_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->bool8x16_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
*cmp1 = scratch;
*cmp2 = Operand(BOOL8X16_TYPE);
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->boolean_string())) {
__ LoadRoot(at, Heap::kTrueValueRootIndex);
__ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input));
@ -5976,6 +5924,20 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
*cmp2 = Operand(zero_reg);
final_branch_condition = eq;
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(type_name, factory->type##_string())) { \
__ JumpIfSmi(input, false_label); \
__ ld(input, FieldMemOperand(input, HeapObject::kMapOffset)); \
__ LoadRoot(at, Heap::k##Type##MapRootIndex); \
*cmp1 = input; \
*cmp2 = Operand(at); \
final_branch_condition = eq;
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
*cmp1 = at;
*cmp2 = Operand(zero_reg); // Set to valid regs, to avoid caller assertion.

View File

@ -57,26 +57,8 @@ void HeapObject::HeapObjectVerify() {
case MUTABLE_HEAP_NUMBER_TYPE:
HeapNumber::cast(this)->HeapNumberVerify();
break;
case FLOAT32X4_TYPE:
Float32x4::cast(this)->Float32x4Verify();
break;
case INT32X4_TYPE:
Int32x4::cast(this)->Int32x4Verify();
break;
case BOOL32X4_TYPE:
Bool32x4::cast(this)->Bool32x4Verify();
break;
case INT16X8_TYPE:
Int16x8::cast(this)->Int16x8Verify();
break;
case BOOL16X8_TYPE:
Bool16x8::cast(this)->Bool16x8Verify();
break;
case INT8X16_TYPE:
Int8x16::cast(this)->Int8x16Verify();
break;
case BOOL8X16_TYPE:
Bool8x16::cast(this)->Bool8x16Verify();
case SIMD128_VALUE_TYPE:
Simd128Value::cast(this)->Simd128ValueVerify();
break;
case FIXED_ARRAY_TYPE:
FixedArray::cast(this)->FixedArrayVerify();
@ -231,25 +213,7 @@ void HeapNumber::HeapNumberVerify() {
}
void Float32x4::Float32x4Verify() { CHECK(IsFloat32x4()); }
void Int32x4::Int32x4Verify() { CHECK(IsInt32x4()); }
void Bool32x4::Bool32x4Verify() { CHECK(IsBool32x4()); }
void Int16x8::Int16x8Verify() { CHECK(IsInt16x8()); }
void Bool16x8::Bool16x8Verify() { CHECK(IsBool16x8()); }
void Int8x16::Int8x16Verify() { CHECK(IsInt8x16()); }
void Bool8x16::Bool8x16Verify() { CHECK(IsBool8x16()); }
void Simd128Value::Simd128ValueVerify() { CHECK(IsSimd128Value()); }
void ByteArray::ByteArrayVerify() {

View File

@ -166,23 +166,17 @@ bool Object::IsHeapObject() const {
TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE)
TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE)
TYPE_CHECKER(Symbol, SYMBOL_TYPE)
TYPE_CHECKER(Simd128Value, SIMD128_VALUE_TYPE)
bool Object::IsSimd128Value() const {
if (!Object::IsHeapObject()) return false;
InstanceType instance_type = HeapObject::cast(this)->map()->instance_type();
return (instance_type >= FIRST_SIMD_VALUE_TYPE &&
instance_type <= LAST_SIMD_VALUE_TYPE);
}
TYPE_CHECKER(Float32x4, FLOAT32X4_TYPE)
TYPE_CHECKER(Int32x4, INT32X4_TYPE)
TYPE_CHECKER(Bool32x4, BOOL32X4_TYPE)
TYPE_CHECKER(Int16x8, INT16X8_TYPE)
TYPE_CHECKER(Bool16x8, BOOL16X8_TYPE)
TYPE_CHECKER(Int8x16, INT8X16_TYPE)
TYPE_CHECKER(Bool8x16, BOOL8X16_TYPE)
#define SIMD128_TYPE_CHECKER(TYPE, Type, type, lane_count, lane_type) \
bool Object::Is##Type() const { \
return Object::IsHeapObject() && \
HeapObject::cast(this)->map() == \
HeapObject::cast(this)->GetHeap()->type##_map(); \
}
SIMD128_TYPES(SIMD128_TYPE_CHECKER)
#undef SIMD128_TYPE_CHECKER
bool Object::IsString() const {

View File

@ -60,26 +60,8 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
HeapNumber::cast(this)->HeapNumberPrint(os);
os << ">";
break;
case FLOAT32X4_TYPE:
Float32x4::cast(this)->Float32x4Print(os);
break;
case INT32X4_TYPE:
Int32x4::cast(this)->Int32x4Print(os);
break;
case BOOL32X4_TYPE:
Bool32x4::cast(this)->Bool32x4Print(os);
break;
case INT16X8_TYPE:
Int16x8::cast(this)->Int16x8Print(os);
break;
case BOOL16X8_TYPE:
Bool16x8::cast(this)->Bool16x8Print(os);
break;
case INT8X16_TYPE:
Int16x8::cast(this)->Int16x8Print(os);
break;
case BOOL8X16_TYPE:
Bool16x8::cast(this)->Bool16x8Print(os);
case SIMD128_VALUE_TYPE:
Simd128Value::cast(this)->Simd128ValuePrint(os);
break;
case FIXED_DOUBLE_ARRAY_TYPE:
FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(os);
@ -209,6 +191,15 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
}
void Simd128Value::Simd128ValuePrint(std::ostream& os) { // NOLINT
#define PRINT_SIMD128_VALUE(TYPE, Type, type, lane_count, lane_type) \
if (Is##Type()) return Type::cast(this)->Type##Print(os);
SIMD128_TYPES(PRINT_SIMD128_VALUE)
#undef PRINT_SIMD128_VALUE
UNREACHABLE();
}
void Float32x4::Float32x4Print(std::ostream& os) { // NOLINT
char arr[100];
Vector<char> buffer(arr, arraysize(arr));

View File

@ -1405,27 +1405,17 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
os << '>';
break;
}
case FLOAT32X4_TYPE:
os << "<Float32x4>";
break;
case INT32X4_TYPE:
os << "<Int32x4>";
break;
case BOOL32X4_TYPE:
os << "<Bool32x4>";
break;
case INT16X8_TYPE:
os << "<Int16x8>";
break;
case BOOL16X8_TYPE:
os << "<Bool16x8>";
break;
case INT8X16_TYPE:
os << "<Int8x16>";
break;
case BOOL8X16_TYPE:
os << "<Bool8x16>";
case SIMD128_VALUE_TYPE: {
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
if (Is##Type()) { \
os << "<" #Type ">"; \
break; \
}
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
UNREACHABLE();
break;
}
case JS_PROXY_TYPE:
os << "<JSProxy>";
break;
@ -1569,13 +1559,7 @@ void HeapObject::IterateBody(InstanceType type, int object_size,
case HEAP_NUMBER_TYPE:
case MUTABLE_HEAP_NUMBER_TYPE:
case FLOAT32X4_TYPE:
case INT32X4_TYPE:
case BOOL32X4_TYPE:
case INT16X8_TYPE:
case BOOL16X8_TYPE:
case INT8X16_TYPE:
case BOOL8X16_TYPE:
case SIMD128_VALUE_TYPE:
case FILLER_TYPE:
case BYTE_ARRAY_TYPE:
case BYTECODE_ARRAY_TYPE:

View File

@ -375,13 +375,7 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
\
V(SYMBOL_TYPE) \
V(FLOAT32X4_TYPE) \
V(INT32X4_TYPE) \
V(BOOL32X4_TYPE) \
V(INT16X8_TYPE) \
V(BOOL16X8_TYPE) \
V(INT8X16_TYPE) \
V(BOOL8X16_TYPE) \
V(SIMD128_VALUE_TYPE) \
\
V(MAP_TYPE) \
V(CODE_TYPE) \
@ -675,13 +669,7 @@ enum InstanceType {
// objects.
HEAP_NUMBER_TYPE,
MUTABLE_HEAP_NUMBER_TYPE,
FLOAT32X4_TYPE, // FIRST_SIMD_VALUE_TYPE
INT32X4_TYPE,
BOOL32X4_TYPE,
INT16X8_TYPE,
BOOL16X8_TYPE,
INT8X16_TYPE,
BOOL8X16_TYPE, // LAST_SIMD_VALUE_TYPE
SIMD128_VALUE_TYPE,
FOREIGN_TYPE,
BYTE_ARRAY_TYPE,
BYTECODE_ARRAY_TYPE,
@ -765,9 +753,6 @@ enum InstanceType {
FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE,
LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE,
FIRST_NONSTRING_TYPE = SYMBOL_TYPE,
// Boundaries for testing for a SIMD types.
FIRST_SIMD_VALUE_TYPE = FLOAT32X4_TYPE,
LAST_SIMD_VALUE_TYPE = BOOL8X16_TYPE,
// Boundaries for testing for a fixed typed array.
FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE,
LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE,
@ -1602,11 +1587,14 @@ class HeapNumber: public HeapObject {
};
// The SimdValue128 class describes heap allocated 128 bit SIMD values.
// The Simd128Value class describes heap allocated 128 bit SIMD values.
class Simd128Value : public HeapObject {
public:
DECLARE_CAST(Simd128Value)
DECLARE_PRINTER(Simd128Value)
DECLARE_VERIFIER(Simd128Value)
// Checks that another instance is bit-wise equal.
bool BitwiseEquals(const Simd128Value* other) const;
// Computes a hash from the 128 bit value, viewed as 4 32-bit integers.
@ -1623,31 +1611,31 @@ class Simd128Value : public HeapObject {
};
#define SIMD128_TYPES(V) \
V(Float32x4, float32x4, 4, float) \
V(Int32x4, int32x4, 4, int32_t) \
V(Bool32x4, bool32x4, 4, bool) \
V(Int16x8, int16x8, 8, int16_t) \
V(Bool16x8, bool16x8, 8, bool) \
V(Int8x16, int8x16, 16, int8_t) \
V(Bool8x16, bool8x16, 16, bool)
// V has parameters (TYPE, Type, type, lane count, lane type)
#define SIMD128_TYPES(V) \
V(FLOAT32X4, Float32x4, float32x4, 4, float) \
V(INT32X4, Int32x4, int32x4, 4, int32_t) \
V(BOOL32X4, Bool32x4, bool32x4, 4, bool) \
V(INT16X8, Int16x8, int16x8, 8, int16_t) \
V(BOOL16X8, Bool16x8, bool16x8, 8, bool) \
V(INT8X16, Int8x16, int8x16, 16, int8_t) \
V(BOOL8X16, Bool8x16, bool8x16, 16, bool)
#define SIMD128_VALUE_CLASS(name, type, lane_count, lane_type) \
class name : public Simd128Value { \
public: \
inline lane_type get_lane(int lane) const; \
inline void set_lane(int lane, lane_type value); \
\
DECLARE_CAST(name) \
\
DECLARE_PRINTER(name) \
DECLARE_VERIFIER(name) \
\
private: \
DISALLOW_IMPLICIT_CONSTRUCTORS(name); \
#define SIMD128_VALUE_CLASS(TYPE, Type, type, lane_count, lane_type) \
class Type final : public Simd128Value { \
public: \
inline lane_type get_lane(int lane) const; \
inline void set_lane(int lane, lane_type value); \
\
DECLARE_CAST(Type) \
\
DECLARE_PRINTER(Type) \
\
private: \
DISALLOW_IMPLICIT_CONSTRUCTORS(Type); \
};
SIMD128_TYPES(SIMD128_VALUE_CLASS)
#undef SIMD128_VALUE_CLASS
enum EnsureElementsMode {

View File

@ -155,7 +155,7 @@ RUNTIME_FUNCTION(Runtime_SimdEquals) {
// args[1] is of unknown type.
if (args[1]->IsSimd128Value()) {
Simd128Value* b = Simd128Value::cast(args[1]);
if (a->map()->instance_type() == b->map()->instance_type()) {
if (a->map() == b->map()) {
if (a->IsFloat32x4()) {
result = Equals(Float32x4::cast(*a), Float32x4::cast(b));
} else {
@ -175,7 +175,7 @@ RUNTIME_FUNCTION(Runtime_SimdSameValue) {
// args[1] is of unknown type.
if (args[1]->IsSimd128Value()) {
Simd128Value* b = Simd128Value::cast(args[1]);
if (a->map()->instance_type() == b->map()->instance_type()) {
if (a->map() == b->map()) {
if (a->IsFloat32x4()) {
result = Float32x4::cast(*a)->SameValue(Float32x4::cast(b));
} else {
@ -195,7 +195,7 @@ RUNTIME_FUNCTION(Runtime_SimdSameValueZero) {
// args[1] is of unknown type.
if (args[1]->IsSimd128Value()) {
Simd128Value* b = Simd128Value::cast(args[1]);
if (a->map()->instance_type() == b->map()->instance_type()) {
if (a->map() == b->map()) {
if (a->IsFloat32x4()) {
result = Float32x4::cast(*a)->SameValueZero(Float32x4::cast(b));
} else {

View File

@ -83,7 +83,7 @@ Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorICSlot slot) {
}
if (obj->IsJSFunction() || obj->IsAllocationSite() || obj->IsSymbol() ||
obj->IsFloat32x4()) {
obj->IsSimd128Value()) {
return Handle<Object>(obj, isolate());
}

View File

@ -228,13 +228,7 @@ TypeImpl<Config>::BitsetType::Lub(i::Map* map) {
}
case HEAP_NUMBER_TYPE:
return kNumber & kTaggedPointer;
case FLOAT32X4_TYPE:
case INT32X4_TYPE:
case BOOL32X4_TYPE:
case INT16X8_TYPE:
case BOOL16X8_TYPE:
case INT8X16_TYPE:
case BOOL8X16_TYPE:
case SIMD128_VALUE_TYPE:
// TODO(bbudge): Add type bits for SIMD value types.
return kAny;
case JS_VALUE_TYPE:

View File

@ -1565,7 +1565,6 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
factory->heap_number_map());
__ j(equal, &heap_number, Label::kNear);
if (cc != equal) {
Label not_simd;
__ movp(rcx, FieldOperand(rax, HeapObject::kMapOffset));
__ movzxbl(rcx, FieldOperand(rcx, Map::kInstanceTypeOffset));
// Call runtime on identical objects. Otherwise return equal.
@ -1575,11 +1574,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
__ cmpb(rcx, Immediate(static_cast<uint8_t>(SYMBOL_TYPE)));
__ j(equal, &runtime_call, Label::kFar);
// Call runtime on identical SIMD values since we must throw a TypeError.
__ cmpb(rcx, Immediate(static_cast<uint8_t>(FIRST_SIMD_VALUE_TYPE)));
__ j(less, &not_simd, Label::kFar);
__ cmpb(rcx, Immediate(static_cast<uint8_t>(LAST_SIMD_VALUE_TYPE)));
__ j(less_equal, &runtime_call, Label::kFar);
__ bind(&not_simd);
__ cmpb(rcx, Immediate(static_cast<uint8_t>(SIMD128_VALUE_TYPE)));
__ j(equal, &runtime_call, Label::kFar);
if (is_strong(strength())) {
// We have already tested for smis and heap numbers, so if both
// arguments are not strings we must proceed to the slow case.

View File

@ -2215,12 +2215,8 @@ void LCodeGen::DoBranch(LBranch* instr) {
if (expected.Contains(ToBooleanStub::SIMD_VALUE)) {
// SIMD value -> true.
Label not_simd;
__ CmpInstanceType(map, FIRST_SIMD_VALUE_TYPE);
__ j(less, &not_simd, Label::kNear);
__ CmpInstanceType(map, LAST_SIMD_VALUE_TYPE);
__ j(less_equal, instr->TrueLabel(chunk_));
__ bind(&not_simd);
__ CmpInstanceType(map, SIMD128_VALUE_TYPE);
__ j(equal, instr->TrueLabel(chunk_));
}
if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) {
@ -5748,40 +5744,16 @@ Condition LCodeGen::EmitTypeofIs(LTypeofIsAndBranch* instr, Register input) {
Immediate(1 << Map::kIsUndetectable));
final_branch_condition = zero;
} else if (String::Equals(type_name, factory->float32x4_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, FLOAT32X4_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory->int32x4_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, INT32X4_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory->bool32x4_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, BOOL32X4_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory->int16x8_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, INT16X8_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory->bool16x8_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, BOOL16X8_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory->int8x16_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, INT8X16_TYPE, input);
final_branch_condition = equal;
} else if (String::Equals(type_name, factory->bool8x16_string())) {
__ JumpIfSmi(input, false_label, false_distance);
__ CmpObjectType(input, BOOL8X16_TYPE, input);
// clang-format off
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
} else if (String::Equals(type_name, factory->type##_string())) { \
__ JumpIfSmi(input, false_label, false_distance); \
__ movp(input, FieldOperand(input, HeapObject::kMapOffset)); \
__ CompareRoot(input, Heap::k##Type##MapRootIndex); \
final_branch_condition = equal;
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
// clang-format on
} else {
__ jmp(false_label, false_distance);

View File

@ -60,7 +60,10 @@ TEST(HeapMaps) {
Heap* heap = CcTest::heap();
CheckMap(heap->meta_map(), MAP_TYPE, Map::kSize);
CheckMap(heap->heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize);
CheckMap(heap->float32x4_map(), FLOAT32X4_TYPE, Float32x4::kSize);
#define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
CheckMap(heap->type##_map(), SIMD128_VALUE_TYPE, Type::kSize);
SIMD128_TYPES(SIMD128_TYPE)
#undef SIMD128_TYPE
CheckMap(heap->fixed_array_map(), FIXED_ARRAY_TYPE, kVariableSizeSentinel);
CheckMap(heap->string_map(), STRING_TYPE, kVariableSizeSentinel);
}