OLD | NEW |
1 # Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 # Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 # Type query macros. | 72 # Type query macros. |
73 macro IS_NULL(arg) = (arg === null); | 73 macro IS_NULL(arg) = (arg === null); |
74 macro IS_NULL_OR_UNDEFINED(arg) = (arg == null); | 74 macro IS_NULL_OR_UNDEFINED(arg) = (arg == null); |
75 macro IS_UNDEFINED(arg) = (typeof(arg) === 'undefined'); | 75 macro IS_UNDEFINED(arg) = (typeof(arg) === 'undefined'); |
76 macro IS_FUNCTION(arg) = (typeof(arg) === 'function'); | 76 macro IS_FUNCTION(arg) = (typeof(arg) === 'function'); |
77 macro IS_NUMBER(arg) = (typeof(arg) === 'number'); | 77 macro IS_NUMBER(arg) = (typeof(arg) === 'number'); |
78 macro IS_STRING(arg) = (typeof(arg) === 'string'); | 78 macro IS_STRING(arg) = (typeof(arg) === 'string'); |
79 macro IS_OBJECT(arg) = (typeof(arg) === 'object'); | 79 macro IS_OBJECT(arg) = (typeof(arg) === 'object'); |
80 macro IS_BOOLEAN(arg) = (typeof(arg) === 'boolean'); | 80 macro IS_BOOLEAN(arg) = (typeof(arg) === 'boolean'); |
81 macro IS_REGEXP(arg) = (%ClassOf(arg) === 'RegExp'); | 81 macro IS_REGEXP(arg) = (%ClassOf(arg) === 'RegExp'); |
82 macro IS_ARRAY(arg) = (%ClassOf(arg) === 'Array'); | 82 macro IS_ARRAY(arg) = %IsArrayClass(arg); |
83 macro IS_DATE(arg) = (%ClassOf(arg) === 'Date'); | 83 macro IS_DATE(arg) = %IsDateClass(arg); |
84 macro IS_ERROR(arg) = (%ClassOf(arg) === 'Error'); | 84 macro IS_ERROR(arg) = (%ClassOf(arg) === 'Error'); |
85 macro IS_SCRIPT(arg) = (%ClassOf(arg) === 'Script'); | 85 macro IS_SCRIPT(arg) = (%ClassOf(arg) === 'Script'); |
| 86 macro FLOOR(arg) = %Math_floor(arg); |
86 | 87 |
87 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once. | 88 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once. |
88 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); | 89 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); |
89 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInteger(arg)); | 90 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInteger(arg)); |
90 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInt32(arg)); | 91 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInt32(arg)); |
91 | 92 |
92 # Macros implemented in Python. | 93 # Macros implemented in Python. |
93 python macro CHAR_CODE(str) = ord(str[1]); | 94 python macro CHAR_CODE(str) = ord(str[1]); |
94 | 95 |
95 # Accessors for original global properties that ensure they have been loaded. | 96 # Accessors for original global properties that ensure they have been loaded. |
96 const ORIGINAL_REGEXP = (global.RegExp, $RegExp); | 97 const ORIGINAL_REGEXP = (global.RegExp, $RegExp); |
97 const ORIGINAL_DATE = (global.Date, $Date); | 98 const ORIGINAL_DATE = (global.Date, $Date); |
OLD | NEW |