yangguo@chromium.org | 5645471 | 2012-02-16 15:33:53 +0000 | [diff] [blame] | 1 | // Copyright 2012 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) \ |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 58 | F(GetLocalPropertyNames, 2, 1) \ |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 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) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 65 | F(FinishArrayPrototypeSetup, 1, 1) \ |
vegorov@chromium.org | f837290 | 2010-03-15 10:26:20 +0000 | [diff] [blame] | 66 | F(SpecialArrayFunctions, 1, 1) \ |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 67 | F(IsClassicModeFunction, 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) \ |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 71 | F(SetPrototype, 2, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 72 | F(IsInPrototypeChain, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 73 | \ |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 74 | F(GetOwnProperty, 2, 1) \ |
| 75 | \ |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 76 | F(IsExtensible, 1, 1) \ |
kmillikin@chromium.org | 69ea396 | 2010-07-05 11:01:40 +0000 | [diff] [blame] | 77 | F(PreventExtensions, 1, 1)\ |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 78 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 79 | /* Utilities */ \ |
fschneider@chromium.org | 1805e21 | 2011-09-05 10:49:12 +0000 | [diff] [blame] | 80 | F(CheckIsBootstrapping, 0, 1) \ |
mstarzinger@chromium.org | 88d326b | 2012-04-23 12:57:22 +0000 | [diff] [blame] | 81 | F(GetRootNaN, 0, 1) \ |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 82 | F(Call, -1 /* >= 2 */, 1) \ |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 83 | F(Apply, 5, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 84 | F(GetFunctionDelegate, 1, 1) \ |
| 85 | F(GetConstructorDelegate, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 86 | F(NewArgumentsFast, 3, 1) \ |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 87 | F(NewStrictArgumentsFast, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 88 | F(LazyCompile, 1, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 89 | F(LazyRecompile, 1, 1) \ |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 90 | F(ParallelRecompile, 1, 1) \ |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 91 | F(InstallRecompiledCode, 1, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 92 | F(NotifyDeoptimized, 1, 1) \ |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 93 | F(NotifyStubFailure, 0, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 94 | F(NotifyOSR, 0, 1) \ |
ager@chromium.org | a9aa5fa | 2011-04-13 08:46:07 +0000 | [diff] [blame] | 95 | F(DeoptimizeFunction, 1, 1) \ |
jkummerow@chromium.org | 212d964 | 2012-05-11 15:02:09 +0000 | [diff] [blame] | 96 | F(ClearFunctionTypeFeedback, 1, 1) \ |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 97 | F(RunningInSimulator, 0, 1) \ |
kmillikin@chromium.org | be6bd10 | 2012-02-23 08:45:21 +0000 | [diff] [blame] | 98 | F(OptimizeFunctionOnNextCall, -1, 1) \ |
ulan@chromium.org | 6e196bf | 2013-03-13 09:38:22 +0000 | [diff] [blame] | 99 | F(WaitUntilOptimized, 1, 1) \ |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 100 | F(GetOptimizationStatus, 1, 1) \ |
| 101 | F(GetOptimizationCount, 1, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 102 | F(CompileForOnStackReplacement, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 103 | F(SetNewFunctionAttributes, 1, 1) \ |
lrn@chromium.org | c4e51ac | 2010-08-09 09:47:21 +0000 | [diff] [blame] | 104 | F(AllocateInNewSpace, 1, 1) \ |
svenpanne@chromium.org | 2bda543 | 2013-03-15 12:39:50 +0000 | [diff] [blame] | 105 | F(AllocateInOldPointerSpace, 1, 1) \ |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 106 | F(SetNativeFlag, 1, 1) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 107 | F(StoreArrayLiteralElement, 5, 1) \ |
mstarzinger@chromium.org | 88d326b | 2012-04-23 12:57:22 +0000 | [diff] [blame] | 108 | F(DebugCallbackSupportsStepping, 1, 1) \ |
| 109 | F(DebugPrepareStepInIfStepping, 1, 1) \ |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 110 | F(FlattenString, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 111 | \ |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 112 | /* Array join support */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 113 | F(PushIfAbsent, 2, 1) \ |
| 114 | F(ArrayConcat, 1, 1) \ |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 115 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 116 | /* Conversions */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 117 | F(ToBool, 1, 1) \ |
| 118 | F(Typeof, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 119 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 120 | F(StringToNumber, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 121 | F(StringParseInt, 2, 1) \ |
| 122 | F(StringParseFloat, 1, 1) \ |
| 123 | F(StringToLowerCase, 1, 1) \ |
| 124 | F(StringToUpperCase, 1, 1) \ |
fschneider@chromium.org | 086aac6 | 2010-03-17 13:18:24 +0000 | [diff] [blame] | 125 | F(StringSplit, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 126 | F(CharFromCode, 1, 1) \ |
| 127 | F(URIEscape, 1, 1) \ |
| 128 | F(URIUnescape, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 129 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 130 | F(NumberToString, 1, 1) \ |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 131 | F(NumberToStringSkipCache, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 132 | F(NumberToInteger, 1, 1) \ |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 133 | F(NumberToPositiveInteger, 1, 1) \ |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 134 | F(NumberToIntegerMapMinusZero, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 135 | F(NumberToJSUint32, 1, 1) \ |
| 136 | F(NumberToJSInt32, 1, 1) \ |
| 137 | F(NumberToSmi, 1, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 138 | F(AllocateHeapNumber, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 139 | \ |
| 140 | /* Arithmetic operations */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 141 | F(NumberAdd, 2, 1) \ |
| 142 | F(NumberSub, 2, 1) \ |
| 143 | F(NumberMul, 2, 1) \ |
| 144 | F(NumberDiv, 2, 1) \ |
| 145 | F(NumberMod, 2, 1) \ |
| 146 | F(NumberUnaryMinus, 1, 1) \ |
ager@chromium.org | 6a2b0aa | 2010-07-13 20:58:03 +0000 | [diff] [blame] | 147 | F(NumberAlloc, 0, 1) \ |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 148 | F(NumberImul, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 149 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 150 | F(StringAdd, 2, 1) \ |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 151 | F(StringBuilderConcat, 3, 1) \ |
kmillikin@chromium.org | 49edbdf | 2011-02-16 12:32:18 +0000 | [diff] [blame] | 152 | F(StringBuilderJoin, 3, 1) \ |
ricow@chromium.org | 27bf288 | 2011-11-17 08:34:43 +0000 | [diff] [blame] | 153 | F(SparseJoinWithSeparator, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 154 | \ |
| 155 | /* Bit operations */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 156 | F(NumberOr, 2, 1) \ |
| 157 | F(NumberAnd, 2, 1) \ |
| 158 | F(NumberXor, 2, 1) \ |
| 159 | F(NumberNot, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 160 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 161 | F(NumberShl, 2, 1) \ |
| 162 | F(NumberShr, 2, 1) \ |
| 163 | F(NumberSar, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 164 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 165 | /* Comparisons */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 166 | F(NumberEquals, 2, 1) \ |
| 167 | F(StringEquals, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 168 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 169 | F(NumberCompare, 3, 1) \ |
| 170 | F(SmiLexicographicCompare, 2, 1) \ |
| 171 | F(StringCompare, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 172 | \ |
| 173 | /* Math */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 174 | F(Math_acos, 1, 1) \ |
| 175 | F(Math_asin, 1, 1) \ |
| 176 | F(Math_atan, 1, 1) \ |
| 177 | F(Math_atan2, 2, 1) \ |
| 178 | F(Math_ceil, 1, 1) \ |
| 179 | F(Math_cos, 1, 1) \ |
| 180 | F(Math_exp, 1, 1) \ |
| 181 | F(Math_floor, 1, 1) \ |
| 182 | F(Math_log, 1, 1) \ |
| 183 | F(Math_pow, 2, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 184 | F(Math_pow_cfunction, 2, 1) \ |
whesse@chromium.org | cec079d | 2010-03-22 14:44:04 +0000 | [diff] [blame] | 185 | F(RoundNumber, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 186 | F(Math_sin, 1, 1) \ |
| 187 | F(Math_sqrt, 1, 1) \ |
| 188 | F(Math_tan, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 189 | \ |
| 190 | /* Regular expressions */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 191 | F(RegExpCompile, 3, 1) \ |
| 192 | F(RegExpExec, 4, 1) \ |
lrn@chromium.org | 25156de | 2010-04-06 13:10:27 +0000 | [diff] [blame] | 193 | F(RegExpExecMultiple, 4, 1) \ |
| 194 | F(RegExpInitializeObject, 5, 1) \ |
whesse@chromium.org | b6e43bb | 2010-04-14 09:36:28 +0000 | [diff] [blame] | 195 | F(RegExpConstructResult, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 196 | \ |
fschneider@chromium.org | e03fb64 | 2010-11-01 12:34:09 +0000 | [diff] [blame] | 197 | /* JSON */ \ |
| 198 | F(ParseJson, 1, 1) \ |
mstarzinger@chromium.org | 32280cf | 2012-12-06 17:32:37 +0000 | [diff] [blame] | 199 | F(BasicJSONStringify, 1, 1) \ |
| 200 | F(QuoteJSONString, 1, 1) \ |
fschneider@chromium.org | e03fb64 | 2010-11-01 12:34:09 +0000 | [diff] [blame] | 201 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 202 | /* Strings */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 203 | F(StringCharCodeAt, 2, 1) \ |
| 204 | F(StringIndexOf, 3, 1) \ |
| 205 | F(StringLastIndexOf, 3, 1) \ |
| 206 | F(StringLocaleCompare, 2, 1) \ |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 207 | F(SubString, 3, 1) \ |
hpayer@chromium.org | 8432c91 | 2013-02-28 15:55:26 +0000 | [diff] [blame] | 208 | F(StringReplaceGlobalRegExpWithString, 4, 1) \ |
ulan@chromium.org | 2efb900 | 2012-01-19 15:36:35 +0000 | [diff] [blame] | 209 | F(StringReplaceOneCharWithString, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 210 | F(StringMatch, 3, 1) \ |
christian.plesner.hansen@gmail.com | 9d58c2b | 2009-10-16 11:48:38 +0000 | [diff] [blame] | 211 | F(StringTrim, 3, 1) \ |
ager@chromium.org | beb2571 | 2010-11-29 08:02:25 +0000 | [diff] [blame] | 212 | F(StringToArray, 2, 1) \ |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame] | 213 | F(NewStringWrapper, 1, 1) \ |
mstarzinger@chromium.org | 32280cf | 2012-12-06 17:32:37 +0000 | [diff] [blame] | 214 | F(NewString, 2, 1) \ |
| 215 | F(TruncateString, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 216 | \ |
| 217 | /* Numbers */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 218 | F(NumberToRadixString, 2, 1) \ |
| 219 | F(NumberToFixed, 2, 1) \ |
| 220 | F(NumberToExponential, 2, 1) \ |
| 221 | F(NumberToPrecision, 2, 1) |
ager@chromium.org | ce58e17 | 2009-05-13 07:11:48 +0000 | [diff] [blame] | 222 | |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 223 | |
ager@chromium.org | ce58e17 | 2009-05-13 07:11:48 +0000 | [diff] [blame] | 224 | #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 225 | /* Reflection */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 226 | F(FunctionSetInstanceClassName, 2, 1) \ |
| 227 | F(FunctionSetLength, 2, 1) \ |
| 228 | F(FunctionSetPrototype, 2, 1) \ |
ricow@chromium.org | 2c99e28 | 2011-07-28 09:15:17 +0000 | [diff] [blame] | 229 | F(FunctionSetReadOnlyPrototype, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 230 | F(FunctionGetName, 1, 1) \ |
| 231 | F(FunctionSetName, 2, 1) \ |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 232 | F(FunctionNameShouldPrintAsAnonymous, 1, 1) \ |
| 233 | F(FunctionMarkNameShouldPrintAsAnonymous, 1, 1) \ |
ulan@chromium.org | 57ff881 | 2013-05-10 08:16:55 +0000 | [diff] [blame^] | 234 | F(FunctionIsGenerator, 1, 1) \ |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 235 | F(FunctionBindArguments, 4, 1) \ |
| 236 | F(BoundFunctionGetBindings, 1, 1) \ |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 237 | F(FunctionRemovePrototype, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 238 | F(FunctionGetSourceCode, 1, 1) \ |
| 239 | F(FunctionGetScript, 1, 1) \ |
| 240 | F(FunctionGetScriptSourcePosition, 1, 1) \ |
| 241 | F(FunctionGetPositionForOffset, 2, 1) \ |
| 242 | F(FunctionIsAPIFunction, 1, 1) \ |
christian.plesner.hansen@gmail.com | 2bc58ef | 2009-09-22 10:00:30 +0000 | [diff] [blame] | 243 | F(FunctionIsBuiltin, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 244 | F(GetScript, 1, 1) \ |
jkummerow@chromium.org | ab7dad4 | 2012-02-07 12:07:34 +0000 | [diff] [blame] | 245 | F(CollectStackTrace, 3, 1) \ |
yangguo@chromium.org | 46a2a51 | 2013-01-18 16:29:40 +0000 | [diff] [blame] | 246 | F(MarkOneShotGetter, 1, 1) \ |
| 247 | F(GetOverflowedStackTrace, 1, 1) \ |
| 248 | F(SetOverflowedStackTrace, 2, 1) \ |
ager@chromium.org | 3811b43 | 2009-10-28 14:53:37 +0000 | [diff] [blame] | 249 | F(GetV8Version, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 250 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 251 | F(ClassOf, 1, 1) \ |
| 252 | F(SetCode, 2, 1) \ |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame] | 253 | F(SetExpectedNumberOfProperties, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 254 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 255 | F(CreateApiFunction, 1, 1) \ |
| 256 | F(IsTemplate, 1, 1) \ |
| 257 | F(GetTemplateField, 2, 1) \ |
| 258 | F(DisableAccessChecks, 1, 1) \ |
| 259 | F(EnableAccessChecks, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 260 | \ |
| 261 | /* Dates */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 262 | F(DateCurrentTime, 0, 1) \ |
| 263 | F(DateParseString, 2, 1) \ |
| 264 | F(DateLocalTimezone, 1, 1) \ |
svenpanne@chromium.org | 4efbdb1 | 2012-03-12 08:18:42 +0000 | [diff] [blame] | 265 | F(DateToUTC, 1, 1) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 266 | F(DateMakeDay, 2, 1) \ |
svenpanne@chromium.org | 4efbdb1 | 2012-03-12 08:18:42 +0000 | [diff] [blame] | 267 | F(DateSetValue, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 268 | \ |
| 269 | /* Numbers */ \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 270 | \ |
| 271 | /* Globals */ \ |
svenpanne@chromium.org | 9faefa4 | 2013-03-08 13:13:16 +0000 | [diff] [blame] | 272 | F(CompileString, 2, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 273 | F(GlobalPrint, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 274 | \ |
| 275 | /* Eval */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 276 | F(GlobalReceiver, 1, 1) \ |
jkummerow@chromium.org | 04e4f1e | 2011-11-14 13:36:17 +0000 | [diff] [blame] | 277 | F(ResolvePossiblyDirectEval, 5, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 278 | \ |
ager@chromium.org | 9ee27ae | 2011-03-02 13:43:26 +0000 | [diff] [blame] | 279 | F(SetProperty, -1 /* 4 or 5 */, 1) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 280 | F(DefineOrRedefineDataProperty, 4, 1) \ |
| 281 | F(DefineOrRedefineAccessorProperty, 5, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 282 | F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */, 1) \ |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 283 | F(GetDataProperty, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 284 | \ |
| 285 | /* Arrays */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 286 | F(RemoveArrayHoles, 2, 1) \ |
| 287 | F(GetArrayKeys, 2, 1) \ |
| 288 | F(MoveArrayContents, 2, 1) \ |
| 289 | F(EstimateNumberOfElements, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 290 | \ |
| 291 | /* Getters and Setters */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 292 | F(LookupAccessor, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 293 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 294 | /* Literals */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 295 | F(MaterializeRegExpLiteral, 4, 1)\ |
vegorov@chromium.org | f837290 | 2010-03-15 10:26:20 +0000 | [diff] [blame] | 296 | F(CreateObjectLiteral, 4, 1) \ |
| 297 | F(CreateObjectLiteralShallow, 4, 1) \ |
kmillikin@chromium.org | 13bd294 | 2009-12-16 15:36:05 +0000 | [diff] [blame] | 298 | F(CreateArrayLiteral, 3, 1) \ |
| 299 | F(CreateArrayLiteralShallow, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 300 | \ |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 301 | /* Harmony generators */ \ |
| 302 | F(CreateJSGeneratorObject, 0, 1) \ |
ulan@chromium.org | 77ca49a | 2013-04-22 09:43:56 +0000 | [diff] [blame] | 303 | F(SuspendJSGeneratorObject, 1, 1) \ |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 304 | F(ResumeJSGeneratorObject, 3, 1) \ |
| 305 | F(ThrowGeneratorStateError, 1, 1) \ |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 306 | \ |
danno@chromium.org | 81cac2b | 2012-07-10 11:28:27 +0000 | [diff] [blame] | 307 | /* Harmony modules */ \ |
| 308 | F(IsJSModule, 1, 1) \ |
| 309 | \ |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 310 | /* Harmony symbols */ \ |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 311 | F(CreateSymbol, 1, 1) \ |
| 312 | F(SymbolName, 1, 1) \ |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 313 | \ |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 314 | /* Harmony proxies */ \ |
| 315 | F(CreateJSProxy, 2, 1) \ |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 316 | F(CreateJSFunctionProxy, 4, 1) \ |
erik.corry@gmail.com | d6076d9 | 2011-06-06 09:39:18 +0000 | [diff] [blame] | 317 | F(IsJSProxy, 1, 1) \ |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 318 | F(IsJSFunctionProxy, 1, 1) \ |
erik.corry@gmail.com | d6076d9 | 2011-06-06 09:39:18 +0000 | [diff] [blame] | 319 | F(GetHandler, 1, 1) \ |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 320 | F(GetCallTrap, 1, 1) \ |
| 321 | F(GetConstructTrap, 1, 1) \ |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 322 | F(Fix, 1, 1) \ |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 323 | \ |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 324 | /* Harmony sets */ \ |
| 325 | F(SetInitialize, 1, 1) \ |
| 326 | F(SetAdd, 2, 1) \ |
| 327 | F(SetHas, 2, 1) \ |
| 328 | F(SetDelete, 2, 1) \ |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 329 | F(SetGetSize, 1, 1) \ |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 330 | \ |
| 331 | /* Harmony maps */ \ |
| 332 | F(MapInitialize, 1, 1) \ |
| 333 | F(MapGet, 2, 1) \ |
jkummerow@chromium.org | 7a6fc81 | 2012-06-27 11:12:38 +0000 | [diff] [blame] | 334 | F(MapHas, 2, 1) \ |
| 335 | F(MapDelete, 2, 1) \ |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 336 | F(MapSet, 3, 1) \ |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 337 | F(MapGetSize, 1, 1) \ |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 338 | \ |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 339 | /* Harmony weakmaps */ \ |
| 340 | F(WeakMapInitialize, 1, 1) \ |
| 341 | F(WeakMapGet, 2, 1) \ |
jkummerow@chromium.org | 7a6fc81 | 2012-06-27 11:12:38 +0000 | [diff] [blame] | 342 | F(WeakMapHas, 2, 1) \ |
| 343 | F(WeakMapDelete, 2, 1) \ |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 344 | F(WeakMapSet, 3, 1) \ |
| 345 | \ |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 346 | /* Harmony observe */ \ |
| 347 | F(IsObserved, 1, 1) \ |
| 348 | F(SetIsObserved, 2, 1) \ |
| 349 | F(SetObserverDeliveryPending, 0, 1) \ |
| 350 | F(GetObservationState, 0, 1) \ |
mmassi@chromium.org | 2f0efde | 2013-02-06 14:12:58 +0000 | [diff] [blame] | 351 | F(ObservationWeakMapCreate, 0, 1) \ |
| 352 | F(UnwrapGlobalProxy, 1, 1) \ |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 353 | \ |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 354 | /* Harmony typed arrays */ \ |
| 355 | F(ArrayBufferInitialize, 2, 1)\ |
| 356 | F(ArrayBufferGetByteLength, 1, 1)\ |
| 357 | F(ArrayBufferSliceImpl, 3, 1) \ |
| 358 | \ |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 359 | F(TypedArrayInitialize, 5, 1) \ |
| 360 | F(TypedArrayGetBuffer, 1, 1) \ |
| 361 | F(TypedArrayGetByteLength, 1, 1) \ |
| 362 | F(TypedArrayGetByteOffset, 1, 1) \ |
| 363 | F(TypedArrayGetLength, 1, 1) \ |
ulan@chromium.org | 57ff881 | 2013-05-10 08:16:55 +0000 | [diff] [blame^] | 364 | F(TypedArraySetFastCases, 3, 1) \ |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 365 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 366 | /* Statements */ \ |
vegorov@chromium.org | 21b5e95 | 2010-11-23 10:24:40 +0000 | [diff] [blame] | 367 | F(NewClosure, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 368 | F(NewObject, 1, 1) \ |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 369 | F(NewObjectFromBound, 1, 1) \ |
whesse@chromium.org | 4a1fe7d | 2010-09-27 12:32:04 +0000 | [diff] [blame] | 370 | F(FinalizeInstanceSize, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 371 | F(Throw, 1, 1) \ |
| 372 | F(ReThrow, 1, 1) \ |
| 373 | F(ThrowReferenceError, 1, 1) \ |
mstarzinger@chromium.org | de88679 | 2012-09-11 13:22:37 +0000 | [diff] [blame] | 374 | F(ThrowNotDateError, 0, 1) \ |
whesse@chromium.org | 4a5224e | 2010-10-20 12:37:07 +0000 | [diff] [blame] | 375 | F(StackGuard, 0, 1) \ |
yangguo@chromium.org | 5645471 | 2012-02-16 15:33:53 +0000 | [diff] [blame] | 376 | F(Interrupt, 0, 1) \ |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 377 | F(PromoteScheduledException, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 378 | \ |
| 379 | /* Contexts */ \ |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 380 | F(NewGlobalContext, 2, 1) \ |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 381 | F(NewFunctionContext, 1, 1) \ |
vegorov@chromium.org | 3cf4731 | 2011-06-29 13:20:01 +0000 | [diff] [blame] | 382 | F(PushWithContext, 2, 1) \ |
| 383 | F(PushCatchContext, 3, 1) \ |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 384 | F(PushBlockContext, 2, 1) \ |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 385 | F(PushModuleContext, 2, 1) \ |
ager@chromium.org | 0ee099b | 2011-01-25 14:06:47 +0000 | [diff] [blame] | 386 | F(DeleteContextSlot, 2, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 387 | F(LoadContextSlot, 2, 2) \ |
| 388 | F(LoadContextSlotNoReferenceError, 2, 2) \ |
ager@chromium.org | 9ee27ae | 2011-03-02 13:43:26 +0000 | [diff] [blame] | 389 | F(StoreContextSlot, 4, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 390 | \ |
| 391 | /* Declarations and initialization */ \ |
fschneider@chromium.org | 1805e21 | 2011-09-05 10:49:12 +0000 | [diff] [blame] | 392 | F(DeclareGlobals, 3, 1) \ |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 393 | F(DeclareModules, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 394 | F(DeclareContextSlot, 4, 1) \ |
ager@chromium.org | 9ee27ae | 2011-03-02 13:43:26 +0000 | [diff] [blame] | 395 | F(InitializeVarGlobal, -1 /* 2 or 3 */, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 396 | F(InitializeConstGlobal, 2, 1) \ |
| 397 | F(InitializeConstContextSlot, 3, 1) \ |
| 398 | F(OptimizeObjectForAddingMultipleProperties, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 399 | \ |
| 400 | /* Debugging */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 401 | F(DebugPrint, 1, 1) \ |
| 402 | F(DebugTrace, 0, 1) \ |
| 403 | F(TraceEnter, 0, 1) \ |
| 404 | F(TraceExit, 1, 1) \ |
| 405 | F(Abort, 2, 1) \ |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 406 | /* Logging */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 407 | F(Log, 2, 1) \ |
christian.plesner.hansen@gmail.com | 2bc58ef | 2009-09-22 10:00:30 +0000 | [diff] [blame] | 408 | /* ES5 */ \ |
| 409 | F(LocalKeys, 1, 1) \ |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 410 | /* Cache suport */ \ |
| 411 | F(GetFromCache, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 412 | \ |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 413 | /* Message objects */ \ |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 414 | F(MessageGetStartPosition, 1, 1) \ |
| 415 | F(MessageGetScript, 1, 1) \ |
| 416 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 417 | /* Pseudo functions - handled as macros by parser */ \ |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 418 | F(IS_VAR, 1, 1) \ |
| 419 | \ |
| 420 | /* expose boolean functions from objects-inl.h */ \ |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 421 | F(HasFastSmiElements, 1, 1) \ |
| 422 | F(HasFastSmiOrObjectElements, 1, 1) \ |
| 423 | F(HasFastObjectElements, 1, 1) \ |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 424 | F(HasFastDoubleElements, 1, 1) \ |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 425 | F(HasFastHoleyElements, 1, 1) \ |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 426 | F(HasDictionaryElements, 1, 1) \ |
| 427 | F(HasExternalPixelElements, 1, 1) \ |
| 428 | F(HasExternalArrayElements, 1, 1) \ |
| 429 | F(HasExternalByteElements, 1, 1) \ |
| 430 | F(HasExternalUnsignedByteElements, 1, 1) \ |
| 431 | F(HasExternalShortElements, 1, 1) \ |
| 432 | F(HasExternalUnsignedShortElements, 1, 1) \ |
| 433 | F(HasExternalIntElements, 1, 1) \ |
| 434 | F(HasExternalUnsignedIntElements, 1, 1) \ |
| 435 | F(HasExternalFloatElements, 1, 1) \ |
whesse@chromium.org | 030d38e | 2011-07-13 13:23:34 +0000 | [diff] [blame] | 436 | F(HasExternalDoubleElements, 1, 1) \ |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 437 | F(HasFastProperties, 1, 1) \ |
danno@chromium.org | 94b0d6f | 2013-02-04 13:33:20 +0000 | [diff] [blame] | 438 | F(TransitionElementsKind, 2, 1) \ |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 439 | F(TransitionElementsSmiToDouble, 1, 1) \ |
| 440 | F(TransitionElementsDoubleToObject, 1, 1) \ |
rossberg@chromium.org | b4b2aa6 | 2011-10-13 09:49:59 +0000 | [diff] [blame] | 441 | F(HaveSameMap, 2, 1) \ |
whesse@chromium.org | 030d38e | 2011-07-13 13:23:34 +0000 | [diff] [blame] | 442 | /* profiler */ \ |
| 443 | F(ProfilerResume, 0, 1) \ |
| 444 | F(ProfilerPause, 0, 1) |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 445 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 446 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 447 | #ifdef ENABLE_DEBUGGER_SUPPORT |
| 448 | #define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ |
| 449 | /* Debugger support*/ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 450 | F(DebugBreak, 0, 1) \ |
| 451 | F(SetDebugEventListener, 2, 1) \ |
| 452 | F(Break, 0, 1) \ |
| 453 | F(DebugGetPropertyDetails, 2, 1) \ |
| 454 | F(DebugGetProperty, 2, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 455 | F(DebugPropertyTypeFromDetails, 1, 1) \ |
| 456 | F(DebugPropertyAttributesFromDetails, 1, 1) \ |
| 457 | F(DebugPropertyIndexFromDetails, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 458 | F(DebugNamedInterceptorPropertyValue, 2, 1) \ |
| 459 | F(DebugIndexedInterceptorElementValue, 2, 1) \ |
| 460 | F(CheckExecutionState, 1, 1) \ |
| 461 | F(GetFrameCount, 1, 1) \ |
| 462 | F(GetFrameDetails, 2, 1) \ |
| 463 | F(GetScopeCount, 2, 1) \ |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 464 | F(GetScopeDetails, 4, 1) \ |
danno@chromium.org | 1044a4d | 2012-04-30 12:34:39 +0000 | [diff] [blame] | 465 | F(GetFunctionScopeCount, 1, 1) \ |
| 466 | F(GetFunctionScopeDetails, 2, 1) \ |
mmassi@chromium.org | 49a4467 | 2012-12-04 13:52:03 +0000 | [diff] [blame] | 467 | F(SetScopeVariableValue, 6, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 468 | F(DebugPrintScopes, 0, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 469 | F(GetThreadCount, 1, 1) \ |
| 470 | F(GetThreadDetails, 2, 1) \ |
whesse@chromium.org | e90029b | 2010-08-02 11:52:17 +0000 | [diff] [blame] | 471 | F(SetDisableBreak, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 472 | F(GetBreakLocations, 1, 1) \ |
| 473 | F(SetFunctionBreakPoint, 3, 1) \ |
| 474 | F(SetScriptBreakPoint, 3, 1) \ |
| 475 | F(ClearBreakPoint, 1, 1) \ |
| 476 | F(ChangeBreakOnException, 2, 1) \ |
fschneider@chromium.org | c20610a | 2010-09-22 09:44:58 +0000 | [diff] [blame] | 477 | F(IsBreakOnException, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 478 | F(PrepareStep, 3, 1) \ |
| 479 | F(ClearStepping, 0, 1) \ |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 480 | F(DebugEvaluate, 6, 1) \ |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 481 | F(DebugEvaluateGlobal, 4, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 482 | F(DebugGetLoadedScripts, 0, 1) \ |
| 483 | F(DebugReferencedBy, 3, 1) \ |
| 484 | F(DebugConstructedBy, 2, 1) \ |
| 485 | F(DebugGetPrototype, 1, 1) \ |
rossberg@chromium.org | 2c067b1 | 2012-03-19 11:01:52 +0000 | [diff] [blame] | 486 | F(DebugSetScriptSource, 2, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 487 | F(SystemBreak, 0, 1) \ |
| 488 | F(DebugDisassembleFunction, 1, 1) \ |
| 489 | F(DebugDisassembleConstructor, 1, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 490 | F(FunctionGetInferredName, 1, 1) \ |
| 491 | F(LiveEditFindSharedFunctionInfosForScript, 1, 1) \ |
| 492 | F(LiveEditGatherCompileInfo, 2, 1) \ |
| 493 | F(LiveEditReplaceScript, 3, 1) \ |
| 494 | F(LiveEditReplaceFunctionCode, 2, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 495 | F(LiveEditFunctionSourceUpdated, 1, 1) \ |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 496 | F(LiveEditFunctionSetScript, 2, 1) \ |
| 497 | F(LiveEditReplaceRefToNestedFunction, 3, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 498 | F(LiveEditPatchFunctionPositions, 2, 1) \ |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 499 | F(LiveEditCheckAndDropActivations, 2, 1) \ |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 500 | F(LiveEditCompareStrings, 2, 1) \ |
yangguo@chromium.org | 5a11aaf | 2012-06-20 11:29:00 +0000 | [diff] [blame] | 501 | F(LiveEditRestartFrame, 2, 1) \ |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 502 | F(GetFunctionCodePositionFromSource, 2, 1) \ |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 503 | F(ExecuteInDebugContext, 2, 1) \ |
| 504 | \ |
| 505 | F(SetFlags, 1, 1) \ |
| 506 | F(CollectGarbage, 1, 1) \ |
ager@chromium.org | 9ee27ae | 2011-03-02 13:43:26 +0000 | [diff] [blame] | 507 | F(GetHeapUsage, 0, 1) \ |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 508 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 509 | #else |
| 510 | #define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) |
| 511 | #endif |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 512 | |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 513 | #ifdef DEBUG |
| 514 | #define RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
| 515 | /* Testing */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 516 | F(ListNatives, 0, 1) |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 517 | #else |
| 518 | #define RUNTIME_FUNCTION_LIST_DEBUG(F) |
| 519 | #endif |
| 520 | |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 521 | // ---------------------------------------------------------------------------- |
| 522 | // RUNTIME_FUNCTION_LIST defines all runtime functions accessed |
| 523 | // either directly by id (via the code generator), or indirectly |
| 524 | // via a native call by name (from within JS code). |
| 525 | |
| 526 | #define RUNTIME_FUNCTION_LIST(F) \ |
ager@chromium.org | ce58e17 | 2009-05-13 07:11:48 +0000 | [diff] [blame] | 527 | RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
| 528 | RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 529 | RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
whesse@chromium.org | 030d38e | 2011-07-13 13:23:34 +0000 | [diff] [blame] | 530 | RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 531 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 532 | // ---------------------------------------------------------------------------- |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 533 | // INLINE_FUNCTION_LIST defines all inlined functions accessed |
| 534 | // with a native call of the form %_name from within JS code. |
| 535 | // Entries have the form F(name, number of arguments, number of return values). |
| 536 | #define INLINE_FUNCTION_LIST(F) \ |
| 537 | F(IsSmi, 1, 1) \ |
| 538 | F(IsNonNegativeSmi, 1, 1) \ |
| 539 | F(IsArray, 1, 1) \ |
| 540 | F(IsRegExp, 1, 1) \ |
rossberg@chromium.org | 2c067b1 | 2012-03-19 11:01:52 +0000 | [diff] [blame] | 541 | F(IsConstructCall, 0, 1) \ |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 542 | F(CallFunction, -1 /* receiver + n args + function */, 1) \ |
| 543 | F(ArgumentsLength, 0, 1) \ |
| 544 | F(Arguments, 1, 1) \ |
| 545 | F(ValueOf, 1, 1) \ |
| 546 | F(SetValueOf, 2, 1) \ |
rossberg@chromium.org | 2c067b1 | 2012-03-19 11:01:52 +0000 | [diff] [blame] | 547 | F(DateField, 2 /* date object, field index */, 1) \ |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 548 | F(StringCharFromCode, 1, 1) \ |
| 549 | F(StringCharAt, 2, 1) \ |
mstarzinger@chromium.org | 32280cf | 2012-12-06 17:32:37 +0000 | [diff] [blame] | 550 | F(OneByteSeqStringSetChar, 3, 1) \ |
| 551 | F(TwoByteSeqStringSetChar, 3, 1) \ |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 552 | F(ObjectEquals, 2, 1) \ |
| 553 | F(RandomHeapNumber, 0, 1) \ |
| 554 | F(IsObject, 1, 1) \ |
| 555 | F(IsFunction, 1, 1) \ |
| 556 | F(IsUndetectableObject, 1, 1) \ |
| 557 | F(IsSpecObject, 1, 1) \ |
| 558 | F(IsStringWrapperSafeForDefaultValueOf, 1, 1) \ |
| 559 | F(MathPow, 2, 1) \ |
| 560 | F(MathSin, 1, 1) \ |
| 561 | F(MathCos, 1, 1) \ |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 562 | F(MathTan, 1, 1) \ |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 563 | F(MathSqrt, 1, 1) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 564 | F(MathLog, 1, 1) \ |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 565 | F(IsRegExpEquivalent, 2, 1) \ |
| 566 | F(HasCachedArrayIndex, 1, 1) \ |
vegorov@chromium.org | 21b5e95 | 2010-11-23 10:24:40 +0000 | [diff] [blame] | 567 | F(GetCachedArrayIndex, 1, 1) \ |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 568 | F(FastAsciiArrayJoin, 2, 1) \ |
| 569 | F(GeneratorSend, 2, 1) \ |
| 570 | F(GeneratorThrow, 2, 1) |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 571 | |
| 572 | |
| 573 | // ---------------------------------------------------------------------------- |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 574 | // INLINE_RUNTIME_FUNCTION_LIST defines all inlined functions accessed |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 575 | // 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] | 576 | // a corresponding runtime function, that is called for slow cases. |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 577 | // Entries have the form F(name, number of arguments, number of return values). |
| 578 | #define INLINE_RUNTIME_FUNCTION_LIST(F) \ |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 579 | F(ClassOf, 1, 1) \ |
| 580 | F(StringCharCodeAt, 2, 1) \ |
| 581 | F(Log, 3, 1) \ |
| 582 | F(StringAdd, 2, 1) \ |
| 583 | F(SubString, 3, 1) \ |
| 584 | F(StringCompare, 2, 1) \ |
| 585 | F(RegExpExec, 4, 1) \ |
| 586 | F(RegExpConstructResult, 3, 1) \ |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 587 | F(GetFromCache, 2, 1) \ |
ulan@chromium.org | d6899c3 | 2012-05-18 14:12:25 +0000 | [diff] [blame] | 588 | F(NumberToString, 1, 1) |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 589 | |
| 590 | |
| 591 | //--------------------------------------------------------------------------- |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 592 | // Runtime provides access to all C++ runtime functions. |
| 593 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 594 | class RuntimeState { |
| 595 | public: |
yangguo@chromium.org | 4cd70b4 | 2013-01-04 08:57:54 +0000 | [diff] [blame] | 596 | StaticResource<ConsStringIteratorOp>* string_iterator() { |
| 597 | return &string_iterator_; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 598 | } |
| 599 | unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { |
| 600 | return &to_upper_mapping_; |
| 601 | } |
| 602 | unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { |
| 603 | return &to_lower_mapping_; |
| 604 | } |
yangguo@chromium.org | 4cd70b4 | 2013-01-04 08:57:54 +0000 | [diff] [blame] | 605 | ConsStringIteratorOp* string_iterator_compare_x() { |
| 606 | return &string_iterator_compare_x_; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 607 | } |
yangguo@chromium.org | 4cd70b4 | 2013-01-04 08:57:54 +0000 | [diff] [blame] | 608 | ConsStringIteratorOp* string_iterator_compare_y() { |
| 609 | return &string_iterator_compare_y_; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 610 | } |
yangguo@chromium.org | 4cd70b4 | 2013-01-04 08:57:54 +0000 | [diff] [blame] | 611 | ConsStringIteratorOp* string_locale_compare_it1() { |
| 612 | return &string_locale_compare_it1_; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 613 | } |
yangguo@chromium.org | 4cd70b4 | 2013-01-04 08:57:54 +0000 | [diff] [blame] | 614 | ConsStringIteratorOp* string_locale_compare_it2() { |
| 615 | return &string_locale_compare_it2_; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 616 | } |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 617 | |
| 618 | private: |
| 619 | RuntimeState() {} |
| 620 | // Non-reentrant string buffer for efficient general use in the runtime. |
yangguo@chromium.org | 4cd70b4 | 2013-01-04 08:57:54 +0000 | [diff] [blame] | 621 | StaticResource<ConsStringIteratorOp> string_iterator_; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 622 | unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; |
| 623 | unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; |
yangguo@chromium.org | 4cd70b4 | 2013-01-04 08:57:54 +0000 | [diff] [blame] | 624 | ConsStringIteratorOp string_iterator_compare_x_; |
| 625 | ConsStringIteratorOp string_iterator_compare_y_; |
| 626 | ConsStringIteratorOp string_locale_compare_it1_; |
| 627 | ConsStringIteratorOp string_locale_compare_it2_; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 628 | |
| 629 | friend class Isolate; |
| 630 | friend class Runtime; |
| 631 | |
| 632 | DISALLOW_COPY_AND_ASSIGN(RuntimeState); |
| 633 | }; |
| 634 | |
| 635 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 636 | class Runtime : public AllStatic { |
| 637 | public: |
| 638 | enum FunctionId { |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 639 | #define F(name, nargs, ressize) k##name, |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 640 | RUNTIME_FUNCTION_LIST(F) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 641 | #undef F |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 642 | #define F(name, nargs, ressize) kInline##name, |
| 643 | INLINE_FUNCTION_LIST(F) |
| 644 | INLINE_RUNTIME_FUNCTION_LIST(F) |
| 645 | #undef F |
| 646 | kNumFunctions, |
| 647 | kFirstInlineFunction = kInlineIsSmi |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 648 | }; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 649 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 650 | enum IntrinsicType { |
| 651 | RUNTIME, |
| 652 | INLINE |
| 653 | }; |
| 654 | |
| 655 | // Intrinsic function descriptor. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 656 | struct Function { |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 657 | FunctionId function_id; |
| 658 | IntrinsicType intrinsic_type; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 659 | // The JS name of the function. |
| 660 | const char* name; |
| 661 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 662 | // The C++ (native) entry point. NULL if the function is inlined. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 663 | byte* entry; |
| 664 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 665 | // The number of arguments expected. nargs is -1 if the function takes |
| 666 | // a variable number of arguments. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 667 | int nargs; |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 668 | // Size of result. Most functions return a single pointer, size 1. |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 669 | int result_size; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 670 | }; |
| 671 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 672 | static const int kNotFound = -1; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 673 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 674 | // Add internalized strings for all the intrinsic function names to a |
| 675 | // StringDictionary. |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 676 | // Returns failure if an allocation fails. In this case, it must be |
| 677 | // retried with a new, empty StringDictionary, not with the same one. |
| 678 | // Alternatively, heap initialization can be completely restarted. |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 679 | MUST_USE_RESULT static MaybeObject* InitializeIntrinsicFunctionNames( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 680 | Heap* heap, Object* dictionary); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 681 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 682 | // Get the intrinsic function with the given name, which must be internalized. |
| 683 | static const Function* FunctionForName(Handle<String> name); |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 684 | |
| 685 | // Get the intrinsic function with the given FunctionId. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 686 | static const Function* FunctionForId(FunctionId id); |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 687 | |
| 688 | // General-purpose helper functions for runtime system. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 689 | static int StringMatch(Isolate* isolate, |
| 690 | Handle<String> sub, |
| 691 | Handle<String> pat, |
| 692 | int index); |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 693 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 694 | static bool IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch); |
kasperl@chromium.org | d1e3e72 | 2009-04-14 13:38:25 +0000 | [diff] [blame] | 695 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 696 | // TODO(1240886): Some of the following methods are *not* handle safe, but |
| 697 | // accept handle arguments. This seems fragile. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 698 | |
| 699 | // Support getting the characters in a string using [] notation as |
| 700 | // in Firefox/SpiderMonkey, Safari and Opera. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 701 | MUST_USE_RESULT static MaybeObject* GetElementOrCharAt(Isolate* isolate, |
| 702 | Handle<Object> object, |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 703 | uint32_t index); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 704 | |
ulan@chromium.org | 77ca49a | 2013-04-22 09:43:56 +0000 | [diff] [blame] | 705 | MUST_USE_RESULT static MaybeObject* GetElementOrCharAtOrFail( |
| 706 | Isolate* isolate, |
| 707 | Handle<Object> object, |
| 708 | uint32_t index); |
| 709 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 710 | MUST_USE_RESULT static MaybeObject* SetObjectProperty( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 711 | Isolate* isolate, |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 712 | Handle<Object> object, |
| 713 | Handle<Object> key, |
| 714 | Handle<Object> value, |
ager@chromium.org | 9ee27ae | 2011-03-02 13:43:26 +0000 | [diff] [blame] | 715 | PropertyAttributes attr, |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 716 | StrictModeFlag strict_mode); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 717 | |
mstarzinger@chromium.org | b228be0 | 2013-04-18 14:56:59 +0000 | [diff] [blame] | 718 | MUST_USE_RESULT static MaybeObject* SetObjectPropertyOrFail( |
| 719 | Isolate* isolate, |
| 720 | Handle<Object> object, |
| 721 | Handle<Object> key, |
| 722 | Handle<Object> value, |
| 723 | PropertyAttributes attr, |
| 724 | StrictModeFlag strict_mode); |
| 725 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 726 | MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 727 | Isolate* isolate, |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 728 | Handle<JSObject> object, |
| 729 | Handle<Object> key, |
| 730 | Handle<Object> value, |
| 731 | PropertyAttributes attr); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 732 | |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 733 | MUST_USE_RESULT static MaybeObject* DeleteObjectProperty( |
| 734 | Isolate* isolate, |
| 735 | Handle<JSReceiver> object, |
| 736 | Handle<Object> key, |
| 737 | JSReceiver::DeleteMode mode); |
| 738 | |
| 739 | MUST_USE_RESULT static MaybeObject* HasObjectProperty( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 740 | Isolate* isolate, |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 741 | Handle<JSReceiver> object, |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 742 | Handle<Object> key); |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 743 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 744 | MUST_USE_RESULT static MaybeObject* GetObjectProperty( |
| 745 | Isolate* isolate, |
| 746 | Handle<Object> object, |
| 747 | Handle<Object> key); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 748 | |
mstarzinger@chromium.org | b228be0 | 2013-04-18 14:56:59 +0000 | [diff] [blame] | 749 | MUST_USE_RESULT static MaybeObject* GetObjectPropertyOrFail( |
| 750 | Isolate* isolate, |
| 751 | Handle<Object> object, |
| 752 | Handle<Object> key); |
| 753 | |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 754 | static bool SetupArrayBuffer(Isolate* isolate, |
| 755 | Handle<JSArrayBuffer> array_buffer, |
| 756 | void* data, |
| 757 | size_t allocated_length); |
| 758 | |
| 759 | static bool SetupArrayBufferAllocatingData( |
| 760 | Isolate* isolate, |
| 761 | Handle<JSArrayBuffer> array_buffer, |
| 762 | size_t allocated_length); |
| 763 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 764 | // Helper functions used stubs. |
| 765 | static void PerformGC(Object* result); |
ricow@chromium.org | 7ad6522 | 2011-12-19 12:13:11 +0000 | [diff] [blame] | 766 | |
| 767 | // Used in runtime.cc and hydrogen's VisitArrayLiteral. |
| 768 | static Handle<Object> CreateArrayLiteralBoilerplate( |
| 769 | Isolate* isolate, |
| 770 | Handle<FixedArray> literals, |
| 771 | Handle<FixedArray> elements); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 772 | }; |
| 773 | |
fschneider@chromium.org | 1805e21 | 2011-09-05 10:49:12 +0000 | [diff] [blame] | 774 | |
| 775 | //--------------------------------------------------------------------------- |
| 776 | // Constants used by interface to runtime functions. |
| 777 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 778 | class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; |
| 779 | class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; |
| 780 | class DeclareGlobalsLanguageMode: public BitField<LanguageMode, 2, 2> {}; |
fschneider@chromium.org | 1805e21 | 2011-09-05 10:49:12 +0000 | [diff] [blame] | 781 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 782 | } } // namespace v8::internal |
| 783 | |
| 784 | #endif // V8_RUNTIME_H_ |