erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 1 | // Copyright 2010 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 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 31 | namespace v8 { |
| 32 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 33 | |
| 34 | // The interface to C++ runtime functions. |
| 35 | |
| 36 | // ---------------------------------------------------------------------------- |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 37 | // RUNTIME_FUNCTION_LIST_ALWAYS defines runtime calls available in both |
| 38 | // release and debug mode. |
| 39 | // 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] | 40 | |
ager@chromium.org | ce58e17 | 2009-05-13 07:11:48 +0000 | [diff] [blame] | 41 | // WARNING: RUNTIME_FUNCTION_LIST_ALWAYS_* is a very large macro that caused |
| 42 | // MSVC Intellisense to crash. It was broken into two macros to work around |
| 43 | // this problem. Please avoid large recursive macros whenever possible. |
| 44 | #define RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 45 | /* Property access */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 46 | F(GetProperty, 2, 1) \ |
| 47 | F(KeyedGetProperty, 2, 1) \ |
| 48 | F(DeleteProperty, 2, 1) \ |
| 49 | F(HasLocalProperty, 2, 1) \ |
| 50 | F(HasProperty, 2, 1) \ |
| 51 | F(HasElement, 2, 1) \ |
| 52 | F(IsPropertyEnumerable, 2, 1) \ |
| 53 | F(GetPropertyNames, 1, 1) \ |
| 54 | F(GetPropertyNamesFast, 1, 1) \ |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 55 | F(GetLocalPropertyNames, 1, 1) \ |
| 56 | F(GetLocalElementNames, 1, 1) \ |
| 57 | F(GetInterceptorInfo, 1, 1) \ |
| 58 | F(GetNamedInterceptorPropertyNames, 1, 1) \ |
| 59 | F(GetIndexedInterceptorElementNames, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 60 | F(GetArgumentsProperty, 1, 1) \ |
| 61 | F(ToFastProperties, 1, 1) \ |
| 62 | F(ToSlowProperties, 1, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 63 | F(FinishArrayPrototypeSetup, 1, 1) \ |
vegorov@chromium.org | f837290 | 2010-03-15 10:26:20 +0000 | [diff] [blame] | 64 | F(SpecialArrayFunctions, 1, 1) \ |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 65 | F(GetGlobalReceiver, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 66 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 67 | F(IsInPrototypeChain, 2, 1) \ |
| 68 | F(SetHiddenPrototype, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 69 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 70 | F(IsConstructCall, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 71 | \ |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 72 | F(GetOwnProperty, 2, 1) \ |
| 73 | \ |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 74 | F(IsExtensible, 1, 1) \ |
kmillikin@chromium.org | 69ea396 | 2010-07-05 11:01:40 +0000 | [diff] [blame] | 75 | F(PreventExtensions, 1, 1)\ |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 76 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 77 | /* Utilities */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 78 | F(GetFunctionDelegate, 1, 1) \ |
| 79 | F(GetConstructorDelegate, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 80 | F(NewArgumentsFast, 3, 1) \ |
| 81 | F(LazyCompile, 1, 1) \ |
| 82 | F(SetNewFunctionAttributes, 1, 1) \ |
lrn@chromium.org | c4e51ac | 2010-08-09 09:47:21 +0000 | [diff] [blame] | 83 | F(AllocateInNewSpace, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 84 | \ |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 85 | /* Array join support */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 86 | F(PushIfAbsent, 2, 1) \ |
| 87 | F(ArrayConcat, 1, 1) \ |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 88 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 89 | /* Conversions */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 90 | F(ToBool, 1, 1) \ |
| 91 | F(Typeof, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 92 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 93 | F(StringToNumber, 1, 1) \ |
| 94 | F(StringFromCharCodeArray, 1, 1) \ |
| 95 | F(StringParseInt, 2, 1) \ |
| 96 | F(StringParseFloat, 1, 1) \ |
| 97 | F(StringToLowerCase, 1, 1) \ |
| 98 | F(StringToUpperCase, 1, 1) \ |
fschneider@chromium.org | 086aac6 | 2010-03-17 13:18:24 +0000 | [diff] [blame] | 99 | F(StringSplit, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 100 | F(CharFromCode, 1, 1) \ |
| 101 | F(URIEscape, 1, 1) \ |
| 102 | F(URIUnescape, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 103 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 104 | F(NumberToString, 1, 1) \ |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 105 | F(NumberToStringSkipCache, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 106 | F(NumberToInteger, 1, 1) \ |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 107 | F(NumberToIntegerMapMinusZero, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 108 | F(NumberToJSUint32, 1, 1) \ |
| 109 | F(NumberToJSInt32, 1, 1) \ |
| 110 | F(NumberToSmi, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 111 | \ |
| 112 | /* Arithmetic operations */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 113 | F(NumberAdd, 2, 1) \ |
| 114 | F(NumberSub, 2, 1) \ |
| 115 | F(NumberMul, 2, 1) \ |
| 116 | F(NumberDiv, 2, 1) \ |
| 117 | F(NumberMod, 2, 1) \ |
| 118 | F(NumberUnaryMinus, 1, 1) \ |
ager@chromium.org | 6a2b0aa | 2010-07-13 20:58:03 +0000 | [diff] [blame] | 119 | F(NumberAlloc, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 120 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 121 | F(StringAdd, 2, 1) \ |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 122 | F(StringBuilderConcat, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 123 | \ |
| 124 | /* Bit operations */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 125 | F(NumberOr, 2, 1) \ |
| 126 | F(NumberAnd, 2, 1) \ |
| 127 | F(NumberXor, 2, 1) \ |
| 128 | F(NumberNot, 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(NumberShl, 2, 1) \ |
| 131 | F(NumberShr, 2, 1) \ |
| 132 | F(NumberSar, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 133 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 134 | /* Comparisons */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 135 | F(NumberEquals, 2, 1) \ |
| 136 | F(StringEquals, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 137 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 138 | F(NumberCompare, 3, 1) \ |
| 139 | F(SmiLexicographicCompare, 2, 1) \ |
| 140 | F(StringCompare, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 141 | \ |
| 142 | /* Math */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 143 | F(Math_acos, 1, 1) \ |
| 144 | F(Math_asin, 1, 1) \ |
| 145 | F(Math_atan, 1, 1) \ |
| 146 | F(Math_atan2, 2, 1) \ |
| 147 | F(Math_ceil, 1, 1) \ |
| 148 | F(Math_cos, 1, 1) \ |
| 149 | F(Math_exp, 1, 1) \ |
| 150 | F(Math_floor, 1, 1) \ |
| 151 | F(Math_log, 1, 1) \ |
| 152 | F(Math_pow, 2, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 153 | F(Math_pow_cfunction, 2, 1) \ |
whesse@chromium.org | cec079d | 2010-03-22 14:44:04 +0000 | [diff] [blame] | 154 | F(RoundNumber, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 155 | F(Math_sin, 1, 1) \ |
| 156 | F(Math_sqrt, 1, 1) \ |
| 157 | F(Math_tan, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 158 | \ |
| 159 | /* Regular expressions */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 160 | F(RegExpCompile, 3, 1) \ |
| 161 | F(RegExpExec, 4, 1) \ |
lrn@chromium.org | 25156de | 2010-04-06 13:10:27 +0000 | [diff] [blame] | 162 | F(RegExpExecMultiple, 4, 1) \ |
| 163 | F(RegExpInitializeObject, 5, 1) \ |
whesse@chromium.org | b6e43bb | 2010-04-14 09:36:28 +0000 | [diff] [blame] | 164 | F(RegExpConstructResult, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 165 | \ |
fschneider@chromium.org | e03fb64 | 2010-11-01 12:34:09 +0000 | [diff] [blame] | 166 | /* JSON */ \ |
| 167 | F(ParseJson, 1, 1) \ |
| 168 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 169 | /* Strings */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 170 | F(StringCharCodeAt, 2, 1) \ |
| 171 | F(StringIndexOf, 3, 1) \ |
| 172 | F(StringLastIndexOf, 3, 1) \ |
| 173 | F(StringLocaleCompare, 2, 1) \ |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 174 | F(SubString, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 175 | F(StringReplaceRegExpWithString, 4, 1) \ |
| 176 | F(StringMatch, 3, 1) \ |
christian.plesner.hansen@gmail.com | 9d58c2b | 2009-10-16 11:48:38 +0000 | [diff] [blame] | 177 | F(StringTrim, 3, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 178 | F(StringToArray, 1, 1) \ |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame] | 179 | F(NewStringWrapper, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 180 | \ |
| 181 | /* Numbers */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 182 | F(NumberToRadixString, 2, 1) \ |
| 183 | F(NumberToFixed, 2, 1) \ |
| 184 | F(NumberToExponential, 2, 1) \ |
| 185 | F(NumberToPrecision, 2, 1) |
ager@chromium.org | ce58e17 | 2009-05-13 07:11:48 +0000 | [diff] [blame] | 186 | |
| 187 | #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 188 | /* Reflection */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 189 | F(FunctionSetInstanceClassName, 2, 1) \ |
| 190 | F(FunctionSetLength, 2, 1) \ |
| 191 | F(FunctionSetPrototype, 2, 1) \ |
| 192 | F(FunctionGetName, 1, 1) \ |
| 193 | F(FunctionSetName, 2, 1) \ |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 194 | F(FunctionRemovePrototype, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 195 | F(FunctionGetSourceCode, 1, 1) \ |
| 196 | F(FunctionGetScript, 1, 1) \ |
| 197 | F(FunctionGetScriptSourcePosition, 1, 1) \ |
| 198 | F(FunctionGetPositionForOffset, 2, 1) \ |
| 199 | F(FunctionIsAPIFunction, 1, 1) \ |
christian.plesner.hansen@gmail.com | 2bc58ef | 2009-09-22 10:00:30 +0000 | [diff] [blame] | 200 | F(FunctionIsBuiltin, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 201 | F(GetScript, 1, 1) \ |
| 202 | F(CollectStackTrace, 2, 1) \ |
ager@chromium.org | 3811b43 | 2009-10-28 14:53:37 +0000 | [diff] [blame] | 203 | F(GetV8Version, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 204 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 205 | F(ClassOf, 1, 1) \ |
| 206 | F(SetCode, 2, 1) \ |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame] | 207 | F(SetExpectedNumberOfProperties, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 208 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 209 | F(CreateApiFunction, 1, 1) \ |
| 210 | F(IsTemplate, 1, 1) \ |
| 211 | F(GetTemplateField, 2, 1) \ |
| 212 | F(DisableAccessChecks, 1, 1) \ |
| 213 | F(EnableAccessChecks, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 214 | \ |
| 215 | /* Dates */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 216 | F(DateCurrentTime, 0, 1) \ |
| 217 | F(DateParseString, 2, 1) \ |
| 218 | F(DateLocalTimezone, 1, 1) \ |
| 219 | F(DateLocalTimeOffset, 0, 1) \ |
| 220 | F(DateDaylightSavingsOffset, 1, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 221 | F(DateMakeDay, 3, 1) \ |
vegorov@chromium.org | f837290 | 2010-03-15 10:26:20 +0000 | [diff] [blame] | 222 | F(DateYMDFromTime, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 223 | \ |
| 224 | /* Numbers */ \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 225 | \ |
| 226 | /* Globals */ \ |
fschneider@chromium.org | e03fb64 | 2010-11-01 12:34:09 +0000 | [diff] [blame] | 227 | F(CompileString, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 228 | F(GlobalPrint, 1, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 229 | \ |
| 230 | /* Eval */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 231 | F(GlobalReceiver, 1, 1) \ |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 232 | F(ResolvePossiblyDirectEval, 3, 2) \ |
lrn@chromium.org | 1af7e1b | 2010-06-07 11:12:01 +0000 | [diff] [blame] | 233 | F(ResolvePossiblyDirectEvalNoLookup, 3, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 234 | \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 235 | F(SetProperty, -1 /* 3 or 4 */, 1) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 236 | F(DefineOrRedefineDataProperty, 4, 1) \ |
| 237 | F(DefineOrRedefineAccessorProperty, 5, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 238 | F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 239 | \ |
| 240 | /* Arrays */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 241 | F(RemoveArrayHoles, 2, 1) \ |
| 242 | F(GetArrayKeys, 2, 1) \ |
| 243 | F(MoveArrayContents, 2, 1) \ |
| 244 | F(EstimateNumberOfElements, 1, 1) \ |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 245 | F(SwapElements, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 246 | \ |
| 247 | /* Getters and Setters */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 248 | F(DefineAccessor, -1 /* 4 or 5 */, 1) \ |
| 249 | F(LookupAccessor, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 250 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 251 | /* Literals */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 252 | F(MaterializeRegExpLiteral, 4, 1)\ |
| 253 | F(CreateArrayLiteralBoilerplate, 3, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 254 | F(CloneLiteralBoilerplate, 1, 1) \ |
| 255 | F(CloneShallowLiteralBoilerplate, 1, 1) \ |
vegorov@chromium.org | f837290 | 2010-03-15 10:26:20 +0000 | [diff] [blame] | 256 | F(CreateObjectLiteral, 4, 1) \ |
| 257 | F(CreateObjectLiteralShallow, 4, 1) \ |
kmillikin@chromium.org | 13bd294 | 2009-12-16 15:36:05 +0000 | [diff] [blame] | 258 | F(CreateArrayLiteral, 3, 1) \ |
| 259 | F(CreateArrayLiteralShallow, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 260 | \ |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 261 | /* Catch context extension objects */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 262 | F(CreateCatchExtensionObject, 2, 1) \ |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 263 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 264 | /* Statements */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 265 | F(NewClosure, 2, 1) \ |
| 266 | F(NewObject, 1, 1) \ |
whesse@chromium.org | ba5a61b | 2010-07-26 11:44:40 +0000 | [diff] [blame] | 267 | F(NewObjectFromBound, 2, 1) \ |
whesse@chromium.org | 4a1fe7d | 2010-09-27 12:32:04 +0000 | [diff] [blame] | 268 | F(FinalizeInstanceSize, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 269 | F(Throw, 1, 1) \ |
| 270 | F(ReThrow, 1, 1) \ |
| 271 | F(ThrowReferenceError, 1, 1) \ |
whesse@chromium.org | 4a5224e | 2010-10-20 12:37:07 +0000 | [diff] [blame] | 272 | F(StackGuard, 0, 1) \ |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 273 | F(PromoteScheduledException, 0, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 274 | \ |
| 275 | /* Contexts */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 276 | F(NewContext, 1, 1) \ |
| 277 | F(PushContext, 1, 1) \ |
| 278 | F(PushCatchContext, 1, 1) \ |
| 279 | F(LookupContext, 2, 1) \ |
| 280 | F(LoadContextSlot, 2, 2) \ |
| 281 | F(LoadContextSlotNoReferenceError, 2, 2) \ |
| 282 | F(StoreContextSlot, 3, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 283 | \ |
| 284 | /* Declarations and initialization */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 285 | F(DeclareGlobals, 3, 1) \ |
| 286 | F(DeclareContextSlot, 4, 1) \ |
| 287 | F(InitializeVarGlobal, -1 /* 1 or 2 */, 1) \ |
| 288 | F(InitializeConstGlobal, 2, 1) \ |
| 289 | F(InitializeConstContextSlot, 3, 1) \ |
| 290 | F(OptimizeObjectForAddingMultipleProperties, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 291 | \ |
| 292 | /* Debugging */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 293 | F(DebugPrint, 1, 1) \ |
| 294 | F(DebugTrace, 0, 1) \ |
| 295 | F(TraceEnter, 0, 1) \ |
| 296 | F(TraceExit, 1, 1) \ |
| 297 | F(Abort, 2, 1) \ |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 298 | /* Logging */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 299 | F(Log, 2, 1) \ |
christian.plesner.hansen@gmail.com | 2bc58ef | 2009-09-22 10:00:30 +0000 | [diff] [blame] | 300 | /* ES5 */ \ |
| 301 | F(LocalKeys, 1, 1) \ |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 302 | /* Cache suport */ \ |
| 303 | F(GetFromCache, 2, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 304 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 305 | /* Pseudo functions - handled as macros by parser */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 306 | F(IS_VAR, 1, 1) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 307 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 308 | #ifdef ENABLE_DEBUGGER_SUPPORT |
| 309 | #define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ |
| 310 | /* Debugger support*/ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 311 | F(DebugBreak, 0, 1) \ |
| 312 | F(SetDebugEventListener, 2, 1) \ |
| 313 | F(Break, 0, 1) \ |
| 314 | F(DebugGetPropertyDetails, 2, 1) \ |
| 315 | F(DebugGetProperty, 2, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 316 | F(DebugPropertyTypeFromDetails, 1, 1) \ |
| 317 | F(DebugPropertyAttributesFromDetails, 1, 1) \ |
| 318 | F(DebugPropertyIndexFromDetails, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 319 | F(DebugNamedInterceptorPropertyValue, 2, 1) \ |
| 320 | F(DebugIndexedInterceptorElementValue, 2, 1) \ |
| 321 | F(CheckExecutionState, 1, 1) \ |
| 322 | F(GetFrameCount, 1, 1) \ |
| 323 | F(GetFrameDetails, 2, 1) \ |
| 324 | F(GetScopeCount, 2, 1) \ |
| 325 | F(GetScopeDetails, 3, 1) \ |
| 326 | F(DebugPrintScopes, 0, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 327 | F(GetThreadCount, 1, 1) \ |
| 328 | F(GetThreadDetails, 2, 1) \ |
whesse@chromium.org | e90029b | 2010-08-02 11:52:17 +0000 | [diff] [blame] | 329 | F(SetDisableBreak, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 330 | F(GetBreakLocations, 1, 1) \ |
| 331 | F(SetFunctionBreakPoint, 3, 1) \ |
| 332 | F(SetScriptBreakPoint, 3, 1) \ |
| 333 | F(ClearBreakPoint, 1, 1) \ |
| 334 | F(ChangeBreakOnException, 2, 1) \ |
fschneider@chromium.org | c20610a | 2010-09-22 09:44:58 +0000 | [diff] [blame] | 335 | F(IsBreakOnException, 1, 1) \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 336 | F(PrepareStep, 3, 1) \ |
| 337 | F(ClearStepping, 0, 1) \ |
| 338 | F(DebugEvaluate, 4, 1) \ |
| 339 | F(DebugEvaluateGlobal, 3, 1) \ |
| 340 | F(DebugGetLoadedScripts, 0, 1) \ |
| 341 | F(DebugReferencedBy, 3, 1) \ |
| 342 | F(DebugConstructedBy, 2, 1) \ |
| 343 | F(DebugGetPrototype, 1, 1) \ |
| 344 | F(SystemBreak, 0, 1) \ |
| 345 | F(DebugDisassembleFunction, 1, 1) \ |
| 346 | F(DebugDisassembleConstructor, 1, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 347 | F(FunctionGetInferredName, 1, 1) \ |
| 348 | F(LiveEditFindSharedFunctionInfosForScript, 1, 1) \ |
| 349 | F(LiveEditGatherCompileInfo, 2, 1) \ |
| 350 | F(LiveEditReplaceScript, 3, 1) \ |
| 351 | F(LiveEditReplaceFunctionCode, 2, 1) \ |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 352 | F(LiveEditFunctionSetScript, 2, 1) \ |
| 353 | F(LiveEditReplaceRefToNestedFunction, 3, 1) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 354 | F(LiveEditPatchFunctionPositions, 2, 1) \ |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 355 | F(LiveEditCheckAndDropActivations, 2, 1) \ |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 356 | F(LiveEditCompareStringsLinewise, 2, 1) \ |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 357 | F(GetFunctionCodePositionFromSource, 2, 1) \ |
| 358 | F(ExecuteInDebugContext, 2, 1) |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 359 | #else |
| 360 | #define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) |
| 361 | #endif |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 362 | |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 363 | #ifdef ENABLE_LOGGING_AND_PROFILING |
| 364 | #define RUNTIME_FUNCTION_LIST_PROFILER_SUPPORT(F) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 365 | F(ProfilerResume, 2, 1) \ |
| 366 | F(ProfilerPause, 2, 1) |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 367 | #else |
| 368 | #define RUNTIME_FUNCTION_LIST_PROFILER_SUPPORT(F) |
| 369 | #endif |
| 370 | |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 371 | #ifdef DEBUG |
| 372 | #define RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
| 373 | /* Testing */ \ |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 374 | F(ListNatives, 0, 1) |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 375 | #else |
| 376 | #define RUNTIME_FUNCTION_LIST_DEBUG(F) |
| 377 | #endif |
| 378 | |
| 379 | |
| 380 | // ---------------------------------------------------------------------------- |
| 381 | // RUNTIME_FUNCTION_LIST defines all runtime functions accessed |
| 382 | // either directly by id (via the code generator), or indirectly |
| 383 | // via a native call by name (from within JS code). |
| 384 | |
| 385 | #define RUNTIME_FUNCTION_LIST(F) \ |
ager@chromium.org | ce58e17 | 2009-05-13 07:11:48 +0000 | [diff] [blame] | 386 | RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
| 387 | RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 388 | RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 389 | RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ |
| 390 | RUNTIME_FUNCTION_LIST_PROFILER_SUPPORT(F) |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 391 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 392 | // ---------------------------------------------------------------------------- |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 393 | // INLINE_FUNCTION_LIST defines all inlined functions accessed |
| 394 | // with a native call of the form %_name from within JS code. |
| 395 | // Entries have the form F(name, number of arguments, number of return values). |
| 396 | #define INLINE_FUNCTION_LIST(F) \ |
| 397 | F(IsSmi, 1, 1) \ |
| 398 | F(IsNonNegativeSmi, 1, 1) \ |
| 399 | F(IsArray, 1, 1) \ |
| 400 | F(IsRegExp, 1, 1) \ |
| 401 | F(CallFunction, -1 /* receiver + n args + function */, 1) \ |
| 402 | F(ArgumentsLength, 0, 1) \ |
| 403 | F(Arguments, 1, 1) \ |
| 404 | F(ValueOf, 1, 1) \ |
| 405 | F(SetValueOf, 2, 1) \ |
| 406 | F(StringCharFromCode, 1, 1) \ |
| 407 | F(StringCharAt, 2, 1) \ |
| 408 | F(ObjectEquals, 2, 1) \ |
| 409 | F(RandomHeapNumber, 0, 1) \ |
| 410 | F(IsObject, 1, 1) \ |
| 411 | F(IsFunction, 1, 1) \ |
| 412 | F(IsUndetectableObject, 1, 1) \ |
| 413 | F(IsSpecObject, 1, 1) \ |
| 414 | F(IsStringWrapperSafeForDefaultValueOf, 1, 1) \ |
| 415 | F(MathPow, 2, 1) \ |
| 416 | F(MathSin, 1, 1) \ |
| 417 | F(MathCos, 1, 1) \ |
| 418 | F(MathSqrt, 1, 1) \ |
| 419 | F(IsRegExpEquivalent, 2, 1) \ |
| 420 | F(HasCachedArrayIndex, 1, 1) \ |
| 421 | F(GetCachedArrayIndex, 1, 1) |
| 422 | |
| 423 | |
| 424 | // ---------------------------------------------------------------------------- |
| 425 | // INLINE_AND_RUNTIME_FUNCTION_LIST defines all inlined functions accessed |
| 426 | // 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] | 427 | // a corresponding runtime function, that is called for slow cases. |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 428 | // Entries have the form F(name, number of arguments, number of return values). |
| 429 | #define INLINE_RUNTIME_FUNCTION_LIST(F) \ |
| 430 | F(IsConstructCall, 0, 1) \ |
| 431 | F(ClassOf, 1, 1) \ |
| 432 | F(StringCharCodeAt, 2, 1) \ |
| 433 | F(Log, 3, 1) \ |
| 434 | F(StringAdd, 2, 1) \ |
| 435 | F(SubString, 3, 1) \ |
| 436 | F(StringCompare, 2, 1) \ |
| 437 | F(RegExpExec, 4, 1) \ |
| 438 | F(RegExpConstructResult, 3, 1) \ |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 439 | F(GetFromCache, 2, 1) \ |
| 440 | F(NumberToString, 1, 1) \ |
| 441 | F(SwapElements, 3, 1) |
| 442 | |
| 443 | |
| 444 | //--------------------------------------------------------------------------- |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 445 | // Runtime provides access to all C++ runtime functions. |
| 446 | |
| 447 | class Runtime : public AllStatic { |
| 448 | public: |
| 449 | enum FunctionId { |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 450 | #define F(name, nargs, ressize) k##name, |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 451 | RUNTIME_FUNCTION_LIST(F) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 452 | #undef F |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 453 | #define F(name, nargs, ressize) kInline##name, |
| 454 | INLINE_FUNCTION_LIST(F) |
| 455 | INLINE_RUNTIME_FUNCTION_LIST(F) |
| 456 | #undef F |
| 457 | kNumFunctions, |
| 458 | kFirstInlineFunction = kInlineIsSmi |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 459 | }; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 460 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 461 | enum IntrinsicType { |
| 462 | RUNTIME, |
| 463 | INLINE |
| 464 | }; |
| 465 | |
| 466 | // Intrinsic function descriptor. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 467 | struct Function { |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 468 | FunctionId function_id; |
| 469 | IntrinsicType intrinsic_type; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 470 | // The JS name of the function. |
| 471 | const char* name; |
| 472 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 473 | // The C++ (native) entry point. NULL if the function is inlined. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 474 | byte* entry; |
| 475 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 476 | // The number of arguments expected. nargs is -1 if the function takes |
| 477 | // a variable number of arguments. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 478 | int nargs; |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 479 | // Size of result. Most functions return a single pointer, size 1. |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 480 | int result_size; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 481 | }; |
| 482 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 483 | static const int kNotFound = -1; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 484 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 485 | // Add symbols for all the intrinsic function names to a StringDictionary. |
| 486 | // Returns failure if an allocation fails. In this case, it must be |
| 487 | // retried with a new, empty StringDictionary, not with the same one. |
| 488 | // Alternatively, heap initialization can be completely restarted. |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 489 | MUST_USE_RESULT static MaybeObject* InitializeIntrinsicFunctionNames( |
| 490 | Object* dictionary); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 491 | |
erik.corry@gmail.com | d88afa2 | 2010-09-15 12:33:05 +0000 | [diff] [blame] | 492 | // Get the intrinsic function with the given name, which must be a symbol. |
| 493 | static Function* FunctionForSymbol(Handle<String> name); |
| 494 | |
| 495 | // Get the intrinsic function with the given FunctionId. |
| 496 | static Function* FunctionForId(FunctionId id); |
| 497 | |
| 498 | // General-purpose helper functions for runtime system. |
ager@chromium.org | 7c537e2 | 2008-10-16 08:43:32 +0000 | [diff] [blame] | 499 | static int StringMatch(Handle<String> sub, Handle<String> pat, int index); |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 500 | |
kasperl@chromium.org | d1e3e72 | 2009-04-14 13:38:25 +0000 | [diff] [blame] | 501 | static bool IsUpperCaseChar(uint16_t ch); |
| 502 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 503 | // TODO(1240886): The following three methods are *not* handle safe, |
| 504 | // but accept handle arguments. This seems fragile. |
| 505 | |
| 506 | // Support getting the characters in a string using [] notation as |
| 507 | // in Firefox/SpiderMonkey, Safari and Opera. |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 508 | MUST_USE_RESULT static MaybeObject* GetElementOrCharAt(Handle<Object> object, |
| 509 | uint32_t index); |
| 510 | MUST_USE_RESULT static MaybeObject* GetElement(Handle<Object> object, |
| 511 | uint32_t index); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 512 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 513 | MUST_USE_RESULT static MaybeObject* SetObjectProperty( |
| 514 | Handle<Object> object, |
| 515 | Handle<Object> key, |
| 516 | Handle<Object> value, |
| 517 | PropertyAttributes attr); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 518 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 519 | MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty( |
| 520 | Handle<JSObject> object, |
| 521 | Handle<Object> key, |
| 522 | Handle<Object> value, |
| 523 | PropertyAttributes attr); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 524 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 525 | MUST_USE_RESULT static MaybeObject* ForceDeleteObjectProperty( |
| 526 | Handle<JSObject> object, |
| 527 | Handle<Object> key); |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 528 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 529 | MUST_USE_RESULT static MaybeObject* GetObjectProperty(Handle<Object> object, |
| 530 | Handle<Object> key); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 531 | |
kasperl@chromium.org | d1e3e72 | 2009-04-14 13:38:25 +0000 | [diff] [blame] | 532 | // This function is used in FunctionNameUsing* tests. |
| 533 | static Object* FindSharedFunctionInfoInScript(Handle<Script> script, |
| 534 | int position); |
| 535 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 536 | // Helper functions used stubs. |
| 537 | static void PerformGC(Object* result); |
| 538 | }; |
| 539 | |
| 540 | |
| 541 | } } // namespace v8::internal |
| 542 | |
| 543 | #endif // V8_RUNTIME_H_ |