Revision: 20614
Author:   [email protected]
Date:     Wed Apr  9 12:33:51 2014 UTC
Log:      Fix argument expectation Runtime_StringParseInt.

[email protected]

Review URL: https://codereview.chromium.org/230693002
http://code.google.com/p/v8/source/detail?r=20614

Added:
 /branches/bleeding_edge/test/mjsunit/regress/regress-parseint.js
Modified:
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-parseint.js Wed Apr 9 12:33:51 2014 UTC
@@ -0,0 +1,18 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function f(string, radix) {
+  // Use a phi to force radix into heap number representation.
+  radix = (radix == 0) ? radix : (radix >> 0);
+  if (radix != 2) return NaN;
+  return %StringParseInt(string, radix);
+}
+
+assertEquals(2, (-4294967294) >> 0);
+assertEquals(3, f("11", -4294967294));
+assertEquals(NaN, f("11", -2147483650));
+%OptimizeFunctionOnNextCall(f);
+assertEquals(3, f("11", -4294967294));
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Wed Apr  9 12:21:47 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Wed Apr  9 12:33:51 2014 UTC
@@ -6312,7 +6312,7 @@
   SealHandleScope shs(isolate);

   CONVERT_ARG_CHECKED(String, s, 0);
-  CONVERT_SMI_ARG_CHECKED(radix, 1);
+  CONVERT_NUMBER_CHECKED(int, radix, Int32, args[1]);

   s->TryFlatten();

--
--
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