Chromium Code Reviews| Index: src/ia32/lithium-codegen-ia32.cc |
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
| index 25961b28524e1c796f58a0662886f3fa2223e635..75fe392ea5de4af3ef5fc5a98a903522e8df0d5a 100644 |
| --- a/src/ia32/lithium-codegen-ia32.cc |
| +++ b/src/ia32/lithium-codegen-ia32.cc |
| @@ -1659,9 +1659,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; |
| } |
| @@ -1874,26 +1874,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(greater_equal, is_true); |
|
Kevin Millikin (Chromium)
2011/05/30 16:32:29
This needs to be above_equal (also just below).
rossberg
2011/05/31 14:50:24
Done.
|
| } else { |
| - __ j(equal, is_false); |
| + __ j(greater_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. |
| + ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); |
| + 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); |
| @@ -2598,7 +2599,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); |
| @@ -4258,22 +4259,20 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label, |
| final_branch_condition = not_zero; |
| } else if (type_name->Equals(heap()->function_symbol())) { |
| + ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); |
| __ JumpIfSmi(input, false_label); |
| - __ CmpObjectType(input, JS_FUNCTION_TYPE, input); |
| - __ j(equal, true_label); |
| - // Regular expressions => 'function' (they are callable). |
| - __ CmpInstanceType(input, JS_REGEXP_TYPE); |
| - final_branch_condition = equal; |
| + __ 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); |
| // Regular expressions => 'function', not 'object'. |
| - __ 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); |