Commit 8387c9b7 authored by kasperl@chromium.org's avatar kasperl@chromium.org

Minor cleanups to macros.py.

Review URL: http://codereview.chromium.org/6232

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@415 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9da356ee
......@@ -52,7 +52,7 @@ const STRING_HINT = 2;
const kFunctionTag = 0;
const kNewObjectTag = 1;
# For date.js
# For date.js.
const HoursPerDay = 24;
const MinutesPerHour = 60;
const SecondsPerMinute = 60;
......@@ -61,7 +61,7 @@ const msPerMinute = 60000;
const msPerHour = 3600000;
const msPerDay = 86400000;
# Note: kDayZeroInJulianDay = ToJulianDay(1970, 0, 1)
# Note: kDayZeroInJulianDay = ToJulianDay(1970, 0, 1).
const kInvalidDate = 'Invalid Date';
const kDayZeroInJulianDay = 2440588;
const kMonthMask = 0x1e0;
......@@ -69,7 +69,7 @@ const kDayMask = 0x01f;
const kYearShift = 9;
const kMonthShift = 5;
# Type query macros
# Type query macros.
macro IS_NULL(arg) = (arg === null);
macro IS_NULL_OR_UNDEFINED(arg) = (arg == null);
macro IS_UNDEFINED(arg) = (typeof(arg) === 'undefined');
......@@ -84,12 +84,12 @@ macro IS_DATE(arg) = (%ClassOf(arg) === 'Date');
macro IS_ERROR(arg) = (%ClassOf(arg) === 'Error');
macro IS_SCRIPT(arg) = (%ClassOf(arg) === 'Script');
# 'Inline' macros
# (Make sure arg is evaluated only once via %IS_VAR)
# Inline macros. Use %IS_VAR to make sure arg is evaluated only once.
macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg));
macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInteger(arg));
macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInt32(arg));
# Macros implemented in Python.
python macro CHAR_CODE(str) = ord(str[1]);
# Accessors for original global properties that ensure they have been loaded.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment