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

Side by Side Diff: src/macros.py

Issue 13064003: First steps towards implementing ArrayBuffer &co in V8 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added forgotten tests Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.h ('k') | src/messages.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2006-2009 the V8 project authors. All rights reserved. 1 # Copyright 2006-2009 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 macro IS_WEAKMAP(arg) = (%_ClassOf(arg) === 'WeakMap'); 109 macro IS_WEAKMAP(arg) = (%_ClassOf(arg) === 'WeakMap');
110 macro IS_DATE(arg) = (%_ClassOf(arg) === 'Date'); 110 macro IS_DATE(arg) = (%_ClassOf(arg) === 'Date');
111 macro IS_NUMBER_WRAPPER(arg) = (%_ClassOf(arg) === 'Number'); 111 macro IS_NUMBER_WRAPPER(arg) = (%_ClassOf(arg) === 'Number');
112 macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String'); 112 macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String');
113 macro IS_SYMBOL_WRAPPER(arg) = (%_ClassOf(arg) === 'Symbol'); 113 macro IS_SYMBOL_WRAPPER(arg) = (%_ClassOf(arg) === 'Symbol');
114 macro IS_BOOLEAN_WRAPPER(arg) = (%_ClassOf(arg) === 'Boolean'); 114 macro IS_BOOLEAN_WRAPPER(arg) = (%_ClassOf(arg) === 'Boolean');
115 macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error'); 115 macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error');
116 macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script'); 116 macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script');
117 macro IS_ARGUMENTS(arg) = (%_ClassOf(arg) === 'Arguments'); 117 macro IS_ARGUMENTS(arg) = (%_ClassOf(arg) === 'Arguments');
118 macro IS_GLOBAL(arg) = (%_ClassOf(arg) === 'global'); 118 macro IS_GLOBAL(arg) = (%_ClassOf(arg) === 'global');
119 macro IS_ARRAYBUFFER(arg) = (%_ClassOf(arg) === '__ArrayBuffer');
119 macro IS_UNDETECTABLE(arg) = (%_IsUndetectableObject(arg)); 120 macro IS_UNDETECTABLE(arg) = (%_IsUndetectableObject(arg));
120 macro FLOOR(arg) = $floor(arg); 121 macro FLOOR(arg) = $floor(arg);
121 122
122 # Macro for ECMAScript 5 queries of the type: 123 # Macro for ECMAScript 5 queries of the type:
123 # "Type(O) is object." 124 # "Type(O) is object."
124 # This is the same as being either a function or an object in V8 terminology 125 # This is the same as being either a function or an object in V8 terminology
125 # (including proxies). 126 # (including proxies).
126 # In addition, an undetectable object is also included by this. 127 # In addition, an undetectable object is also included by this.
127 macro IS_SPEC_OBJECT(arg) = (%_IsSpecObject(arg)); 128 macro IS_SPEC_OBJECT(arg) = (%_IsSpecObject(arg));
128 129
129 # Macro for ECMAScript 5 queries of the type: 130 # Macro for ECMAScript 5 queries of the type:
130 # "IsCallable(O)" 131 # "IsCallable(O)"
131 # We assume here that this is the same as being either a function or a function 132 # We assume here that this is the same as being either a function or a function
132 # proxy. That ignores host objects with [[Call]] methods, but in most situations 133 # proxy. That ignores host objects with [[Call]] methods, but in most situations
133 # we cannot handle those anyway. 134 # we cannot handle those anyway.
134 macro IS_SPEC_FUNCTION(arg) = (%_ClassOf(arg) === 'Function'); 135 macro IS_SPEC_FUNCTION(arg) = (%_ClassOf(arg) === 'Function');
135 136
136 # Indices in bound function info retrieved by %BoundFunctionGetBindings(...). 137 # Indices in bound function info retrieved by %BoundFunctionGetBindings(...).
137 const kBoundFunctionIndex = 0; 138 const kBoundFunctionIndex = 0;
138 const kBoundThisIndex = 1; 139 const kBoundThisIndex = 1;
139 const kBoundArgumentsStartIndex = 2; 140 const kBoundArgumentsStartIndex = 2;
140 141
141 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once. 142 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once.
142 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); 143 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg));
143 macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || ((arg == arg) && (arg != 1/0) && (arg != -1/0))); 144 macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || ((arg == arg) && (arg != 1/0) && (arg != -1/0)));
144 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber (arg))); 145 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber (arg)));
146 macro TO_POSITIVE_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? (arg > 0 ? arg : 0) : %NumberToPositiveInteger(ToNumber(arg)));
145 macro TO_INTEGER_MAP_MINUS_ZERO(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToI ntegerMapMinusZero(ToNumber(arg))); 147 macro TO_INTEGER_MAP_MINUS_ZERO(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToI ntegerMapMinusZero(ToNumber(arg)));
146 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0)); 148 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0));
147 macro TO_UINT32(arg) = (arg >>> 0); 149 macro TO_UINT32(arg) = (arg >>> 0);
148 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString (arg)); 150 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString (arg));
149 macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg : NonNumberToNumber (arg)); 151 macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg : NonNumberToNumber (arg));
150 macro TO_OBJECT_INLINE(arg) = (IS_SPEC_OBJECT(%IS_VAR(arg)) ? arg : ToObject(arg )); 152 macro TO_OBJECT_INLINE(arg) = (IS_SPEC_OBJECT(%IS_VAR(arg)) ? arg : ToObject(arg ));
151 macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ? %_NumberToString(arg) : "null"); 153 macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ? %_NumberToString(arg) : "null");
152 154
153 # Macros implemented in Python. 155 # Macros implemented in Python.
154 python macro CHAR_CODE(str) = ord(str[1]); 156 python macro CHAR_CODE(str) = ord(str[1]);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 const TYPE_EXTENSION = 1; 236 const TYPE_EXTENSION = 1;
235 const TYPE_NORMAL = 2; 237 const TYPE_NORMAL = 2;
236 238
237 # Matches Script::CompilationType from objects.h 239 # Matches Script::CompilationType from objects.h
238 const COMPILATION_TYPE_HOST = 0; 240 const COMPILATION_TYPE_HOST = 0;
239 const COMPILATION_TYPE_EVAL = 1; 241 const COMPILATION_TYPE_EVAL = 1;
240 const COMPILATION_TYPE_JSON = 2; 242 const COMPILATION_TYPE_JSON = 2;
241 243
242 # Matches Messages::kNoLineNumberInfo from v8.h 244 # Matches Messages::kNoLineNumberInfo from v8.h
243 const kNoLineNumberInfo = 0; 245 const kNoLineNumberInfo = 0;
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698