Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index ea42f22bec99f20877e840ca6ee6a91df94e675b..2d569e08cf1163b991aacc32482fbcde8493a157 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -1680,9 +1680,9 @@ Condition LCodeGen::EmitIsObject(Register input, |
__ j(not_zero, is_not_object); |
__ movzx_b(temp2, FieldOperand(temp1, Map::kInstanceTypeOffset)); |
- __ cmp(temp2, FIRST_JS_OBJECT_TYPE); |
+ __ cmp(temp2, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); |
__ j(below, is_not_object); |
- __ cmp(temp2, LAST_JS_OBJECT_TYPE); |
+ __ cmp(temp2, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
return below_equal; |
} |
@@ -1895,26 +1895,27 @@ void LCodeGen::EmitClassOfTest(Label* is_true, |
ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register. |
__ test(input, Immediate(kSmiTagMask)); |
__ j(zero, is_false); |
- __ CmpObjectType(input, FIRST_JS_OBJECT_TYPE, temp); |
+ __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); |
__ j(below, is_false); |
// Map is now in temp. |
// Functions have class 'Function'. |
- __ CmpInstanceType(temp, JS_FUNCTION_TYPE); |
+ __ CmpInstanceType(temp, FIRST_CALLABLE_SPEC_OBJECT_TYPE); |
if (class_name->IsEqualTo(CStrVector("Function"))) { |
- __ j(equal, is_true); |
+ __ j(above_equal, is_true); |
} else { |
- __ j(equal, is_false); |
+ __ j(above_equal, is_false); |
} |
// Check if the constructor in the map is a function. |
__ mov(temp, FieldOperand(temp, Map::kConstructorOffset)); |
- // As long as JS_FUNCTION_TYPE is the last instance type and it is |
- // right after LAST_JS_OBJECT_TYPE, we can avoid checking for |
- // LAST_JS_OBJECT_TYPE. |
- ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
- ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); |
+ // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type, and |
+ // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after |
+ // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter. |
+ STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); |
+ STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE == |
+ LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1); |
// Objects with a non-function constructor have class 'Object'. |
__ CmpObjectType(temp, JS_FUNCTION_TYPE, temp2); |
@@ -2635,7 +2636,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
// The receiver should be a JS object. |
__ test(receiver, Immediate(kSmiTagMask)); |
DeoptimizeIf(equal, instr->environment()); |
- __ CmpObjectType(receiver, FIRST_JS_OBJECT_TYPE, scratch); |
+ __ CmpObjectType(receiver, FIRST_SPEC_OBJECT_TYPE, scratch); |
DeoptimizeIf(below, instr->environment()); |
__ jmp(&receiver_ok, Label::kNear); |
@@ -4311,18 +4312,19 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label, |
final_branch_condition = not_zero; |
} else if (type_name->Equals(heap()->function_symbol())) { |
+ STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); |
__ JumpIfSmi(input, false_label); |
- __ CmpObjectType(input, FIRST_FUNCTION_CLASS_TYPE, input); |
+ __ CmpObjectType(input, FIRST_CALLABLE_SPEC_OBJECT_TYPE, input); |
final_branch_condition = above_equal; |
} else if (type_name->Equals(heap()->object_symbol())) { |
__ JumpIfSmi(input, false_label); |
__ cmp(input, factory()->null_value()); |
__ j(equal, true_label); |
- __ CmpObjectType(input, FIRST_JS_OBJECT_TYPE, input); |
+ __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); |
__ j(below, false_label); |
- __ CmpInstanceType(input, FIRST_FUNCTION_CLASS_TYPE); |
- __ j(above_equal, false_label); |
+ __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
+ __ j(above, false_label); |
// Check for undetectable objects => false. |
__ test_b(FieldOperand(input, Map::kBitFieldOffset), |
1 << Map::kIsUndetectable); |