Revision: 25202
Author:   [email protected]
Date:     Thu Nov  6 16:26:42 2014 UTC
Log:      MIPS: Turn ToNumberStub into a PlatformCodeStub again.

Port 724a15e8bf3fb8697a950c8e0f96158c8e56ec71
Port r25187

The HydrogenCodeStub is too expensive and there's no easy way to reduce
this cost, so turning it into a PlatformCodeStub solves that problem
until we can use TurboFan for code stubs.

TEST=mjsunit
BUG=
[email protected]

Review URL: https://codereview.chromium.org/707863002
https://code.google.com/p/v8/source/detail?r=25202

Modified:
 /branches/bleeding_edge/src/mips/code-stubs-mips.cc
 /branches/bleeding_edge/src/mips64/code-stubs-mips64.cc

=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Mon Oct 20 11:42:56 2014 UTC +++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Thu Nov 6 16:26:42 2014 UTC
@@ -3349,6 +3349,26 @@
   __ DropAndRet(3);
   generator.SkipSlow(masm, &runtime);
 }
+
+
+void ToNumberStub::Generate(MacroAssembler* masm) {
+  // The ToNumber stub takes one argument in a0.
+  Label check_heap_number, call_builtin;
+  __ JumpIfNotSmi(a0, &check_heap_number);
+  __ Ret(USE_DELAY_SLOT);
+  __ mov(v0, a0);
+
+  __ bind(&check_heap_number);
+  __ lw(a1, FieldMemOperand(a0, HeapObject::kMapOffset));
+  __ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
+  __ Branch(&call_builtin, ne, a1, Operand(at));
+  __ Ret(USE_DELAY_SLOT);
+  __ mov(v0, a0);
+
+  __ bind(&call_builtin);
+  __ push(a0);
+  __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION);
+}


 void StringHelper::GenerateFlatOneByteStringEquals(
=======================================
--- /branches/bleeding_edge/src/mips64/code-stubs-mips64.cc Mon Oct 20 17:59:59 2014 UTC +++ /branches/bleeding_edge/src/mips64/code-stubs-mips64.cc Thu Nov 6 16:26:42 2014 UTC
@@ -3374,6 +3374,26 @@
   __ DropAndRet(3);
   generator.SkipSlow(masm, &runtime);
 }
+
+
+void ToNumberStub::Generate(MacroAssembler* masm) {
+  // The ToNumber stub takes one argument in a0.
+  Label check_heap_number, call_builtin;
+  __ JumpIfNotSmi(a0, &check_heap_number);
+  __ Ret(USE_DELAY_SLOT);
+  __ mov(v0, a0);
+
+  __ bind(&check_heap_number);
+  __ ld(a1, FieldMemOperand(a0, HeapObject::kMapOffset));
+  __ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
+  __ Branch(&call_builtin, ne, a1, Operand(at));
+  __ Ret(USE_DELAY_SLOT);
+  __ mov(v0, a0);
+
+  __ bind(&call_builtin);
+  __ push(a0);
+  __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION);
+}


 void StringHelper::GenerateFlatOneByteStringEquals(

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to