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

Side by Side Diff: src/macros.py

Issue 292173011: Harden a few builtins (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: refactored Created 6 years, 7 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 | « no previous file | src/messages.js » ('j') | src/uri.js » ('J')
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 # "IsCallable(O)" 140 # "IsCallable(O)"
141 # We assume here that this is the same as being either a function or a function 141 # We assume here that this is the same as being either a function or a function
142 # proxy. That ignores host objects with [[Call]] methods, but in most situations 142 # proxy. That ignores host objects with [[Call]] methods, but in most situations
143 # we cannot handle those anyway. 143 # we cannot handle those anyway.
144 macro IS_SPEC_FUNCTION(arg) = (%_ClassOf(arg) === 'Function'); 144 macro IS_SPEC_FUNCTION(arg) = (%_ClassOf(arg) === 'Function');
145 145
146 # Macro for ES6 CheckObjectCoercible 146 # Macro for ES6 CheckObjectCoercible
147 # Will throw a TypeError of the form "[functionName] called on null or undefined ". 147 # Will throw a TypeError of the form "[functionName] called on null or undefined ".
148 macro CHECK_OBJECT_COERCIBLE(arg, functionName) = if (IS_NULL_OR_UNDEFINED(arg) && !IS_UNDETECTABLE(arg)) throw MakeTypeError('called_on_null_or_undefined', [fu nctionName]); 148 macro CHECK_OBJECT_COERCIBLE(arg, functionName) = if (IS_NULL_OR_UNDEFINED(arg) && !IS_UNDETECTABLE(arg)) throw MakeTypeError('called_on_null_or_undefined', [fu nctionName]);
149 149
150 # Equivalent of RUNTIME_ASSERT. Used to check for error conditions that should
151 # not be triggerable from user code (just tests).
152 macro BUILTIN_ASSERT(condition) = if (!(condition)) throw MakeInternalError();
153
150 # Indices in bound function info retrieved by %BoundFunctionGetBindings(...). 154 # Indices in bound function info retrieved by %BoundFunctionGetBindings(...).
151 const kBoundFunctionIndex = 0; 155 const kBoundFunctionIndex = 0;
152 const kBoundThisIndex = 1; 156 const kBoundThisIndex = 1;
153 const kBoundArgumentsStartIndex = 2; 157 const kBoundArgumentsStartIndex = 2;
154 158
155 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once. 159 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once.
156 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); 160 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg));
157 macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || ((arg == arg) && (arg != 1/0) && (arg != -1/0))); 161 macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || ((arg == arg) && (arg != 1/0) && (arg != -1/0)));
158 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber (arg))); 162 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber (arg)));
159 macro TO_INTEGER_FOR_SIDE_EFFECT(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToNumber( arg)); 163 macro TO_INTEGER_FOR_SIDE_EFFECT(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToNumber( arg));
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 # Matches PropertyAttributes from property-details.h 280 # Matches PropertyAttributes from property-details.h
277 const PROPERTY_ATTRIBUTES_NONE = 0; 281 const PROPERTY_ATTRIBUTES_NONE = 0;
278 const PROPERTY_ATTRIBUTES_STRING = 8; 282 const PROPERTY_ATTRIBUTES_STRING = 8;
279 const PROPERTY_ATTRIBUTES_SYMBOLIC = 16; 283 const PROPERTY_ATTRIBUTES_SYMBOLIC = 16;
280 const PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL = 32; 284 const PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL = 32;
281 285
282 # Use for keys, values and entries iterators. 286 # Use for keys, values and entries iterators.
283 const ITERATOR_KIND_KEYS = 1; 287 const ITERATOR_KIND_KEYS = 1;
284 const ITERATOR_KIND_VALUES = 2; 288 const ITERATOR_KIND_VALUES = 2;
285 const ITERATOR_KIND_ENTRIES = 3; 289 const ITERATOR_KIND_ENTRIES = 3;
OLDNEW
« no previous file with comments | « no previous file | src/messages.js » ('j') | src/uri.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698