ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1 | // Copyright 2006-2008 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 | |
| 31 | namespace v8 { namespace internal { |
| 32 | |
| 33 | // The interface to C++ runtime functions. |
| 34 | |
| 35 | // ---------------------------------------------------------------------------- |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 36 | // RUNTIME_FUNCTION_LIST_ALWAYS defines runtime calls available in both |
| 37 | // release and debug mode. |
| 38 | // 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] | 39 | |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 40 | #define RUNTIME_FUNCTION_LIST_ALWAYS(F) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 41 | /* Property access */ \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 42 | F(GetProperty, 2) \ |
ager@chromium.org | 7c537e2 | 2008-10-16 08:43:32 +0000 | [diff] [blame] | 43 | F(KeyedGetProperty, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 44 | F(DeleteProperty, 2) \ |
| 45 | F(HasLocalProperty, 2) \ |
| 46 | F(HasProperty, 2) \ |
| 47 | F(HasElement, 2) \ |
| 48 | F(IsPropertyEnumerable, 2) \ |
| 49 | F(GetPropertyNames, 1) \ |
| 50 | F(GetPropertyNamesFast, 1) \ |
| 51 | F(GetArgumentsProperty, 1) \ |
| 52 | \ |
| 53 | F(IsInPrototypeChain, 2) \ |
| 54 | \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 55 | F(IsConstructCall, 0) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 56 | \ |
| 57 | /* Utilities */ \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 58 | F(GetCalledFunction, 0) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 59 | F(GetFunctionDelegate, 1) \ |
| 60 | F(NewArguments, 1) \ |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 61 | F(NewArgumentsFast, 3) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 62 | F(LazyCompile, 1) \ |
| 63 | F(SetNewFunctionAttributes, 1) \ |
| 64 | \ |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 65 | /* Array join support */ \ |
| 66 | F(PushIfAbsent, 2) \ |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 67 | F(ArrayConcat, 1) \ |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 68 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 69 | /* Conversions */ \ |
| 70 | F(ToBool, 1) \ |
| 71 | F(Typeof, 1) \ |
| 72 | \ |
| 73 | F(StringToNumber, 1) \ |
| 74 | F(StringFromCharCodeArray, 1) \ |
| 75 | F(StringParseInt, 2) \ |
| 76 | F(StringParseFloat, 1) \ |
| 77 | F(StringToLowerCase, 1) \ |
| 78 | F(StringToUpperCase, 1) \ |
| 79 | F(CharFromCode, 1) \ |
| 80 | F(URIEscape, 1) \ |
| 81 | F(URIUnescape, 1) \ |
| 82 | \ |
| 83 | F(NumberToString, 1) \ |
| 84 | F(NumberToInteger, 1) \ |
| 85 | F(NumberToJSUint32, 1) \ |
| 86 | F(NumberToJSInt32, 1) \ |
ager@chromium.org | 870a0b6 | 2008-11-04 11:43:05 +0000 | [diff] [blame] | 87 | F(NumberToSmi, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 88 | \ |
| 89 | /* Arithmetic operations */ \ |
| 90 | F(NumberAdd, 2) \ |
| 91 | F(NumberSub, 2) \ |
| 92 | F(NumberMul, 2) \ |
| 93 | F(NumberDiv, 2) \ |
| 94 | F(NumberMod, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 95 | F(NumberUnaryMinus, 1) \ |
| 96 | \ |
| 97 | F(StringAdd, 2) \ |
| 98 | F(StringBuilderConcat, 2) \ |
| 99 | \ |
| 100 | /* Bit operations */ \ |
| 101 | F(NumberOr, 2) \ |
| 102 | F(NumberAnd, 2) \ |
| 103 | F(NumberXor, 2) \ |
| 104 | F(NumberNot, 1) \ |
| 105 | \ |
| 106 | F(NumberShl, 2) \ |
| 107 | F(NumberShr, 2) \ |
| 108 | F(NumberSar, 2) \ |
| 109 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 110 | /* Comparisons */ \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 111 | F(NumberEquals, 2) \ |
| 112 | F(StringEquals, 2) \ |
| 113 | \ |
| 114 | F(NumberCompare, 3) \ |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 115 | F(SmiLexicographicCompare, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 116 | F(StringCompare, 2) \ |
| 117 | \ |
| 118 | /* Math */ \ |
| 119 | F(Math_abs, 1) \ |
| 120 | F(Math_acos, 1) \ |
| 121 | F(Math_asin, 1) \ |
| 122 | F(Math_atan, 1) \ |
| 123 | F(Math_atan2, 2) \ |
| 124 | F(Math_ceil, 1) \ |
| 125 | F(Math_cos, 1) \ |
| 126 | F(Math_exp, 1) \ |
| 127 | F(Math_floor, 1) \ |
| 128 | F(Math_log, 1) \ |
| 129 | F(Math_pow, 2) \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 130 | F(Math_random, 0) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 131 | F(Math_round, 1) \ |
| 132 | F(Math_sin, 1) \ |
| 133 | F(Math_sqrt, 1) \ |
| 134 | F(Math_tan, 1) \ |
| 135 | \ |
| 136 | /* Regular expressions */ \ |
| 137 | F(RegExpCompile, 3) \ |
| 138 | F(RegExpExec, 3) \ |
| 139 | F(RegExpExecGlobal, 2) \ |
| 140 | \ |
| 141 | /* Strings */ \ |
| 142 | F(StringCharCodeAt, 2) \ |
| 143 | F(StringIndexOf, 3) \ |
| 144 | F(StringLastIndexOf, 3) \ |
| 145 | F(StringLocaleCompare, 2) \ |
| 146 | F(StringSlice, 3) \ |
| 147 | \ |
| 148 | /* Numbers */ \ |
| 149 | F(NumberToRadixString, 2) \ |
| 150 | F(NumberToFixed, 2) \ |
| 151 | F(NumberToExponential, 2) \ |
| 152 | F(NumberToPrecision, 2) \ |
| 153 | \ |
| 154 | /* Reflection */ \ |
| 155 | F(FunctionSetInstanceClassName, 2) \ |
| 156 | F(FunctionSetLength, 2) \ |
| 157 | F(FunctionSetPrototype, 2) \ |
| 158 | F(FunctionGetName, 1) \ |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 159 | F(FunctionSetName, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 160 | F(FunctionGetSourceCode, 1) \ |
| 161 | F(FunctionGetScript, 1) \ |
| 162 | F(FunctionGetScriptSourcePosition, 1) \ |
| 163 | F(GetScript, 1) \ |
| 164 | \ |
| 165 | F(ClassOf, 1) \ |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 166 | F(HasDateClass, 1) \ |
| 167 | F(HasStringClass, 1) \ |
| 168 | F(HasArrayClass, 1) \ |
| 169 | F(HasFunctionClass, 1) \ |
| 170 | F(HasNumberClass, 1) \ |
| 171 | F(HasBooleanClass, 1) \ |
| 172 | F(HasArgumentsClass, 1) \ |
| 173 | F(HasRegExpClass, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 174 | F(SetCode, 2) \ |
| 175 | \ |
| 176 | F(CreateApiFunction, 1) \ |
| 177 | F(IsTemplate, 1) \ |
| 178 | F(GetTemplateField, 2) \ |
ager@chromium.org | 870a0b6 | 2008-11-04 11:43:05 +0000 | [diff] [blame] | 179 | F(DisableAccessChecks, 1) \ |
| 180 | F(EnableAccessChecks, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 181 | \ |
| 182 | /* Dates */ \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 183 | F(DateCurrentTime, 0) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 184 | F(DateParseString, 1) \ |
| 185 | F(DateLocalTimezone, 1) \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 186 | F(DateLocalTimeOffset, 0) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 187 | F(DateDaylightSavingsOffset, 1) \ |
| 188 | \ |
| 189 | /* Numbers */ \ |
mads.s.ager@gmail.com | 769cc96 | 2008-08-06 10:02:49 +0000 | [diff] [blame] | 190 | F(NumberIsFinite, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 191 | \ |
| 192 | /* Globals */ \ |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame^] | 193 | F(CompileString, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 194 | F(CompileScript, 4) \ |
| 195 | F(GlobalPrint, 1) \ |
| 196 | \ |
| 197 | /* Eval */ \ |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 198 | F(GlobalReceiver, 1) \ |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame^] | 199 | F(ResolvePossiblyDirectEval, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 200 | \ |
| 201 | F(SetProperty, -1 /* 3 or 4 */) \ |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 202 | F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 203 | \ |
| 204 | /* Arrays */ \ |
| 205 | F(RemoveArrayHoles, 1) \ |
| 206 | F(GetArrayKeys, 2) \ |
| 207 | F(MoveArrayContents, 2) \ |
| 208 | F(EstimateNumberOfElements, 1) \ |
| 209 | \ |
| 210 | /* Getters and Setters */ \ |
| 211 | F(DefineAccessor, -1 /* 4 or 5 */) \ |
| 212 | F(LookupAccessor, 3) \ |
| 213 | \ |
| 214 | /* Debugging */ \ |
| 215 | F(AddDebugEventListener, 2) \ |
| 216 | F(RemoveDebugEventListener, 1) \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 217 | F(Break, 0) \ |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 218 | F(DebugGetPropertyDetails, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 219 | F(DebugGetProperty, 2) \ |
| 220 | F(DebugLocalPropertyNames, 1) \ |
| 221 | F(DebugLocalElementNames, 1) \ |
| 222 | F(DebugPropertyTypeFromDetails, 1) \ |
| 223 | F(DebugPropertyAttributesFromDetails, 1) \ |
| 224 | F(DebugPropertyIndexFromDetails, 1) \ |
| 225 | F(DebugInterceptorInfo, 1) \ |
| 226 | F(DebugNamedInterceptorPropertyNames, 1) \ |
| 227 | F(DebugIndexedInterceptorElementNames, 1) \ |
| 228 | F(DebugNamedInterceptorPropertyValue, 2) \ |
| 229 | F(DebugIndexedInterceptorElementValue, 2) \ |
| 230 | F(CheckExecutionState, 1) \ |
| 231 | F(GetFrameCount, 1) \ |
| 232 | F(GetFrameDetails, 2) \ |
| 233 | F(GetCFrames, 1) \ |
| 234 | F(GetBreakLocations, 1) \ |
| 235 | F(SetFunctionBreakPoint, 3) \ |
| 236 | F(SetScriptBreakPoint, 3) \ |
| 237 | F(ClearBreakPoint, 1) \ |
| 238 | F(ChangeBreakOnException, 2) \ |
| 239 | F(PrepareStep, 3) \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 240 | F(ClearStepping, 0) \ |
kasper.lund | bd3ec4e | 2008-07-09 11:06:54 +0000 | [diff] [blame] | 241 | F(DebugEvaluate, 4) \ |
| 242 | F(DebugEvaluateGlobal, 3) \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 243 | F(DebugGetLoadedScripts, 0) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 244 | F(DebugReferencedBy, 3) \ |
| 245 | F(DebugConstructedBy, 2) \ |
| 246 | F(GetPrototype, 1) \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 247 | F(SystemBreak, 0) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 248 | \ |
| 249 | /* Literals */ \ |
| 250 | F(MaterializeRegExpLiteral, 4)\ |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 251 | F(CreateArrayLiteral, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 252 | F(CreateObjectLiteralBoilerplate, 3) \ |
| 253 | F(CloneObjectLiteralBoilerplate, 1) \ |
| 254 | \ |
| 255 | /* Statements */ \ |
| 256 | F(NewClosure, 2) \ |
| 257 | F(NewObject, 1) \ |
| 258 | F(Throw, 1) \ |
| 259 | F(ReThrow, 1) \ |
| 260 | F(ThrowReferenceError, 1) \ |
| 261 | F(StackGuard, 1) \ |
| 262 | \ |
| 263 | /* Contexts */ \ |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 264 | F(NewContext, 1) \ |
| 265 | F(PushContext, 1) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 266 | F(LookupContext, 2) \ |
| 267 | F(LoadContextSlot, 2) \ |
| 268 | F(LoadContextSlotNoReferenceError, 2) \ |
| 269 | F(StoreContextSlot, 3) \ |
| 270 | \ |
| 271 | /* Declarations and initialization */ \ |
| 272 | F(DeclareGlobals, 3) \ |
ager@chromium.org | 7c537e2 | 2008-10-16 08:43:32 +0000 | [diff] [blame] | 273 | F(DeclareContextSlot, 4) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 274 | F(InitializeVarGlobal, -1 /* 1 or 2 */) \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 275 | F(InitializeConstGlobal, 2) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 276 | F(InitializeConstContextSlot, 3) \ |
| 277 | \ |
| 278 | /* Debugging */ \ |
| 279 | F(DebugPrint, 1) \ |
kasperl@chromium.org | 9fe21c6 | 2008-10-28 08:53:51 +0000 | [diff] [blame] | 280 | F(DebugTrace, 0) \ |
| 281 | F(TraceEnter, 0) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 282 | F(TraceExit, 1) \ |
kasperl@chromium.org | 9fe21c6 | 2008-10-28 08:53:51 +0000 | [diff] [blame] | 283 | F(DebugBreak, 0) \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 284 | F(FunctionGetAssemblerCode, 1) \ |
| 285 | F(Abort, 2) \ |
| 286 | \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 287 | /* Pseudo functions - handled as macros by parser */ \ |
| 288 | F(IS_VAR, 1) |
| 289 | |
| 290 | |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 291 | #ifdef DEBUG |
| 292 | #define RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
| 293 | /* Testing */ \ |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 294 | F(ListNatives, 0) |
kasper.lund | 4451067 | 2008-07-25 07:37:58 +0000 | [diff] [blame] | 295 | #else |
| 296 | #define RUNTIME_FUNCTION_LIST_DEBUG(F) |
| 297 | #endif |
| 298 | |
| 299 | |
| 300 | // ---------------------------------------------------------------------------- |
| 301 | // RUNTIME_FUNCTION_LIST defines all runtime functions accessed |
| 302 | // either directly by id (via the code generator), or indirectly |
| 303 | // via a native call by name (from within JS code). |
| 304 | |
| 305 | #define RUNTIME_FUNCTION_LIST(F) \ |
| 306 | RUNTIME_FUNCTION_LIST_ALWAYS(F) \ |
| 307 | RUNTIME_FUNCTION_LIST_DEBUG(F) |
| 308 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 309 | // ---------------------------------------------------------------------------- |
| 310 | // Runtime provides access to all C++ runtime functions. |
| 311 | |
| 312 | class Runtime : public AllStatic { |
| 313 | public: |
| 314 | enum FunctionId { |
| 315 | #define F(name, nargs) k##name, |
| 316 | RUNTIME_FUNCTION_LIST(F) |
| 317 | kNofFunctions |
| 318 | #undef F |
| 319 | }; |
| 320 | static Object* CreateArrayLiteral(Arguments args); |
| 321 | |
| 322 | // Runtime function descriptor. |
| 323 | struct Function { |
| 324 | // The JS name of the function. |
| 325 | const char* name; |
| 326 | |
| 327 | // The name of the stub that calls the runtime function. |
| 328 | const char* stub_name; |
| 329 | |
| 330 | // The C++ (native) entry point. |
| 331 | byte* entry; |
| 332 | |
| 333 | // The number of arguments expected; nargs < 0 if variable no. of |
| 334 | // arguments. |
| 335 | int nargs; |
| 336 | int stub_id; |
| 337 | }; |
| 338 | |
| 339 | // Get the runtime function with the given function id. |
| 340 | static Function* FunctionForId(FunctionId fid); |
| 341 | |
| 342 | // Get the runtime function with the given name. |
| 343 | static Function* FunctionForName(const char* name); |
| 344 | |
ager@chromium.org | 7c537e2 | 2008-10-16 08:43:32 +0000 | [diff] [blame] | 345 | static int StringMatch(Handle<String> sub, Handle<String> pat, int index); |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 346 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 347 | // TODO(1240886): The following three methods are *not* handle safe, |
| 348 | // but accept handle arguments. This seems fragile. |
| 349 | |
| 350 | // Support getting the characters in a string using [] notation as |
| 351 | // in Firefox/SpiderMonkey, Safari and Opera. |
| 352 | static Object* GetElementOrCharAt(Handle<Object> object, uint32_t index); |
| 353 | |
| 354 | static Object* SetObjectProperty(Handle<Object> object, |
| 355 | Handle<Object> key, |
| 356 | Handle<Object> value, |
| 357 | PropertyAttributes attr); |
| 358 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 359 | static Object* GetObjectProperty(Handle<Object> object, Handle<Object> key); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 360 | |
| 361 | // Helper functions used stubs. |
| 362 | static void PerformGC(Object* result); |
| 363 | }; |
| 364 | |
| 365 | |
| 366 | } } // namespace v8::internal |
| 367 | |
| 368 | #endif // V8_RUNTIME_H_ |