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

Unified Diff: src/date.js

Issue 1154483002: Hook up more import/exports in natives. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: do not leak utils object Created 5 years, 7 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/collection-iterator.js ('k') | src/generator.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/date.js
diff --git a/src/date.js b/src/date.js
index 3adf94d21697026fa1b585fadca059c2162840ac..3d494a136466dcf974cea107bf6b92ff82dda9c7 100644
--- a/src/date.js
+++ b/src/date.js
@@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This file relies on the fact that the following declarations have been made
-// in v8natives.js:
-// var $isFinite = GlobalIsFinite;
-
var $createDate;
// -------------------------------------------------------------------
@@ -22,10 +18,12 @@ var $createDate;
var GlobalDate = global.Date;
var InternalArray = utils.InternalArray;
+var IsFinite;
var MathAbs;
var MathFloor;
utils.Import(function(from) {
+ IsFinite = from.IsFinite;
MathAbs = from.MathAbs;
MathFloor = from.MathFloor;
});
@@ -60,10 +58,10 @@ function UTC(time) {
// ECMA 262 - 15.9.1.11
function MakeTime(hour, min, sec, ms) {
- if (!$isFinite(hour)) return NAN;
- if (!$isFinite(min)) return NAN;
- if (!$isFinite(sec)) return NAN;
- if (!$isFinite(ms)) return NAN;
+ if (!IsFinite(hour)) return NAN;
+ if (!IsFinite(min)) return NAN;
+ if (!IsFinite(sec)) return NAN;
+ if (!IsFinite(ms)) return NAN;
return TO_INTEGER(hour) * msPerHour
+ TO_INTEGER(min) * msPerMinute
+ TO_INTEGER(sec) * msPerSecond
@@ -84,7 +82,7 @@ function TimeInYear(year) {
// MakeDay(2007, -33, 1) --> MakeDay(2004, 3, 1)
// MakeDay(2007, 14, -50) --> MakeDay(2007, 8, 11)
function MakeDay(year, month, date) {
- if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) return NAN;
+ if (!IsFinite(year) || !IsFinite(month) || !IsFinite(date)) return NAN;
// Convert to integer and map -0 to 0.
year = TO_INTEGER_MAP_MINUS_ZERO(year);
@@ -116,7 +114,7 @@ function MakeDate(day, time) {
// ECMA 262 - 15.9.1.14
function TimeClip(time) {
- if (!$isFinite(time)) return NAN;
+ if (!IsFinite(time)) return NAN;
if (MathAbs(time) > MAX_TIME_MS) return NAN;
return TO_INTEGER(time);
}
@@ -774,7 +772,7 @@ function CreateDate(time) {
%FunctionSetPrototype(GlobalDate, new GlobalDate(NAN));
// Set up non-enumerable properties of the Date object itself.
-$installFunctions(GlobalDate, DONT_ENUM, [
+utils.InstallFunctions(GlobalDate, DONT_ENUM, [
"UTC", DateUTC,
"parse", DateParse,
"now", DateNow
@@ -785,7 +783,7 @@ $installFunctions(GlobalDate, DONT_ENUM, [
// Set up non-enumerable functions of the Date prototype object and
// set their names.
-$installFunctions(GlobalDate.prototype, DONT_ENUM, [
+utils.InstallFunctions(GlobalDate.prototype, DONT_ENUM, [
"toString", DateToString,
"toDateString", DateToDateString,
"toTimeString", DateToTimeString,
« no previous file with comments | « src/collection-iterator.js ('k') | src/generator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698