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

Unified Diff: src/string.js

Issue 1384443002: [es6] Fix missing bits for full @@toPrimitive support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove useless cctest. 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
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index bd20226757d879347c80ecdce3a3dc50868bc183..3fa8e5c2b700c76a396d6da53f70102b16c82cad 100644
--- a/src/string.js
+++ b/src/string.js
@@ -18,7 +18,6 @@ var InternalPackedArray = utils.InternalPackedArray;
var RegExpExec;
var RegExpExecNoTests;
var RegExpLastMatchInfo;
-var ToNumber;
utils.Import(function(from) {
ArrayIndexOf = from.ArrayIndexOf;
@@ -26,7 +25,6 @@ utils.Import(function(from) {
RegExpExec = from.RegExpExec;
RegExpExecNoTests = from.RegExpExecNoTests;
RegExpLastMatchInfo = from.RegExpLastMatchInfo;
- ToNumber = from.ToNumber;
});
//-------------------------------------------------------------------
@@ -118,7 +116,7 @@ function StringLastIndexOfJS(pat /* position */) { // length == 1
var patLength = pat.length;
var index = subLength - patLength;
if (%_ArgumentsLength() > 1) {
- var position = ToNumber(%_Arguments(1));
+ var position = TO_NUMBER(%_Arguments(1));
if (!NUMBER_IS_NAN(position)) {
position = TO_INTEGER(position);
if (position < 0) {
@@ -804,7 +802,7 @@ function StringTrimRight() {
function StringFromCharCode(code) {
var n = %_ArgumentsLength();
if (n == 1) {
- if (!%_IsSmi(code)) code = ToNumber(code);
+ if (!%_IsSmi(code)) code = TO_NUMBER(code);
return %_StringCharFromCode(code & 0xffff);
}
@@ -812,7 +810,7 @@ function StringFromCharCode(code) {
var i;
for (i = 0; i < n; i++) {
var code = %_Arguments(i);
- if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff;
+ if (!%_IsSmi(code)) code = TO_NUMBER(code) & 0xffff;
if (code < 0) code = code & 0xffff;
if (code > 0xff) break;
%_OneByteSeqStringSetChar(i, code, one_byte);
@@ -823,7 +821,7 @@ function StringFromCharCode(code) {
var two_byte = %NewString(n - i, NEW_TWO_BYTE_STRING);
for (var j = 0; i < n; i++, j++) {
var code = %_Arguments(i);
- if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff;
+ if (!%_IsSmi(code)) code = TO_NUMBER(code) & 0xffff;
%_TwoByteSeqStringSetChar(j, code, two_byte);
}
return one_byte + two_byte;
@@ -1087,7 +1085,7 @@ function StringFromCodePoint(_) { // length = 1
for (index = 0; index < length; index++) {
code = %_Arguments(index);
if (!%_IsSmi(code)) {
- code = ToNumber(code);
+ code = TO_NUMBER(code);
}
if (code < 0 || code > 0x10FFFF || code !== TO_INTEGER(code)) {
throw MakeRangeError(kInvalidCodePoint, code);

Powered by Google App Engine
This is Rietveld 408576698