Revision: 9677
Author:   [email protected]
Date:     Tue Oct 18 04:30:29 2011
Log:      Fix bug in instanceof of bound functions on ARM.

Implement same on Mips.

BUG=v8:1774
TEST=mjsunit/function-bind

Review URL: http://codereview.chromium.org/8337012
http://code.google.com/p/v8/source/detail?r=9677

Modified:
 /branches/bleeding_edge/src/arm/macro-assembler-arm.cc
 /branches/bleeding_edge/src/mips/code-stubs-mips.cc
 /branches/bleeding_edge/src/mips/macro-assembler-mips.cc
 /branches/bleeding_edge/src/mips/macro-assembler-mips.h

=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Mon Oct 17 05:44:16 2011 +++ /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Tue Oct 18 04:30:29 2011
@@ -2044,7 +2044,8 @@
         FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
     ldr(scratch,
FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
-    tst(scratch, Operand(1 << SharedFunctionInfo::kBoundFunction));
+    tst(scratch,
+        Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction)));
     b(ne, miss);
   }

=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Fri Oct 14 00:08:20 2011 +++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Tue Oct 18 04:30:29 2011
@@ -4071,7 +4071,7 @@
   }

   // Get the prototype of the function.
-  __ TryGetFunctionPrototype(function, prototype, scratch, &slow);
+  __ TryGetFunctionPrototype(function, prototype, scratch, &slow, true);

   // Check that the function prototype is a JS object.
   __ JumpIfSmi(prototype, &slow);
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Thu Oct 13 01:00:10 2011 +++ /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Tue Oct 18 04:30:29 2011
@@ -3674,7 +3674,8 @@
 void MacroAssembler::TryGetFunctionPrototype(Register function,
                                              Register result,
                                              Register scratch,
-                                             Label* miss) {
+                                             Label* miss,
+                                             bool miss_on_bound_function) {
   // Check that the receiver isn't a smi.
   JumpIfSmi(function, miss);

@@ -3682,6 +3683,16 @@
   GetObjectType(function, result, scratch);
   Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE));

+  if (miss_on_bound_function) {
+    lw(scratch,
+       FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
+    lw(scratch,
+       FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
+    And(scratch, scratch,
+        Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction)));
+    Branch(miss, ne, scratch, Operand(zero_reg));
+  }
+
   // Make sure that the function has an instance prototype.
   Label non_instance;
   lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.h Thu Oct 13 01:00:10 2011 +++ /branches/bleeding_edge/src/mips/macro-assembler-mips.h Tue Oct 18 04:30:29 2011
@@ -887,7 +887,8 @@
   void TryGetFunctionPrototype(Register function,
                                Register result,
                                Register scratch,
-                               Label* miss);
+                               Label* miss,
+                               bool miss_on_bound_function = false);

   void GetObjectType(Register function,
                      Register map,

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to