@@ -1933,12 +1933,8 @@ void LCodeGen::DoBranch(LBranch* instr) {
19331933
19341934 if (expected.Contains (ToBooleanStub::SIMD_VALUE )) {
19351935 // SIMD value -> true.
1936- Label not_simd;
1937- __ CompareInstanceType (map, scratch, FIRST_SIMD_VALUE_TYPE );
1938- __ B (lt, ¬_simd);
1939- __ CompareInstanceType (map, scratch, LAST_SIMD_VALUE_TYPE );
1940- __ B (le, true_label);
1941- __ Bind (¬_simd);
1936+ __ CompareInstanceType (map, scratch, SIMD128_VALUE_TYPE );
1937+ __ B (eq, true_label);
19421938 }
19431939
19441940 if (expected.Contains (ToBooleanStub::HEAP_NUMBER )) {
@@ -5997,68 +5993,19 @@ void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
59975993 __ Ldrb (scratch, FieldMemOperand (map, Map::kBitFieldOffset ));
59985994 EmitTestAndBranch (instr, eq, scratch, 1 << Map::kIsUndetectable );
59995995
6000- } else if (String::Equals (type_name, factory->float32x4_string ())) {
6001- DCHECK ((instr->temp1 () != NULL ) && (instr->temp2 () != NULL ));
6002- Register map = ToRegister (instr->temp1 ());
6003- Register scratch = ToRegister (instr->temp2 ());
6004-
6005- __ JumpIfSmi (value, false_label);
6006- __ CompareObjectType (value, map, scratch, FLOAT32X4_TYPE );
6007- EmitBranch (instr, eq);
6008-
6009- } else if (String::Equals (type_name, factory->int32x4_string ())) {
6010- DCHECK ((instr->temp1 () != NULL ) && (instr->temp2 () != NULL ));
6011- Register map = ToRegister (instr->temp1 ());
6012- Register scratch = ToRegister (instr->temp2 ());
6013-
6014- __ JumpIfSmi (value, false_label);
6015- __ CompareObjectType (value, map, scratch, INT32X4_TYPE );
6016- EmitBranch (instr, eq);
6017-
6018- } else if (String::Equals (type_name, factory->bool32x4_string ())) {
6019- DCHECK ((instr->temp1 () != NULL ) && (instr->temp2 () != NULL ));
6020- Register map = ToRegister (instr->temp1 ());
6021- Register scratch = ToRegister (instr->temp2 ());
6022-
6023- __ JumpIfSmi (value, false_label);
6024- __ CompareObjectType (value, map, scratch, BOOL32X4_TYPE );
6025- EmitBranch (instr, eq);
6026-
6027- } else if (String::Equals (type_name, factory->int16x8_string ())) {
6028- DCHECK ((instr->temp1 () != NULL ) && (instr->temp2 () != NULL ));
6029- Register map = ToRegister (instr->temp1 ());
6030- Register scratch = ToRegister (instr->temp2 ());
6031-
6032- __ JumpIfSmi (value, false_label);
6033- __ CompareObjectType (value, map, scratch, INT16X8_TYPE );
6034- EmitBranch (instr, eq);
6035-
6036- } else if (String::Equals (type_name, factory->bool16x8_string ())) {
6037- DCHECK ((instr->temp1 () != NULL ) && (instr->temp2 () != NULL ));
6038- Register map = ToRegister (instr->temp1 ());
6039- Register scratch = ToRegister (instr->temp2 ());
6040-
6041- __ JumpIfSmi (value, false_label);
6042- __ CompareObjectType (value, map, scratch, BOOL16X8_TYPE );
6043- EmitBranch (instr, eq);
6044-
6045- } else if (String::Equals (type_name, factory->int8x16_string ())) {
6046- DCHECK ((instr->temp1 () != NULL ) && (instr->temp2 () != NULL ));
6047- Register map = ToRegister (instr->temp1 ());
6048- Register scratch = ToRegister (instr->temp2 ());
6049-
6050- __ JumpIfSmi (value, false_label);
6051- __ CompareObjectType (value, map, scratch, INT8X16_TYPE );
6052- EmitBranch (instr, eq);
6053-
6054- } else if (String::Equals (type_name, factory->bool8x16_string ())) {
6055- DCHECK ((instr->temp1 () != NULL ) && (instr->temp2 () != NULL ));
6056- Register map = ToRegister (instr->temp1 ());
6057- Register scratch = ToRegister (instr->temp2 ());
6058-
6059- __ JumpIfSmi (value, false_label);
6060- __ CompareObjectType (value, map, scratch, BOOL8X16_TYPE );
5996+ // clang-format off
5997+ #define SIMD128_TYPE (TYPE, Type, type, lane_count, lane_type ) \
5998+ } else if (String::Equals (type_name, factory->type ##_string ())) { \
5999+ DCHECK ((instr->temp1 () != NULL ) && (instr->temp2 () != NULL )); \
6000+ Register map = ToRegister (instr->temp1 ()); \
6001+ \
6002+ __ JumpIfSmi (value, false_label); \
6003+ __ Ldr (map, FieldMemOperand (value, HeapObject::kMapOffset )); \
6004+ __ CompareRoot (map, Heap::k##Type##MapRootIndex); \
60616005 EmitBranch (instr, eq);
6006+ SIMD128_TYPES (SIMD128_TYPE )
6007+ #undef SIMD128_TYPE
6008+ // clang-format on
60626009
60636010 } else {
60646011 __ B (false_label);
0 commit comments