ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #ifndef V8_RUNTIME_H_ |
| 29 | #define V8_RUNTIME_H_ |
| 30 | |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 31 | #include "allocation.h" |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 32 | #include "zone.h" |
| 33 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 34 | namespace v8 { |
| 35 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 36 | |
| 37 | // The interface to C++ runtime functions. |
| 38 | |
| 39 | // ---------------------------------------------------------------------------- |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 40 | // RUNTIME_FUNCTION_LIST_ALWAYS defines runtime calls available in both |
| 41 | // release and debug mode. |
| 42 | // This macro should only be used by the macro RUNTIME_FUNCTION_LIST. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 43 | |
ager@chromium.org | ce58e17 | 2009-05-13 07:11:48 +0000 | [diff] [blame] | 44 | // WARNING: RUNTIME_FUNCTION_LIST_ALWAYS_* is a very large macro that caused |
| 45 | // MSVC Intellisense to crash. It was broken into two macros to work around |
| 46 | // this problem. Please avoid large recursive macros whenever possible. |
| 47 | #define RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 48 | /* Property access */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 49 | F(GetProperty, 2, 1) \ |
| 50 | F(KeyedGetProperty, 2, 1) \ |
kmillikin@chromium.org | 49edbdf | 2011-02-16 12:32:18 +0000 | [diff] [blame] | 51 | F(DeleteProperty, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 52 | F(HasLocalProperty, 2, 1) \ |
| 53 | F(HasProperty, 2, 1) \ |
| 54 | F(HasElement, 2, 1) \ |
| 55 | F(IsPropertyEnumerable, 2, 1) \ |
| 56 | F(GetPropertyNames, 1, 1) \ |
| 57 | F(GetPropertyNamesFast, 1, 1) \ |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 58 | F(GetLocalPropertyNames, 1, 1) \ |
| 59 | F(GetLocalElementNames, 1, 1) \ |
| 60 | F(GetInterceptorInfo, 1, 1) \ |
| 61 | F(GetNamedInterceptorPropertyNames, 1, 1) \ |
| 62 | F(GetIndexedInterceptorElementNames, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 63 | F(GetArgumentsProperty, 1, 1) \ |
| 64 | F(ToFastProperties, 1, 1) \ |
| 65 | F(ToSlowProperties, 1, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 66 | F(FinishArrayPrototypeSetup, 1, 1) \ |
vegorov@chromium.org | f837290 | 2010-03-15 10:26:20 +0000 | [diff] [blame] | 67 | F(SpecialArrayFunctions, 1, 1) \ |
ricow@chromium.org | 4668a2c | 2011-08-29 10:41:00 +0000 | [diff] [blame] | 68 | F(GetDefaultReceiver, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 69 | \ |
erik.corry@gmail.com | d6076d9 | 2011-06-06 09:39:18 +0000 | [diff] [blame] | 70 | F(GetPrototype, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 71 | F(IsInPrototypeChain, 2, 1) \ |
| 72 | F(SetHiddenPrototype, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 73 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 74 | F(IsConstructCall, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 75 | \ |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 76 | F(GetOwnProperty, 2, 1) \ |
| 77 | \ |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 78 | F(IsExtensible, 1, 1) \ |
kmillikin@chromium.org | 69ea396 | 2010-07-05 11:01:40 +0000 | [diff] [blame] | 79 | F(PreventExtensions, 1, 1)\ |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 80 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 81 | /* Utilities */ \ |
fschneider@chromium.org | 1805e21 | 2011-09-05 10:49:12 +0000 | [diff] [blame] | 82 | F(CheckIsBootstrapping, 0, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 83 | F(GetFunctionDelegate, 1, 1) \ |
| 84 | F(GetConstructorDelegate, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 85 | F(NewArgumentsFast, 3, 1) \ |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 86 | F(NewStrictArgumentsFast, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 87 | F(LazyCompile, 1, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 88 | F(LazyRecompile, 1, 1) \ |
| 89 | F(NotifyDeoptimized, 1, 1) \ |
| 90 | F(NotifyOSR, 0, 1) \ |
ager@chromium.org | a9aa5fa | 2011-04-13 08:46:07 +0000 | [diff] [blame] | 91 | F(DeoptimizeFunction, 1, 1) \ |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 92 | F(RunningInSimulator, 0, 1) \ |
ager@chromium.org | a9aa5fa | 2011-04-13 08:46:07 +0000 | [diff] [blame] | 93 | F(OptimizeFunctionOnNextCall, 1, 1) \ |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 94 | F(GetOptimizationStatus, 1, 1) \ |
| 95 | F(GetOptimizationCount, 1, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 96 | F(CompileForOnStackReplacement, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 97 | F(SetNewFunctionAttributes, 1, 1) \ |
lrn@chromium.org | c4e51ac | 2010-08-09 09:47:21 +0000 | [diff] [blame] | 98 | F(AllocateInNewSpace, 1, 1) \ |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 99 | F(SetNativeFlag, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 100 | \ |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 101 | /* Array join support */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 102 | F(PushIfAbsent, 2, 1) \ |
| 103 | F(ArrayConcat, 1, 1) \ |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 104 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 105 | /* Conversions */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 106 | F(ToBool, 1, 1) \ |
| 107 | F(Typeof, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 108 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 109 | F(StringToNumber, 1, 1) \ |
| 110 | F(StringFromCharCodeArray, 1, 1) \ |
| 111 | F(StringParseInt, 2, 1) \ |
| 112 | F(StringParseFloat, 1, 1) \ |
| 113 | F(StringToLowerCase, 1, 1) \ |
| 114 | F(StringToUpperCase, 1, 1) \ |
fschneider@chromium.org | 086aac6 | 2010-03-17 13:18:24 +0000 | [diff] [blame] | 115 | F(StringSplit, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 116 | F(CharFromCode, 1, 1) \ |
| 117 | F(URIEscape, 1, 1) \ |
| 118 | F(URIUnescape, 1, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 119 | F(QuoteJSONString, 1, 1) \ |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 120 | F(QuoteJSONStringComma, 1, 1) \ |
ricow@chromium.org | c54d365 | 2011-05-30 09:20:16 +0000 | [diff] [blame] | 121 | F(QuoteJSONStringArray, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 122 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 123 | F(NumberToString, 1, 1) \ |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 124 | F(NumberToStringSkipCache, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 125 | F(NumberToInteger, 1, 1) \ |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 126 | F(NumberToIntegerMapMinusZero, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 127 | F(NumberToJSUint32, 1, 1) \ |
| 128 | F(NumberToJSInt32, 1, 1) \ |
| 129 | F(NumberToSmi, 1, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 130 | F(AllocateHeapNumber, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 131 | \ |
| 132 | /* Arithmetic operations */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 133 | F(NumberAdd, 2, 1) \ |
| 134 | F(NumberSub, 2, 1) \ |
| 135 | F(NumberMul, 2, 1) \ |
| 136 | F(NumberDiv, 2, 1) \ |
| 137 | F(NumberMod, 2, 1) \ |
| 138 | F(NumberUnaryMinus, 1, 1) \ |
ager@chromium.org | 6a2b0aa | 2010-07-13 20:58:03 +0000 | [diff] [blame] | 139 | F(NumberAlloc, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 140 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 141 | F(StringAdd, 2, 1) \ |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 142 | F(StringBuilderConcat, 3, 1) \ |
kmillikin@chromium.org | 49edbdf | 2011-02-16 12:32:18 +0000 | [diff] [blame] | 143 | F(StringBuilderJoin, 3, 1) \ |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 144 | F(SparseJoinWithSeparator, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 145 | \ |
| 146 | /* Bit operations */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 147 | F(NumberOr, 2, 1) \ |
| 148 | F(NumberAnd, 2, 1) \ |
| 149 | F(NumberXor, 2, 1) \ |
| 150 | F(NumberNot, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 151 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 152 | F(NumberShl, 2, 1) \ |
| 153 | F(NumberShr, 2, 1) \ |
| 154 | F(NumberSar, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 155 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 156 | /* Comparisons */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 157 | F(NumberEquals, 2, 1) \ |
| 158 | F(StringEquals, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 159 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 160 | F(NumberCompare, 3, 1) \ |
| 161 | F(SmiLexicographicCompare, 2, 1) \ |
| 162 | F(StringCompare, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 163 | \ |
| 164 | /* Math */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 165 | F(Math_acos, 1, 1) \ |
| 166 | F(Math_asin, 1, 1) \ |
| 167 | F(Math_atan, 1, 1) \ |
| 168 | F(Math_atan2, 2, 1) \ |
| 169 | F(Math_ceil, 1, 1) \ |
| 170 | F(Math_cos, 1, 1) \ |
| 171 | F(Math_exp, 1, 1) \ |
| 172 | F(Math_floor, 1, 1) \ |
| 173 | F(Math_log, 1, 1) \ |
| 174 | F(Math_pow, 2, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 175 | F(Math_pow_cfunction, 2, 1) \ |
whesse@chromium.org | cec079d | 2010-03-22 14:44:04 +0000 | [diff] [blame] | 176 | F(RoundNumber, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 177 | F(Math_sin, 1, 1) \ |
| 178 | F(Math_sqrt, 1, 1) \ |
| 179 | F(Math_tan, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 180 | \ |
| 181 | /* Regular expressions */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 182 | F(RegExpCompile, 3, 1) \ |
| 183 | F(RegExpExec, 4, 1) \ |
lrn@chromium.org | 25156de | 2010-04-06 13:10:27 +0000 | [diff] [blame] | 184 | F(RegExpExecMultiple, 4, 1) \ |
| 185 | F(RegExpInitializeObject, 5, 1) \ |
whesse@chromium.org | b6e43bb | 2010-04-14 09:36:28 +0000 | [diff] [blame] | 186 | F(RegExpConstructResult, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 187 | \ |
fschneider@chromium.org | e03fb64 | 2010-11-01 12:34:09 +0000 | [diff] [blame] | 188 | /* JSON */ \ |
| 189 | F(ParseJson, 1, 1) \ |
| 190 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 191 | /* Strings */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 192 | F(StringCharCodeAt, 2, 1) \ |
| 193 | F(StringIndexOf, 3, 1) \ |
| 194 | F(StringLastIndexOf, 3, 1) \ |
| 195 | F(StringLocaleCompare, 2, 1) \ |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 196 | F(SubString, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 197 | F(StringReplaceRegExpWithString, 4, 1) \ |
| 198 | F(StringMatch, 3, 1) \ |
christian.plesner.hansen@gmail.com | 9d58c2b | 2009-10-16 11:48:38 +0000 | [diff] [blame] | 199 | F(StringTrim, 3, 1) \ |
ager@chromium.org | beb2571 | 2010-11-29 08:02:25 +0000 | [diff] [blame] | 200 | F(StringToArray, 2, 1) \ |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame] | 201 | F(NewStringWrapper, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 202 | \ |
| 203 | /* Numbers */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 204 | F(NumberToRadixString, 2, 1) \ |
| 205 | F(NumberToFixed, 2, 1) \ |
| 206 | F(NumberToExponential, 2, 1) \ |
| 207 | F(NumberToPrecision, 2, 1) |
ager@chromium.org | ce58e17 | 2009-05-13 07:11:48 +0000 | [diff] [blame] | 208 | |
| 209 | #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 210 | /* Reflection */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 211 | F(FunctionSetInstanceClassName, 2, 1) \ |
| 212 | F(FunctionSetLength, 2, 1) \ |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 213 | F(BoundFunctionSetLength, 2, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 214 | F(FunctionSetPrototype, 2, 1) \ |
ricow@chromium.org | 2c99e28 | 2011-07-28 09:15:17 +0000 | [diff] [blame] | 215 | F(FunctionSetReadOnlyPrototype, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 216 | F(FunctionGetName, 1, 1) \ |
| 217 | F(FunctionSetName, 2, 1) \ |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 218 | F(FunctionNameShouldPrintAsAnonymous, 1, 1) \ |
| 219 | F(FunctionMarkNameShouldPrintAsAnonymous, 1, 1) \ |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 220 | F(FunctionSetBound, 1, 1) \ |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 221 | F(FunctionRemovePrototype, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 222 | F(FunctionGetSourceCode, 1, 1) \ |
| 223 | F(FunctionGetScript, 1, 1) \ |
| 224 | F(FunctionGetScriptSourcePosition, 1, 1) \ |
| 225 | F(FunctionGetPositionForOffset, 2, 1) \ |
| 226 | F(FunctionIsAPIFunction, 1, 1) \ |
christian.plesner.hansen@gmail.com | 2bc58ef | 2009-09-22 10:00:30 +0000 | [diff] [blame] | 227 | F(FunctionIsBuiltin, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 228 | F(GetScript, 1, 1) \ |
| 229 | F(CollectStackTrace, 2, 1) \ |
ager@chromium.org | 3811b43 | 2009-10-28 14:53:37 +0000 | [diff] [blame] | 230 | F(GetV8Version, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 231 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 232 | F(ClassOf, 1, 1) \ |
| 233 | F(SetCode, 2, 1) \ |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame] | 234 | F(SetExpectedNumberOfProperties, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 235 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 236 | F(CreateApiFunction, 1, 1) \ |
| 237 | F(IsTemplate, 1, 1) \ |
| 238 | F(GetTemplateField, 2, 1) \ |
| 239 | F(DisableAccessChecks, 1, 1) \ |
| 240 | F(EnableAccessChecks, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 241 | \ |
| 242 | /* Dates */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 243 | F(DateCurrentTime, 0, 1) \ |
| 244 | F(DateParseString, 2, 1) \ |
| 245 | F(DateLocalTimezone, 1, 1) \ |
| 246 | F(DateLocalTimeOffset, 0, 1) \ |
| 247 | F(DateDaylightSavingsOffset, 1, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 248 | F(DateMakeDay, 3, 1) \ |
vegorov@chromium.org | f837290 | 2010-03-15 10:26:20 +0000 | [diff] [blame] | 249 | F(DateYMDFromTime, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 250 | \ |
| 251 | /* Numbers */ \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 252 | \ |
| 253 | /* Globals */ \ |
fschneider@chromium.org | e03fb64 | 2010-11-01 12:34:09 +0000 | [diff] [blame] | 254 | F(CompileString, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 255 | F(GlobalPrint, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 256 | \ |
| 257 | /* Eval */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 258 | F(GlobalReceiver, 1, 1) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 259 | F(ResolvePossiblyDirectEval, 4, 2) \ |
| 260 | F(ResolvePossiblyDirectEvalNoLookup, 4, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 261 | \ |
ager@chromium.org | 9ee27ae | 2011-03-02 13:43:26 +0000 | [diff] [blame] | 262 | F(SetProperty, -1 /* 4 or 5 */, 1) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 263 | F(DefineOrRedefineDataProperty, 4, 1) \ |
| 264 | F(DefineOrRedefineAccessorProperty, 5, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 265 | F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 266 | \ |
| 267 | /* Arrays */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 268 | F(RemoveArrayHoles, 2, 1) \ |
| 269 | F(GetArrayKeys, 2, 1) \ |
| 270 | F(MoveArrayContents, 2, 1) \ |
| 271 | F(EstimateNumberOfElements, 1, 1) \ |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 272 | F(SwapElements, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 273 | \ |
| 274 | /* Getters and Setters */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 275 | F(DefineAccessor, -1 /* 4 or 5 */, 1) \ |
| 276 | F(LookupAccessor, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 277 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 278 | /* Literals */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 279 | F(MaterializeRegExpLiteral, 4, 1)\ |
| 280 | F(CreateArrayLiteralBoilerplate, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 281 | F(CloneLiteralBoilerplate, 1, 1) \ |
| 282 | F(CloneShallowLiteralBoilerplate, 1, 1) \ |
vegorov@chromium.org | f837290 | 2010-03-15 10:26:20 +0000 | [diff] [blame] | 283 | F(CreateObjectLiteral, 4, 1) \ |
| 284 | F(CreateObjectLiteralShallow, 4, 1) \ |
kmillikin@chromium.org | 13bd294 | 2009-12-16 15:36:05 +0000 | [diff] [blame] | 285 | F(CreateArrayLiteral, 3, 1) \ |
| 286 | F(CreateArrayLiteralShallow, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 287 | \ |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 288 | /* Harmony proxies */ \ |
| 289 | F(CreateJSProxy, 2, 1) \ |
erik.corry@gmail.com | d6076d9 | 2011-06-06 09:39:18 +0000 | [diff] [blame] | 290 | F(IsJSProxy, 1, 1) \ |
| 291 | F(GetHandler, 1, 1) \ |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 292 | F(Fix, 1, 1) \ |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 293 | \ |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 294 | /* Harmony weakmaps */ \ |
| 295 | F(WeakMapInitialize, 1, 1) \ |
| 296 | F(WeakMapGet, 2, 1) \ |
| 297 | F(WeakMapSet, 3, 1) \ |
| 298 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 299 | /* Statements */ \ |
vegorov@chromium.org | 21b5e95 | 2010-11-23 10:24:40 +0000 | [diff] [blame] | 300 | F(NewClosure, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 301 | F(NewObject, 1, 1) \ |
whesse@chromium.org | ba5a61b | 2010-07-26 11:44:40 +0000 | [diff] [blame] | 302 | F(NewObjectFromBound, 2, 1) \ |
whesse@chromium.org | 4a1fe7d | 2010-09-27 12:32:04 +0000 | [diff] [blame] | 303 | F(FinalizeInstanceSize, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 304 | F(Throw, 1, 1) \ |
| 305 | F(ReThrow, 1, 1) \ |
| 306 | F(ThrowReferenceError, 1, 1) \ |
whesse@chromium.org | 4a5224e | 2010-10-20 12:37:07 +0000 | [diff] [blame] | 307 | F(StackGuard, 0, 1) \ |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 308 | F(PromoteScheduledException, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 309 | \ |
| 310 | /* Contexts */ \ |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 311 | F(NewFunctionContext, 1, 1) \ |
vegorov@chromium.org | 3cf4731 | 2011-06-29 13:20:01 +0000 | [diff] [blame] | 312 | F(PushWithContext, 2, 1) \ |
| 313 | F(PushCatchContext, 3, 1) \ |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 314 | F(PushBlockContext, 2, 1) \ |
ager@chromium.org | 0ee099b | 2011-01-25 14:06:47 +0000 | [diff] [blame] | 315 | F(DeleteContextSlot, 2, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 316 | F(LoadContextSlot, 2, 2) \ |
| 317 | F(LoadContextSlotNoReferenceError, 2, 2) \ |
ager@chromium.org | 9ee27ae | 2011-03-02 13:43:26 +0000 | [diff] [blame] | 318 | F(StoreContextSlot, 4, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 319 | \ |
| 320 | /* Declarations and initialization */ \ |
fschneider@chromium.org | 1805e21 | 2011-09-05 10:49:12 +0000 | [diff] [blame] | 321 | F(DeclareGlobals, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 322 | F(DeclareContextSlot, 4, 1) \ |
ager@chromium.org | 9ee27ae | 2011-03-02 13:43:26 +0000 | [diff] [blame] | 323 | F(InitializeVarGlobal, -1 /* 2 or 3 */, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 324 | F(InitializeConstGlobal, 2, 1) \ |
| 325 | F(InitializeConstContextSlot, 3, 1) \ |
| 326 | F(OptimizeObjectForAddingMultipleProperties, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 327 | \ |
| 328 | /* Debugging */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 329 | F(DebugPrint, 1, 1) \ |
| 330 | F(DebugTrace, 0, 1) \ |
| 331 | F(TraceEnter, 0, 1) \ |
| 332 | F(TraceExit, 1, 1) \ |
| 333 | F(Abort, 2, 1) \ |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 334 | /* Logging */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 335 | F(Log, 2, 1) \ |
christian.plesner.hansen@gmail.com | 2bc58ef | 2009-09-22 10:00:30 +0000 | [diff] [blame] | 336 | /* ES5 */ \ |
| 337 | F(LocalKeys, 1, 1) \ |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 338 | /* Cache suport */ \ |
| 339 | F(GetFromCache, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 340 | \ |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 341 | /* Message objects */ \ |
| 342 | F(NewMessageObject, 2, 1) \ |
| 343 | F(MessageGetType, 1, 1) \ |
| 344 | F(MessageGetArguments, 1, 1) \ |
| 345 | F(MessageGetStartPosition, 1, 1) \ |
| 346 | F(MessageGetScript, 1, 1) \ |
| 347 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 348 | /* Pseudo functions - handled as macros by parser */ \ |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 349 | F(IS_VAR, 1, 1) \ |
| 350 | \ |
| 351 | /* expose boolean functions from objects-inl.h */ \ |
| 352 | F(HasFastElements, 1, 1) \ |
| 353 | F(HasFastDoubleElements, 1, 1) \ |
| 354 | F(HasDictionaryElements, 1, 1) \ |
| 355 | F(HasExternalPixelElements, 1, 1) \ |
| 356 | F(HasExternalArrayElements, 1, 1) \ |
| 357 | F(HasExternalByteElements, 1, 1) \ |
| 358 | F(HasExternalUnsignedByteElements, 1, 1) \ |
| 359 | F(HasExternalShortElements, 1, 1) \ |
| 360 | F(HasExternalUnsignedShortElements, 1, 1) \ |
| 361 | F(HasExternalIntElements, 1, 1) \ |
| 362 | F(HasExternalUnsignedIntElements, 1, 1) \ |
| 363 | F(HasExternalFloatElements, 1, 1) \ |
whesse@chromium.org | 030d38e | 2011-07-13 13:23:34 +0000 | [diff] [blame] | 364 | F(HasExternalDoubleElements, 1, 1) \ |
| 365 | /* profiler */ \ |
| 366 | F(ProfilerResume, 0, 1) \ |
| 367 | F(ProfilerPause, 0, 1) |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 368 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 369 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 370 | #ifdef ENABLE_DEBUGGER_SUPPORT |
| 371 | #define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ |
| 372 | /* Debugger support*/ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 373 | F(DebugBreak, 0, 1) \ |
| 374 | F(SetDebugEventListener, 2, 1) \ |
| 375 | F(Break, 0, 1) \ |
| 376 | F(DebugGetPropertyDetails, 2, 1) \ |
| 377 | F(DebugGetProperty, 2, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 378 | F(DebugPropertyTypeFromDetails, 1, 1) \ |
| 379 | F(DebugPropertyAttributesFromDetails, 1, 1) \ |
| 380 | F(DebugPropertyIndexFromDetails, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 381 | F(DebugNamedInterceptorPropertyValue, 2, 1) \ |
| 382 | F(DebugIndexedInterceptorElementValue, 2, 1) \ |
| 383 | F(CheckExecutionState, 1, 1) \ |
| 384 | F(GetFrameCount, 1, 1) \ |
| 385 | F(GetFrameDetails, 2, 1) \ |
| 386 | F(GetScopeCount, 2, 1) \ |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 387 | F(GetScopeDetails, 4, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 388 | F(DebugPrintScopes, 0, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 389 | F(GetThreadCount, 1, 1) \ |
| 390 | F(GetThreadDetails, 2, 1) \ |
whesse@chromium.org | e90029b | 2010-08-02 11:52:17 +0000 | [diff] [blame] | 391 | F(SetDisableBreak, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 392 | F(GetBreakLocations, 1, 1) \ |
| 393 | F(SetFunctionBreakPoint, 3, 1) \ |
| 394 | F(SetScriptBreakPoint, 3, 1) \ |
| 395 | F(ClearBreakPoint, 1, 1) \ |
| 396 | F(ChangeBreakOnException, 2, 1) \ |
fschneider@chromium.org | c20610a | 2010-09-22 09:44:58 +0000 | [diff] [blame] | 397 | F(IsBreakOnException, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 398 | F(PrepareStep, 3, 1) \ |
| 399 | F(ClearStepping, 0, 1) \ |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 400 | F(DebugEvaluate, 6, 1) \ |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 401 | F(DebugEvaluateGlobal, 4, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 402 | F(DebugGetLoadedScripts, 0, 1) \ |
| 403 | F(DebugReferencedBy, 3, 1) \ |
| 404 | F(DebugConstructedBy, 2, 1) \ |
| 405 | F(DebugGetPrototype, 1, 1) \ |
| 406 | F(SystemBreak, 0, 1) \ |
| 407 | F(DebugDisassembleFunction, 1, 1) \ |
| 408 | F(DebugDisassembleConstructor, 1, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 409 | F(FunctionGetInferredName, 1, 1) \ |
| 410 | F(LiveEditFindSharedFunctionInfosForScript, 1, 1) \ |
| 411 | F(LiveEditGatherCompileInfo, 2, 1) \ |
| 412 | F(LiveEditReplaceScript, 3, 1) \ |
| 413 | F(LiveEditReplaceFunctionCode, 2, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 414 | F(LiveEditFunctionSourceUpdated, 1, 1) \ |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 415 | F(LiveEditFunctionSetScript, 2, 1) \ |
| 416 | F(LiveEditReplaceRefToNestedFunction, 3, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 417 | F(LiveEditPatchFunctionPositions, 2, 1) \ |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 418 | F(LiveEditCheckAndDropActivations, 2, 1) \ |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 419 | F(LiveEditCompareStrings, 2, 1) \ |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 420 | F(GetFunctionCodePositionFromSource, 2, 1) \ |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 421 | F(ExecuteInDebugContext, 2, 1) \ |
| 422 | \ |
| 423 | F(SetFlags, 1, 1) \ |
| 424 | F(CollectGarbage, 1, 1) \ |
ager@chromium.org | 9ee27ae | 2011-03-02 13:43:26 +0000 | [diff] [blame] | 425 | F(GetHeapUsage, 0, 1) \ |
| 426 | \ |
| 427 | /* LiveObjectList support*/ \ |
| 428 | F(HasLOLEnabled, 0, 1) \ |
| 429 | F(CaptureLOL, 0, 1) \ |
| 430 | F(DeleteLOL, 1, 1) \ |
| 431 | F(DumpLOL, 5, 1) \ |
| 432 | F(GetLOLObj, 1, 1) \ |
| 433 | F(GetLOLObjId, 1, 1) \ |
| 434 | F(GetLOLObjRetainers, 6, 1) \ |
| 435 | F(GetLOLPath, 3, 1) \ |
| 436 | F(InfoLOL, 2, 1) \ |
| 437 | F(PrintLOLObj, 1, 1) \ |
| 438 | F(ResetLOL, 0, 1) \ |
| 439 | F(SummarizeLOL, 3, 1) |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 440 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 441 | #else |
| 442 | #define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) |
| 443 | #endif |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 444 | |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 445 | #ifdef DEBUG |
| 446 | #define RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
| 447 | /* Testing */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 448 | F(ListNatives, 0, 1) |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 449 | #else |
| 450 | #define RUNTIME_FUNCTION_LIST_DEBUG(F) |
| 451 | #endif |
| 452 | |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 453 | // ---------------------------------------------------------------------------- |
| 454 | // RUNTIME_FUNCTION_LIST defines all runtime functions accessed |
| 455 | // either directly by id (via the code generator), or indirectly |
| 456 | // via a native call by name (from within JS code). |
| 457 | |
| 458 | #define RUNTIME_FUNCTION_LIST(F) \ |
ager@chromium.org | ce58e17 | 2009-05-13 07:11:48 +0000 | [diff] [blame] | 459 | RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
| 460 | RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 461 | RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
whesse@chromium.org | 030d38e | 2011-07-13 13:23:34 +0000 | [diff] [blame] | 462 | RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 463 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 464 | // ---------------------------------------------------------------------------- |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 465 | // INLINE_FUNCTION_LIST defines all inlined functions accessed |
| 466 | // with a native call of the form %_name from within JS code. |
| 467 | // Entries have the form F(name, number of arguments, number of return values). |
| 468 | #define INLINE_FUNCTION_LIST(F) \ |
| 469 | F(IsSmi, 1, 1) \ |
| 470 | F(IsNonNegativeSmi, 1, 1) \ |
| 471 | F(IsArray, 1, 1) \ |
| 472 | F(IsRegExp, 1, 1) \ |
| 473 | F(CallFunction, -1 /* receiver + n args + function */, 1) \ |
| 474 | F(ArgumentsLength, 0, 1) \ |
| 475 | F(Arguments, 1, 1) \ |
| 476 | F(ValueOf, 1, 1) \ |
| 477 | F(SetValueOf, 2, 1) \ |
| 478 | F(StringCharFromCode, 1, 1) \ |
| 479 | F(StringCharAt, 2, 1) \ |
| 480 | F(ObjectEquals, 2, 1) \ |
| 481 | F(RandomHeapNumber, 0, 1) \ |
| 482 | F(IsObject, 1, 1) \ |
| 483 | F(IsFunction, 1, 1) \ |
| 484 | F(IsUndetectableObject, 1, 1) \ |
| 485 | F(IsSpecObject, 1, 1) \ |
| 486 | F(IsStringWrapperSafeForDefaultValueOf, 1, 1) \ |
| 487 | F(MathPow, 2, 1) \ |
| 488 | F(MathSin, 1, 1) \ |
| 489 | F(MathCos, 1, 1) \ |
| 490 | F(MathSqrt, 1, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 491 | F(MathLog, 1, 1) \ |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 492 | F(IsRegExpEquivalent, 2, 1) \ |
| 493 | F(HasCachedArrayIndex, 1, 1) \ |
vegorov@chromium.org | 21b5e95 | 2010-11-23 10:24:40 +0000 | [diff] [blame] | 494 | F(GetCachedArrayIndex, 1, 1) \ |
ricow@chromium.org | 4668a2c | 2011-08-29 10:41:00 +0000 | [diff] [blame] | 495 | F(FastAsciiArrayJoin, 2, 1) |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 496 | |
| 497 | |
| 498 | // ---------------------------------------------------------------------------- |
| 499 | // INLINE_AND_RUNTIME_FUNCTION_LIST defines all inlined functions accessed |
| 500 | // with a native call of the form %_name from within JS code that also have |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 501 | // a corresponding runtime function, that is called for slow cases. |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 502 | // Entries have the form F(name, number of arguments, number of return values). |
| 503 | #define INLINE_RUNTIME_FUNCTION_LIST(F) \ |
| 504 | F(IsConstructCall, 0, 1) \ |
| 505 | F(ClassOf, 1, 1) \ |
| 506 | F(StringCharCodeAt, 2, 1) \ |
| 507 | F(Log, 3, 1) \ |
| 508 | F(StringAdd, 2, 1) \ |
| 509 | F(SubString, 3, 1) \ |
| 510 | F(StringCompare, 2, 1) \ |
| 511 | F(RegExpExec, 4, 1) \ |
| 512 | F(RegExpConstructResult, 3, 1) \ |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 513 | F(GetFromCache, 2, 1) \ |
| 514 | F(NumberToString, 1, 1) \ |
| 515 | F(SwapElements, 3, 1) |
| 516 | |
| 517 | |
| 518 | //--------------------------------------------------------------------------- |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 519 | // Runtime provides access to all C++ runtime functions. |
| 520 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 521 | class RuntimeState { |
| 522 | public: |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 523 | StaticResource<StringInputBuffer>* string_input_buffer() { |
| 524 | return &string_input_buffer_; |
| 525 | } |
| 526 | unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { |
| 527 | return &to_upper_mapping_; |
| 528 | } |
| 529 | unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { |
| 530 | return &to_lower_mapping_; |
| 531 | } |
| 532 | StringInputBuffer* string_input_buffer_compare_bufx() { |
| 533 | return &string_input_buffer_compare_bufx_; |
| 534 | } |
| 535 | StringInputBuffer* string_input_buffer_compare_bufy() { |
| 536 | return &string_input_buffer_compare_bufy_; |
| 537 | } |
| 538 | StringInputBuffer* string_locale_compare_buf1() { |
| 539 | return &string_locale_compare_buf1_; |
| 540 | } |
| 541 | StringInputBuffer* string_locale_compare_buf2() { |
| 542 | return &string_locale_compare_buf2_; |
| 543 | } |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 544 | |
| 545 | private: |
| 546 | RuntimeState() {} |
| 547 | // Non-reentrant string buffer for efficient general use in the runtime. |
| 548 | StaticResource<StringInputBuffer> string_input_buffer_; |
| 549 | unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; |
| 550 | unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; |
| 551 | StringInputBuffer string_input_buffer_compare_bufx_; |
| 552 | StringInputBuffer string_input_buffer_compare_bufy_; |
| 553 | StringInputBuffer string_locale_compare_buf1_; |
| 554 | StringInputBuffer string_locale_compare_buf2_; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 555 | |
| 556 | friend class Isolate; |
| 557 | friend class Runtime; |
| 558 | |
| 559 | DISALLOW_COPY_AND_ASSIGN(RuntimeState); |
| 560 | }; |
| 561 | |
| 562 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 563 | class Runtime : public AllStatic { |
| 564 | public: |
| 565 | enum FunctionId { |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 566 | #define F(name, nargs, ressize) k##name, |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 567 | RUNTIME_FUNCTION_LIST(F) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 568 | #undef F |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 569 | #define F(name, nargs, ressize) kInline##name, |
| 570 | INLINE_FUNCTION_LIST(F) |
| 571 | INLINE_RUNTIME_FUNCTION_LIST(F) |
| 572 | #undef F |
| 573 | kNumFunctions, |
| 574 | kFirstInlineFunction = kInlineIsSmi |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 575 | }; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 576 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 577 | enum IntrinsicType { |
| 578 | RUNTIME, |
| 579 | INLINE |
| 580 | }; |
| 581 | |
| 582 | // Intrinsic function descriptor. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 583 | struct Function { |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 584 | FunctionId function_id; |
| 585 | IntrinsicType intrinsic_type; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 586 | // The JS name of the function. |
| 587 | const char* name; |
| 588 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 589 | // The C++ (native) entry point. NULL if the function is inlined. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 590 | byte* entry; |
| 591 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 592 | // The number of arguments expected. nargs is -1 if the function takes |
| 593 | // a variable number of arguments. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 594 | int nargs; |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 595 | // Size of result. Most functions return a single pointer, size 1. |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 596 | int result_size; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 597 | }; |
| 598 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 599 | static const int kNotFound = -1; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 600 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 601 | // Add symbols for all the intrinsic function names to a StringDictionary. |
| 602 | // Returns failure if an allocation fails. In this case, it must be |
| 603 | // retried with a new, empty StringDictionary, not with the same one. |
| 604 | // Alternatively, heap initialization can be completely restarted. |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 605 | MUST_USE_RESULT static MaybeObject* InitializeIntrinsicFunctionNames( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 606 | Heap* heap, Object* dictionary); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 607 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 608 | // Get the intrinsic function with the given name, which must be a symbol. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 609 | static const Function* FunctionForSymbol(Handle<String> name); |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 610 | |
| 611 | // Get the intrinsic function with the given FunctionId. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 612 | static const Function* FunctionForId(FunctionId id); |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 613 | |
| 614 | // General-purpose helper functions for runtime system. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 615 | static int StringMatch(Isolate* isolate, |
| 616 | Handle<String> sub, |
| 617 | Handle<String> pat, |
| 618 | int index); |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 619 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 620 | static bool IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch); |
kasperl@chromium.org | d1e3e72 | 2009-04-14 13:38:25 +0000 | [diff] [blame] | 621 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 622 | // TODO(1240886): The following three methods are *not* handle safe, |
| 623 | // but accept handle arguments. This seems fragile. |
| 624 | |
| 625 | // Support getting the characters in a string using [] notation as |
| 626 | // in Firefox/SpiderMonkey, Safari and Opera. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 627 | MUST_USE_RESULT static MaybeObject* GetElementOrCharAt(Isolate* isolate, |
| 628 | Handle<Object> object, |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 629 | uint32_t index); |
| 630 | MUST_USE_RESULT static MaybeObject* GetElement(Handle<Object> object, |
| 631 | uint32_t index); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 632 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 633 | MUST_USE_RESULT static MaybeObject* SetObjectProperty( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 634 | Isolate* isolate, |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 635 | Handle<Object> object, |
| 636 | Handle<Object> key, |
| 637 | Handle<Object> value, |
ager@chromium.org | 9ee27ae | 2011-03-02 13:43:26 +0000 | [diff] [blame] | 638 | PropertyAttributes attr, |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 639 | StrictModeFlag strict_mode); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 640 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 641 | MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 642 | Isolate* isolate, |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 643 | Handle<JSObject> object, |
| 644 | Handle<Object> key, |
| 645 | Handle<Object> value, |
| 646 | PropertyAttributes attr); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 647 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 648 | MUST_USE_RESULT static MaybeObject* ForceDeleteObjectProperty( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 649 | Isolate* isolate, |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 650 | Handle<JSReceiver> object, |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 651 | Handle<Object> key); |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 652 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 653 | MUST_USE_RESULT static MaybeObject* GetObjectProperty( |
| 654 | Isolate* isolate, |
| 655 | Handle<Object> object, |
| 656 | Handle<Object> key); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 657 | |
kasperl@chromium.org | d1e3e72 | 2009-04-14 13:38:25 +0000 | [diff] [blame] | 658 | // This function is used in FunctionNameUsing* tests. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 659 | static Object* FindSharedFunctionInfoInScript(Isolate* isolate, |
| 660 | Handle<Script> script, |
kasperl@chromium.org | d1e3e72 | 2009-04-14 13:38:25 +0000 | [diff] [blame] | 661 | int position); |
| 662 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 663 | // Helper functions used stubs. |
| 664 | static void PerformGC(Object* result); |
| 665 | }; |
| 666 | |
fschneider@chromium.org | 1805e21 | 2011-09-05 10:49:12 +0000 | [diff] [blame] | 667 | |
| 668 | //--------------------------------------------------------------------------- |
| 669 | // Constants used by interface to runtime functions. |
| 670 | |
| 671 | enum kDeclareGlobalsFlags { |
| 672 | kDeclareGlobalsEvalFlag = 1 << 0, |
| 673 | kDeclareGlobalsStrictModeFlag = 1 << 1, |
| 674 | kDeclareGlobalsNativeFlag = 1 << 2 |
| 675 | }; |
| 676 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 677 | } } // namespace v8::internal |
| 678 | |
| 679 | #endif // V8_RUNTIME_H_ |