Skip to content

Commit dcc283e

Browse files
lizhengxingCommit bot
authored andcommitted
X87: Fix %FunctionGetName and %_ClassOf for bound functions.
port 8e303dd (r36276) original commit message: BUG= Review-Url: https://codereview.chromium.org/1989153002 Cr-Commit-Position: refs/heads/master@{#36305}
1 parent c5a71f0 commit dcc283e

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/crankshaft/x87/lithium-codegen-x87.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,11 +2520,12 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
25202520
DCHECK(!temp.is(temp2));
25212521
__ JumpIfSmi(input, is_false);
25222522

2523-
__ CmpObjectType(input, JS_FUNCTION_TYPE, temp);
2523+
__ CmpObjectType(input, FIRST_FUNCTION_TYPE, temp);
2524+
STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE);
25242525
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
2525-
__ j(equal, is_true);
2526+
__ j(above_equal, is_true);
25262527
} else {
2527-
__ j(equal, is_false);
2528+
__ j(above_equal, is_false);
25282529
}
25292530

25302531
// Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.

src/full-codegen/x87/full-codegen-x87.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,9 +2715,10 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
27152715
__ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, eax);
27162716
__ j(below, &null, Label::kNear);
27172717

2718-
// Return 'Function' for JSFunction objects.
2719-
__ CmpInstanceType(eax, JS_FUNCTION_TYPE);
2720-
__ j(equal, &function, Label::kNear);
2718+
// Return 'Function' for JSFunction and JSBoundFunction objects.
2719+
__ CmpInstanceType(eax, FIRST_FUNCTION_TYPE);
2720+
STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE);
2721+
__ j(above_equal, &function, Label::kNear);
27212722

27222723
// Check if the constructor in the map is a JS function.
27232724
__ GetMapConstructor(eax, eax, ebx);

0 commit comments

Comments
 (0)