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

Unified Diff: src/runtime.js

Issue 1378533002: [es6] Introduce %ToInteger and %ToLength. (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 | « src/objects.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index c3b8ed22a1c4d6135d7ab9b13dc90b7f1d38de35..0e82d862bd7d70e9d0fe6f7f96ddf35c946922ba 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -15,8 +15,6 @@ var $NaN;
var $nonNumberToNumber;
var $sameValue;
var $sameValueZero;
-var $toInteger;
-var $toLength;
var $toNumber;
var $toPositiveInteger;
@@ -97,7 +95,7 @@ function REFLECT_APPLY_PREPARE(args) {
throw %make_type_error(kWrongArgs, "Reflect.apply");
}
- length = %to_length_fun(args.length);
+ length = TO_LENGTH(args.length);
// We can handle any number of apply arguments if the stack is
// big enough, but sanity check the value to avoid overflow when
@@ -147,7 +145,7 @@ function REFLECT_CONSTRUCT_PREPARE(
throw %make_type_error(kWrongArgs, "Reflect.construct");
}
- length = %to_length_fun(args.length);
+ length = TO_LENGTH(args.length);
// We can handle any number of apply arguments if the stack is
// big enough, but sanity check the value to avoid overflow when
@@ -216,21 +214,6 @@ function ToString(x) {
}
-// ECMA-262, section 9.4, page 34.
-function ToInteger(x) {
- if (%_IsSmi(x)) return x;
- return %NumberToInteger(ToNumber(x));
-}
-
-
-// ES6, draft 08-24-14, section 7.1.15
-function ToLength(arg) {
- arg = ToInteger(arg);
- if (arg < 0) return 0;
- return arg < kMaxSafeInteger ? arg : kMaxSafeInteger;
-}
-
-
// ES5, section 9.12
function SameValue(x, y) {
if (typeof x != typeof y) return false;
@@ -348,8 +331,6 @@ $NaN = %GetRootNaN();
$nonNumberToNumber = NonNumberToNumber;
$sameValue = SameValue;
$sameValueZero = SameValueZero;
-$toInteger = ToInteger;
-$toLength = ToLength;
$toNumber = ToNumber;
$toPositiveInteger = ToPositiveInteger;
@@ -363,14 +344,11 @@ $toPositiveInteger = ToPositiveInteger;
%InstallToContext([
"concat_iterable_to_array", ConcatIterableToArray,
"non_number_to_number", NonNumberToNumber,
- "to_integer_fun", ToInteger,
- "to_length_fun", ToLength,
"to_number_fun", ToNumber,
]);
utils.Export(function(to) {
to.ToBoolean = ToBoolean;
- to.ToLength = ToLength;
to.ToNumber = ToNumber;
to.ToString = ToString;
});
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698