| Index: src/x64/lithium-codegen-x64.cc
|
| diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
|
| index 3a98fcb18b901460715975b09b93b911dc981af8..f1f29d85458102d4d553fb8dd38439d84691d32f 100644
|
| --- a/src/x64/lithium-codegen-x64.cc
|
| +++ b/src/x64/lithium-codegen-x64.cc
|
| @@ -5611,32 +5611,33 @@ Condition LCodeGen::EmitTypeofIs(LTypeofIsAndBranch* instr, Register input) {
|
| final_branch_condition = not_zero;
|
|
|
| } else if (String::Equals(type_name, factory->function_string())) {
|
| - STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
|
| __ JumpIfSmi(input, false_label, false_distance);
|
| - __ CmpObjectType(input, JS_FUNCTION_TYPE, input);
|
| - __ j(equal, true_label, true_distance);
|
| - __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE);
|
| + // Check for callable and not undetectable objects => true.
|
| + __ movp(input, FieldOperand(input, HeapObject::kMapOffset));
|
| + __ movzxbl(input, FieldOperand(input, Map::kBitFieldOffset));
|
| + __ andb(input,
|
| + Immediate((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)));
|
| + __ cmpb(input, Immediate(1 << Map::kIsCallable));
|
| final_branch_condition = equal;
|
|
|
| } else if (String::Equals(type_name, factory->object_string())) {
|
| __ JumpIfSmi(input, false_label, false_distance);
|
| __ CompareRoot(input, Heap::kNullValueRootIndex);
|
| __ j(equal, true_label, true_distance);
|
| - __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input);
|
| + STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
|
| + __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, input);
|
| __ j(below, false_label, false_distance);
|
| - __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE);
|
| - __ j(above, false_label, false_distance);
|
| - // Check for undetectable objects => false.
|
| + // Check for callable or undetectable objects => false.
|
| __ testb(FieldOperand(input, Map::kBitFieldOffset),
|
| - Immediate(1 << Map::kIsUndetectable));
|
| + Immediate((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)));
|
| final_branch_condition = zero;
|
|
|
| // 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); \
|
| + __ CompareRoot(FieldOperand(input, HeapObject::kMapOffset), \
|
| + Heap::k##Type##MapRootIndex); \
|
| final_branch_condition = equal;
|
| SIMD128_TYPES(SIMD128_TYPE)
|
| #undef SIMD128_TYPE
|
|
|