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

Unified Diff: src/array.js

Issue 1370943002: [builtins] Fix ToString in Array.prototype.join. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | src/runtime.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/array.js
diff --git a/src/array.js b/src/array.js
index 721121e9b35322a7135fcdb883d90e4bffd52081..b2b038dae3a16335d093e831b2ce3ea8ebf691fb 100644
--- a/src/array.js
+++ b/src/array.js
@@ -209,10 +209,11 @@ function Join(array, length, separator, convert) {
function ConvertToString(x) {
- // Assumes x is a non-string.
- if (IS_NUMBER(x)) return %_NumberToString(x);
- if (IS_BOOLEAN(x)) return x ? 'true' : 'false';
- return (IS_NULL_OR_UNDEFINED(x)) ? '' : ToString($defaultString(x));
+ if (IS_NULL_OR_UNDEFINED(x)) {
+ return '';
+ } else {
+ return TO_STRING(x);
+ }
}
@@ -224,7 +225,7 @@ function ConvertToLocaleString(e) {
// must throw a TypeError if ToObject(e).toLocaleString isn't
// callable.
var e_obj = TO_OBJECT(e);
- return ToString(e_obj.toLocaleString());
+ return TO_STRING(e_obj.toLocaleString());
}
}
« no previous file with comments | « no previous file | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698