From dcc283e82368309aeed5bb9f3b5228c13d7c39f7 Mon Sep 17 00:00:00 2001 From: "zhengxing.li" Date: Tue, 17 May 2016 23:58:03 -0700 Subject: [PATCH] X87: Fix %FunctionGetName and %_ClassOf for bound functions. port 8e303dd0b3d5ded8c91f5982bc565c2edd8c511b (r36276) original commit message: BUG= Review-Url: https://codereview.chromium.org/1989153002 Cr-Commit-Position: refs/heads/master@{#36305} --- src/crankshaft/x87/lithium-codegen-x87.cc | 7 ++++--- src/full-codegen/x87/full-codegen-x87.cc | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/crankshaft/x87/lithium-codegen-x87.cc b/src/crankshaft/x87/lithium-codegen-x87.cc index d2c829398f..62690376f5 100644 --- a/src/crankshaft/x87/lithium-codegen-x87.cc +++ b/src/crankshaft/x87/lithium-codegen-x87.cc @@ -2520,11 +2520,12 @@ void LCodeGen::EmitClassOfTest(Label* is_true, DCHECK(!temp.is(temp2)); __ JumpIfSmi(input, is_false); - __ CmpObjectType(input, JS_FUNCTION_TYPE, temp); + __ CmpObjectType(input, FIRST_FUNCTION_TYPE, temp); + STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE); if (String::Equals(isolate()->factory()->Function_string(), class_name)) { - __ j(equal, is_true); + __ j(above_equal, is_true); } else { - __ j(equal, is_false); + __ j(above_equal, is_false); } // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc index 753db70d54..c21a53ad3c 100644 --- a/src/full-codegen/x87/full-codegen-x87.cc +++ b/src/full-codegen/x87/full-codegen-x87.cc @@ -2715,9 +2715,10 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, eax); __ j(below, &null, Label::kNear); - // Return 'Function' for JSFunction objects. - __ CmpInstanceType(eax, JS_FUNCTION_TYPE); - __ j(equal, &function, Label::kNear); + // Return 'Function' for JSFunction and JSBoundFunction objects. + __ CmpInstanceType(eax, FIRST_FUNCTION_TYPE); + STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE); + __ j(above_equal, &function, Label::kNear); // Check if the constructor in the map is a JS function. __ GetMapConstructor(eax, eax, ebx);