Skip to content

Commit 246d5bb

Browse files
jyanCommit bot
authored andcommitted
PPC/S390: Fix %FunctionGetName and %_ClassOf for bound functions.
port 8e303dd [email protected], [email protected], [email protected], [email protected], [email protected] BUG=v8:5010 Review-Url: https://codereview.chromium.org/1986343002 Cr-Commit-Position: refs/heads/master@{#36323}
1 parent 84a8e81 commit 246d5bb

4 files changed

Lines changed: 16 additions & 12 deletions

File tree

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,11 +2493,12 @@ void LCodeGen::EmitClassOfTest(Label* is_true, Label* is_false,
24932493

24942494
__ JumpIfSmi(input, is_false);
24952495

2496-
__ CompareObjectType(input, temp, temp2, JS_FUNCTION_TYPE);
2496+
__ CompareObjectType(input, temp, temp2, FIRST_FUNCTION_TYPE);
2497+
STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE);
24972498
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
2498-
__ beq(is_true);
2499+
__ bge(is_true);
24992500
} else {
2500-
__ beq(is_false);
2501+
__ bge(is_false);
25012502
}
25022503

25032504
// Check if the constructor in the map is a function.

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2482,11 +2482,12 @@ void LCodeGen::EmitClassOfTest(Label* is_true, Label* is_false,
24822482

24832483
__ JumpIfSmi(input, is_false);
24842484

2485-
__ CompareObjectType(input, temp, temp2, JS_FUNCTION_TYPE);
2485+
__ CompareObjectType(input, temp, temp2, FIRST_FUNCTION_TYPE);
2486+
STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE);
24862487
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
2487-
__ beq(is_true);
2488+
__ bge(is_true);
24882489
} else {
2489-
__ beq(is_false);
2490+
__ bge(is_false);
24902491
}
24912492

24922493
// Check if the constructor in the map is a function.

src/full-codegen/ppc/full-codegen-ppc.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,9 +2829,10 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
28292829
// Map is now in r3.
28302830
__ blt(&null);
28312831

2832-
// Return 'Function' for JSFunction objects.
2833-
__ cmpi(r4, Operand(JS_FUNCTION_TYPE));
2834-
__ beq(&function);
2832+
// Return 'Function' for JSFunction and JSBoundFunction objects.
2833+
__ cmpli(r4, Operand(FIRST_FUNCTION_TYPE));
2834+
STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE);
2835+
__ bge(&function);
28352836

28362837
// Check if the constructor in the map is a JS function.
28372838
Register instance_type = r5;

src/full-codegen/s390/full-codegen-s390.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2761,9 +2761,10 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
27612761
// Map is now in r2.
27622762
__ blt(&null);
27632763

2764-
// Return 'Function' for JSFunction objects.
2765-
__ CmpP(r3, Operand(JS_FUNCTION_TYPE));
2766-
__ beq(&function);
2764+
// Return 'Function' for JSFunction and JSBoundFunction objects.
2765+
__ CmpLogicalP(r3, Operand(FIRST_FUNCTION_TYPE));
2766+
STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE);
2767+
__ bge(&function);
27672768

27682769
// Check if the constructor in the map is a JS function.
27692770
Register instance_type = r4;

0 commit comments

Comments
 (0)