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

Unified Diff: src/macros.py

Issue 6232: Minor cleanups to macros.py. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/macros.py
===================================================================
--- src/macros.py (revision 413)
+++ src/macros.py (working copy)
@@ -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 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_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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698