Index: src/full-codegen/x87/full-codegen-x87.cc |
diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc |
index c4d0a0615cc5c901fff102dc729bda1751e68554..2113a1620601bef22dcbc0bde33de568095ebf36 100644 |
--- a/src/full-codegen/x87/full-codegen-x87.cc |
+++ b/src/full-codegen/x87/full-codegen-x87.cc |
@@ -3117,7 +3117,6 @@ void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) { |
context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
&if_false, &fall_through); |
- |
__ JumpIfSmi(eax, if_false); |
__ CmpObjectType(eax, JS_PROXY_TYPE, ebx); |
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
@@ -3196,49 +3195,40 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { |
VisitForAccumulatorValue(args->at(0)); |
- // If the object is a smi, we return null. |
- __ JumpIfSmi(eax, &null); |
- |
- // Check that the object is a JS object but take special care of JS |
- // functions to make sure they have 'Function' as their class. |
- // Assume that there are only two callable types, and one of them is at |
- // either end of the type range for JS object types. Saves extra comparisons. |
- STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
+ // If the object is not a JSReceiver, we return null. |
+ __ JumpIfSmi(eax, &null, Label::kNear); |
+ STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
__ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, eax); |
- // Map is now in eax. |
- __ j(below, &null); |
+ __ j(below, &null, Label::kNear); |
- __ CmpInstanceType(eax, LAST_JS_RECEIVER_TYPE); |
- STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
- LAST_JS_RECEIVER_TYPE - 1); |
- __ j(equal, &function); |
- // Assume that there is no larger type. |
- STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); |
+ // Return 'Function' for JSFunction objects. |
+ __ CmpInstanceType(eax, JS_FUNCTION_TYPE); |
+ __ j(equal, &function, Label::kNear); |
// Check if the constructor in the map is a JS function. |
__ GetMapConstructor(eax, eax, ebx); |
__ CmpInstanceType(ebx, JS_FUNCTION_TYPE); |
- __ j(not_equal, &non_function_constructor); |
+ __ j(not_equal, &non_function_constructor, Label::kNear); |
// eax now contains the constructor function. Grab the |
// instance class name from there. |
__ mov(eax, FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset)); |
__ mov(eax, FieldOperand(eax, SharedFunctionInfo::kInstanceClassNameOffset)); |
- __ jmp(&done); |
+ __ jmp(&done, Label::kNear); |
+ |
+ // Non-JS objects have class null. |
+ __ bind(&null); |
+ __ mov(eax, isolate()->factory()->null_value()); |
+ __ jmp(&done, Label::kNear); |
// Functions have class 'Function'. |
__ bind(&function); |
__ mov(eax, isolate()->factory()->Function_string()); |
- __ jmp(&done); |
+ __ jmp(&done, Label::kNear); |
// Objects with a non-function constructor have class 'Object'. |
__ bind(&non_function_constructor); |
__ mov(eax, isolate()->factory()->Object_string()); |
- __ jmp(&done); |
- |
- // Non-JS objects have class null. |
- __ bind(&null); |
- __ mov(eax, isolate()->factory()->null_value()); |
// All done. |
__ bind(&done); |