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
This commit is contained in:
kasperl@chromium.org 2008-10-03 07:36:03 +00:00
parent 9da356eea6
commit 8387c9b701

View File

@ -28,9 +28,9 @@
# Dictionary that is passed as defines for js2c.py.
# Used for defines that must be defined for all native js files.
const NONE = 0;
const READ_ONLY = 1;
const DONT_ENUM = 2;
const NONE = 0;
const READ_ONLY = 1;
const DONT_ENUM = 2;
const DONT_DELETE = 4;
# Constants used for getter and setter operations.
@ -38,38 +38,38 @@ const GETTER = 0;
const SETTER = 1;
# These definitions must match the index of the properties in objects.h.
const kApiTagOffset = 0;
const kApiPropertyListOffset = 1;
const kApiSerialNumberOffset = 2;
const kApiConstructorOffset = 2;
const kApiPrototypeTemplateOffset = 5;
const kApiParentTemplateOffset = 6;
const kApiTagOffset = 0;
const kApiPropertyListOffset = 1;
const kApiSerialNumberOffset = 2;
const kApiConstructorOffset = 2;
const kApiPrototypeTemplateOffset = 5;
const kApiParentTemplateOffset = 6;
const NO_HINT = 0;
const NUMBER_HINT = 1;
const STRING_HINT = 2;
const kFunctionTag = 0;
const kNewObjectTag = 1;
const kFunctionTag = 0;
const kNewObjectTag = 1;
# For date.js
const HoursPerDay = 24;
const MinutesPerHour = 60;
const SecondsPerMinute = 60;
const msPerSecond = 1000;
const msPerMinute = 60000;
const msPerHour = 3600000;
const msPerDay = 86400000;
# For date.js.
const HoursPerDay = 24;
const MinutesPerHour = 60;
const SecondsPerMinute = 60;
const msPerSecond = 1000;
const msPerMinute = 60000;
const msPerHour = 3600000;
const msPerDay = 86400000;
# Note: kDayZeroInJulianDay = ToJulianDay(1970, 0, 1)
const kInvalidDate = 'Invalid Date';
const kDayZeroInJulianDay = 2440588;
const kMonthMask = 0x1e0;
const kDayMask = 0x01f;
const kYearShift = 9;
const kMonthShift = 5;
# Note: kDayZeroInJulianDay = ToJulianDay(1970, 0, 1).
const kInvalidDate = 'Invalid Date';
const kDayZeroInJulianDay = 2440588;
const kMonthMask = 0x1e0;
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,14 +84,14 @@ 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)
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));
# 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));
python macro CHAR_CODE(str) = ord(str[1]);
# Macros implemented in Python.
python macro CHAR_CODE(str) = ord(str[1]);
# Accessors for original global properties that ensure they have been loaded.
const ORIGINAL_REGEXP = (global.RegExp, $RegExp);
const ORIGINAL_DATE = (global.Date, $Date);
const ORIGINAL_REGEXP = (global.RegExp, $RegExp);
const ORIGINAL_DATE = (global.Date, $Date);