Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: src/v8natives.js

Issue 6113004: Version 3.0.7 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/v8-counters.h ('k') | src/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 9fd2162686d65ae878107a5969ed1723e629070f..233f8b4de99dce9da64cc04147b1fee661acc461 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -83,7 +83,7 @@ function GlobalIsNaN(number) {
// ECMA 262 - 15.1.5
function GlobalIsFinite(number) {
- if (!IS_NUMBER(number)) number = ToNumber(number);
+ if (!IS_NUMBER(number)) number = NonNumberToNumber(number);
// NaN - NaN == NaN, Infinity - Infinity == NaN, -Infinity - -Infinity == NaN.
return %_IsSmi(number) || number - number == 0;
@@ -896,9 +896,14 @@ SetupObject();
function BooleanToString() {
// NOTE: Both Boolean objects and values can enter here as
// 'this'. This is not as dictated by ECMA-262.
- if (!IS_BOOLEAN(this) && !IS_BOOLEAN_WRAPPER(this))
- throw new $TypeError('Boolean.prototype.toString is not generic');
- return ToString(%_ValueOf(this));
+ var b = this;
+ if (!IS_BOOLEAN(b)) {
+ if (!IS_BOOLEAN_WRAPPER(b)) {
+ throw new $TypeError('Boolean.prototype.toString is not generic');
+ }
+ b = %_ValueOf(b);
+ }
+ return b ? 'true' : 'false';
}
@@ -951,7 +956,7 @@ function NumberToString(radix) {
}
// Fast case: Convert number in radix 10.
if (IS_UNDEFINED(radix) || radix === 10) {
- return ToString(number);
+ return %_NumberToString(number);
}
// Convert the radix to an integer and check the range.
@@ -1150,11 +1155,8 @@ function NewFunction(arg1) { // length == 1
var p = '';
if (n > 1) {
p = new $Array(n - 1);
- // Explicitly convert all parameters to strings.
- // Array.prototype.join replaces null with empty strings which is
- // not appropriate.
- for (var i = 0; i < n - 1; i++) p[i] = ToString(%_Arguments(i));
- p = p.join(',');
+ for (var i = 0; i < n - 1; i++) p[i] = %_Arguments(i);
+ p = Join(p, n - 1, ',', NonStringToString);
// If the formal parameters string include ) - an illegal
// character - it may make the combined function expression
// compile. We avoid this problem by checking for this early on.
« no previous file with comments | « src/v8-counters.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698