Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 1 | // Copyright 2010 the V8 project authors. All rights reserved. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +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 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 31 | #include "zone.h" |
| 32 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 33 | namespace v8 { |
| 34 | namespace internal { |
| 35 | |
| 36 | // The interface to C++ runtime functions. |
| 37 | |
| 38 | // ---------------------------------------------------------------------------- |
| 39 | // RUNTIME_FUNCTION_LIST_ALWAYS defines runtime calls available in both |
| 40 | // release and debug mode. |
| 41 | // This macro should only be used by the macro RUNTIME_FUNCTION_LIST. |
| 42 | |
| 43 | // WARNING: RUNTIME_FUNCTION_LIST_ALWAYS_* is a very large macro that caused |
| 44 | // MSVC Intellisense to crash. It was broken into two macros to work around |
| 45 | // this problem. Please avoid large recursive macros whenever possible. |
| 46 | #define RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
| 47 | /* Property access */ \ |
| 48 | F(GetProperty, 2, 1) \ |
| 49 | F(KeyedGetProperty, 2, 1) \ |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 50 | F(DeleteProperty, 3, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 51 | F(HasLocalProperty, 2, 1) \ |
| 52 | F(HasProperty, 2, 1) \ |
| 53 | F(HasElement, 2, 1) \ |
| 54 | F(IsPropertyEnumerable, 2, 1) \ |
| 55 | F(GetPropertyNames, 1, 1) \ |
| 56 | F(GetPropertyNamesFast, 1, 1) \ |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 57 | F(GetLocalPropertyNames, 1, 1) \ |
| 58 | F(GetLocalElementNames, 1, 1) \ |
| 59 | F(GetInterceptorInfo, 1, 1) \ |
| 60 | F(GetNamedInterceptorPropertyNames, 1, 1) \ |
| 61 | F(GetIndexedInterceptorElementNames, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 62 | F(GetArgumentsProperty, 1, 1) \ |
| 63 | F(ToFastProperties, 1, 1) \ |
| 64 | F(ToSlowProperties, 1, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 65 | F(FinishArrayPrototypeSetup, 1, 1) \ |
| 66 | F(SpecialArrayFunctions, 1, 1) \ |
| 67 | F(GetGlobalReceiver, 0, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 68 | \ |
| 69 | F(IsInPrototypeChain, 2, 1) \ |
| 70 | F(SetHiddenPrototype, 2, 1) \ |
| 71 | \ |
| 72 | F(IsConstructCall, 0, 1) \ |
| 73 | \ |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 74 | F(GetOwnProperty, 2, 1) \ |
| 75 | \ |
| 76 | F(IsExtensible, 1, 1) \ |
Steve Block | 8defd9f | 2010-07-08 12:39:36 +0100 | [diff] [blame] | 77 | F(PreventExtensions, 1, 1)\ |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 78 | \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 79 | /* Utilities */ \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 80 | F(GetFunctionDelegate, 1, 1) \ |
| 81 | F(GetConstructorDelegate, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 82 | F(NewArgumentsFast, 3, 1) \ |
| 83 | F(LazyCompile, 1, 1) \ |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 84 | F(LazyRecompile, 1, 1) \ |
| 85 | F(NotifyDeoptimized, 1, 1) \ |
| 86 | F(NotifyOSR, 0, 1) \ |
| 87 | F(DeoptimizeFunction, 1, 1) \ |
| 88 | F(CompileForOnStackReplacement, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 89 | F(SetNewFunctionAttributes, 1, 1) \ |
Ben Murdoch | bb769b2 | 2010-08-11 14:56:33 +0100 | [diff] [blame] | 90 | F(AllocateInNewSpace, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 91 | \ |
| 92 | /* Array join support */ \ |
| 93 | F(PushIfAbsent, 2, 1) \ |
| 94 | F(ArrayConcat, 1, 1) \ |
| 95 | \ |
| 96 | /* Conversions */ \ |
| 97 | F(ToBool, 1, 1) \ |
| 98 | F(Typeof, 1, 1) \ |
| 99 | \ |
| 100 | F(StringToNumber, 1, 1) \ |
| 101 | F(StringFromCharCodeArray, 1, 1) \ |
| 102 | F(StringParseInt, 2, 1) \ |
| 103 | F(StringParseFloat, 1, 1) \ |
| 104 | F(StringToLowerCase, 1, 1) \ |
| 105 | F(StringToUpperCase, 1, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 106 | F(StringSplit, 3, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 107 | F(CharFromCode, 1, 1) \ |
| 108 | F(URIEscape, 1, 1) \ |
| 109 | F(URIUnescape, 1, 1) \ |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 110 | F(QuoteJSONString, 1, 1) \ |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 111 | F(QuoteJSONStringComma, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 112 | \ |
| 113 | F(NumberToString, 1, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 114 | F(NumberToStringSkipCache, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 115 | F(NumberToInteger, 1, 1) \ |
Ben Murdoch | 7f4d5bd | 2010-06-15 11:15:29 +0100 | [diff] [blame] | 116 | F(NumberToIntegerMapMinusZero, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 117 | F(NumberToJSUint32, 1, 1) \ |
| 118 | F(NumberToJSInt32, 1, 1) \ |
| 119 | F(NumberToSmi, 1, 1) \ |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 120 | F(AllocateHeapNumber, 0, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 121 | \ |
| 122 | /* Arithmetic operations */ \ |
| 123 | F(NumberAdd, 2, 1) \ |
| 124 | F(NumberSub, 2, 1) \ |
| 125 | F(NumberMul, 2, 1) \ |
| 126 | F(NumberDiv, 2, 1) \ |
| 127 | F(NumberMod, 2, 1) \ |
| 128 | F(NumberUnaryMinus, 1, 1) \ |
Ben Murdoch | 3bec4d2 | 2010-07-22 14:51:16 +0100 | [diff] [blame] | 129 | F(NumberAlloc, 0, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 130 | \ |
| 131 | F(StringAdd, 2, 1) \ |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 132 | F(StringBuilderConcat, 3, 1) \ |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 133 | F(StringBuilderJoin, 3, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 134 | \ |
| 135 | /* Bit operations */ \ |
| 136 | F(NumberOr, 2, 1) \ |
| 137 | F(NumberAnd, 2, 1) \ |
| 138 | F(NumberXor, 2, 1) \ |
| 139 | F(NumberNot, 1, 1) \ |
| 140 | \ |
| 141 | F(NumberShl, 2, 1) \ |
| 142 | F(NumberShr, 2, 1) \ |
| 143 | F(NumberSar, 2, 1) \ |
| 144 | \ |
| 145 | /* Comparisons */ \ |
| 146 | F(NumberEquals, 2, 1) \ |
| 147 | F(StringEquals, 2, 1) \ |
| 148 | \ |
| 149 | F(NumberCompare, 3, 1) \ |
| 150 | F(SmiLexicographicCompare, 2, 1) \ |
| 151 | F(StringCompare, 2, 1) \ |
| 152 | \ |
| 153 | /* Math */ \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 154 | F(Math_acos, 1, 1) \ |
| 155 | F(Math_asin, 1, 1) \ |
| 156 | F(Math_atan, 1, 1) \ |
| 157 | F(Math_atan2, 2, 1) \ |
| 158 | F(Math_ceil, 1, 1) \ |
| 159 | F(Math_cos, 1, 1) \ |
| 160 | F(Math_exp, 1, 1) \ |
| 161 | F(Math_floor, 1, 1) \ |
| 162 | F(Math_log, 1, 1) \ |
| 163 | F(Math_pow, 2, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 164 | F(Math_pow_cfunction, 2, 1) \ |
| 165 | F(RoundNumber, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 166 | F(Math_sin, 1, 1) \ |
| 167 | F(Math_sqrt, 1, 1) \ |
| 168 | F(Math_tan, 1, 1) \ |
| 169 | \ |
| 170 | /* Regular expressions */ \ |
| 171 | F(RegExpCompile, 3, 1) \ |
| 172 | F(RegExpExec, 4, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 173 | F(RegExpExecMultiple, 4, 1) \ |
| 174 | F(RegExpInitializeObject, 5, 1) \ |
| 175 | F(RegExpConstructResult, 3, 1) \ |
Teng-Hui Zhu | 3e5fa29 | 2010-11-09 16:16:48 -0800 | [diff] [blame] | 176 | \ |
| 177 | /* JSON */ \ |
| 178 | F(ParseJson, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 179 | \ |
| 180 | /* Strings */ \ |
| 181 | F(StringCharCodeAt, 2, 1) \ |
| 182 | F(StringIndexOf, 3, 1) \ |
| 183 | F(StringLastIndexOf, 3, 1) \ |
| 184 | F(StringLocaleCompare, 2, 1) \ |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 185 | F(SubString, 3, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 186 | F(StringReplaceRegExpWithString, 4, 1) \ |
| 187 | F(StringMatch, 3, 1) \ |
Steve Block | 3ce2e20 | 2009-11-05 08:53:23 +0000 | [diff] [blame] | 188 | F(StringTrim, 3, 1) \ |
Shimeng (Simon) Wang | 8a31eba | 2010-12-06 19:01:33 -0800 | [diff] [blame] | 189 | F(StringToArray, 2, 1) \ |
Kristian Monsen | 80d68ea | 2010-09-08 11:05:35 +0100 | [diff] [blame] | 190 | F(NewStringWrapper, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 191 | \ |
| 192 | /* Numbers */ \ |
| 193 | F(NumberToRadixString, 2, 1) \ |
| 194 | F(NumberToFixed, 2, 1) \ |
| 195 | F(NumberToExponential, 2, 1) \ |
| 196 | F(NumberToPrecision, 2, 1) |
| 197 | |
| 198 | #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
| 199 | /* Reflection */ \ |
| 200 | F(FunctionSetInstanceClassName, 2, 1) \ |
| 201 | F(FunctionSetLength, 2, 1) \ |
| 202 | F(FunctionSetPrototype, 2, 1) \ |
| 203 | F(FunctionGetName, 1, 1) \ |
| 204 | F(FunctionSetName, 2, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 205 | F(FunctionRemovePrototype, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 206 | F(FunctionGetSourceCode, 1, 1) \ |
| 207 | F(FunctionGetScript, 1, 1) \ |
| 208 | F(FunctionGetScriptSourcePosition, 1, 1) \ |
| 209 | F(FunctionGetPositionForOffset, 2, 1) \ |
| 210 | F(FunctionIsAPIFunction, 1, 1) \ |
| 211 | F(FunctionIsBuiltin, 1, 1) \ |
| 212 | F(GetScript, 1, 1) \ |
| 213 | F(CollectStackTrace, 2, 1) \ |
Steve Block | 3ce2e20 | 2009-11-05 08:53:23 +0000 | [diff] [blame] | 214 | F(GetV8Version, 0, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 215 | \ |
| 216 | F(ClassOf, 1, 1) \ |
| 217 | F(SetCode, 2, 1) \ |
Kristian Monsen | 80d68ea | 2010-09-08 11:05:35 +0100 | [diff] [blame] | 218 | F(SetExpectedNumberOfProperties, 2, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 219 | \ |
| 220 | F(CreateApiFunction, 1, 1) \ |
| 221 | F(IsTemplate, 1, 1) \ |
| 222 | F(GetTemplateField, 2, 1) \ |
| 223 | F(DisableAccessChecks, 1, 1) \ |
| 224 | F(EnableAccessChecks, 1, 1) \ |
| 225 | \ |
| 226 | /* Dates */ \ |
| 227 | F(DateCurrentTime, 0, 1) \ |
| 228 | F(DateParseString, 2, 1) \ |
| 229 | F(DateLocalTimezone, 1, 1) \ |
| 230 | F(DateLocalTimeOffset, 0, 1) \ |
| 231 | F(DateDaylightSavingsOffset, 1, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 232 | F(DateMakeDay, 3, 1) \ |
| 233 | F(DateYMDFromTime, 2, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 234 | \ |
| 235 | /* Numbers */ \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 236 | \ |
| 237 | /* Globals */ \ |
Teng-Hui Zhu | 3e5fa29 | 2010-11-09 16:16:48 -0800 | [diff] [blame] | 238 | F(CompileString, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 239 | F(GlobalPrint, 1, 1) \ |
| 240 | \ |
| 241 | /* Eval */ \ |
| 242 | F(GlobalReceiver, 1, 1) \ |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 243 | F(ResolvePossiblyDirectEval, 4, 2) \ |
| 244 | F(ResolvePossiblyDirectEvalNoLookup, 4, 2) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 245 | \ |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 246 | F(SetProperty, -1 /* 4 or 5 */, 1) \ |
Andrei Popescu | 3100271 | 2010-02-23 13:46:05 +0000 | [diff] [blame] | 247 | F(DefineOrRedefineDataProperty, 4, 1) \ |
| 248 | F(DefineOrRedefineAccessorProperty, 5, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 249 | F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */, 1) \ |
| 250 | \ |
| 251 | /* Arrays */ \ |
| 252 | F(RemoveArrayHoles, 2, 1) \ |
| 253 | F(GetArrayKeys, 2, 1) \ |
| 254 | F(MoveArrayContents, 2, 1) \ |
| 255 | F(EstimateNumberOfElements, 1, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 256 | F(SwapElements, 3, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 257 | \ |
| 258 | /* Getters and Setters */ \ |
| 259 | F(DefineAccessor, -1 /* 4 or 5 */, 1) \ |
| 260 | F(LookupAccessor, 3, 1) \ |
| 261 | \ |
| 262 | /* Literals */ \ |
| 263 | F(MaterializeRegExpLiteral, 4, 1)\ |
| 264 | F(CreateArrayLiteralBoilerplate, 3, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 265 | F(CloneLiteralBoilerplate, 1, 1) \ |
| 266 | F(CloneShallowLiteralBoilerplate, 1, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 267 | F(CreateObjectLiteral, 4, 1) \ |
| 268 | F(CreateObjectLiteralShallow, 4, 1) \ |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 269 | F(CreateArrayLiteral, 3, 1) \ |
| 270 | F(CreateArrayLiteralShallow, 3, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 271 | \ |
| 272 | /* Catch context extension objects */ \ |
| 273 | F(CreateCatchExtensionObject, 2, 1) \ |
| 274 | \ |
| 275 | /* Statements */ \ |
Shimeng (Simon) Wang | 8a31eba | 2010-12-06 19:01:33 -0800 | [diff] [blame] | 276 | F(NewClosure, 3, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 277 | F(NewObject, 1, 1) \ |
Kristian Monsen | 50ef84f | 2010-07-29 15:18:00 +0100 | [diff] [blame] | 278 | F(NewObjectFromBound, 2, 1) \ |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 279 | F(FinalizeInstanceSize, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 280 | F(Throw, 1, 1) \ |
| 281 | F(ReThrow, 1, 1) \ |
| 282 | F(ThrowReferenceError, 1, 1) \ |
Ben Murdoch | f87a203 | 2010-10-22 12:50:53 +0100 | [diff] [blame] | 283 | F(StackGuard, 0, 1) \ |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 284 | F(PromoteScheduledException, 0, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 285 | \ |
| 286 | /* Contexts */ \ |
| 287 | F(NewContext, 1, 1) \ |
| 288 | F(PushContext, 1, 1) \ |
| 289 | F(PushCatchContext, 1, 1) \ |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 290 | F(DeleteContextSlot, 2, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 291 | F(LoadContextSlot, 2, 2) \ |
| 292 | F(LoadContextSlotNoReferenceError, 2, 2) \ |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 293 | F(StoreContextSlot, 4, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 294 | \ |
| 295 | /* Declarations and initialization */ \ |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 296 | F(DeclareGlobals, 4, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 297 | F(DeclareContextSlot, 4, 1) \ |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 298 | F(InitializeVarGlobal, -1 /* 2 or 3 */, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 299 | F(InitializeConstGlobal, 2, 1) \ |
| 300 | F(InitializeConstContextSlot, 3, 1) \ |
| 301 | F(OptimizeObjectForAddingMultipleProperties, 2, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 302 | \ |
| 303 | /* Debugging */ \ |
| 304 | F(DebugPrint, 1, 1) \ |
| 305 | F(DebugTrace, 0, 1) \ |
| 306 | F(TraceEnter, 0, 1) \ |
| 307 | F(TraceExit, 1, 1) \ |
| 308 | F(Abort, 2, 1) \ |
| 309 | /* Logging */ \ |
| 310 | F(Log, 2, 1) \ |
| 311 | /* ES5 */ \ |
| 312 | F(LocalKeys, 1, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 313 | /* Cache suport */ \ |
| 314 | F(GetFromCache, 2, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 315 | \ |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 316 | /* Message objects */ \ |
| 317 | F(NewMessageObject, 2, 1) \ |
| 318 | F(MessageGetType, 1, 1) \ |
| 319 | F(MessageGetArguments, 1, 1) \ |
| 320 | F(MessageGetStartPosition, 1, 1) \ |
| 321 | F(MessageGetScript, 1, 1) \ |
| 322 | \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 323 | /* Pseudo functions - handled as macros by parser */ \ |
Andrei Popescu | 402d937 | 2010-02-26 13:31:12 +0000 | [diff] [blame] | 324 | F(IS_VAR, 1, 1) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 325 | |
| 326 | #ifdef ENABLE_DEBUGGER_SUPPORT |
| 327 | #define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ |
| 328 | /* Debugger support*/ \ |
| 329 | F(DebugBreak, 0, 1) \ |
| 330 | F(SetDebugEventListener, 2, 1) \ |
| 331 | F(Break, 0, 1) \ |
| 332 | F(DebugGetPropertyDetails, 2, 1) \ |
| 333 | F(DebugGetProperty, 2, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 334 | F(DebugPropertyTypeFromDetails, 1, 1) \ |
| 335 | F(DebugPropertyAttributesFromDetails, 1, 1) \ |
| 336 | F(DebugPropertyIndexFromDetails, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 337 | F(DebugNamedInterceptorPropertyValue, 2, 1) \ |
| 338 | F(DebugIndexedInterceptorElementValue, 2, 1) \ |
| 339 | F(CheckExecutionState, 1, 1) \ |
| 340 | F(GetFrameCount, 1, 1) \ |
| 341 | F(GetFrameDetails, 2, 1) \ |
| 342 | F(GetScopeCount, 2, 1) \ |
| 343 | F(GetScopeDetails, 3, 1) \ |
| 344 | F(DebugPrintScopes, 0, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 345 | F(GetThreadCount, 1, 1) \ |
| 346 | F(GetThreadDetails, 2, 1) \ |
Ben Murdoch | bb769b2 | 2010-08-11 14:56:33 +0100 | [diff] [blame] | 347 | F(SetDisableBreak, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 348 | F(GetBreakLocations, 1, 1) \ |
| 349 | F(SetFunctionBreakPoint, 3, 1) \ |
| 350 | F(SetScriptBreakPoint, 3, 1) \ |
| 351 | F(ClearBreakPoint, 1, 1) \ |
| 352 | F(ChangeBreakOnException, 2, 1) \ |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 353 | F(IsBreakOnException, 1, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 354 | F(PrepareStep, 3, 1) \ |
| 355 | F(ClearStepping, 0, 1) \ |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 356 | F(DebugEvaluate, 5, 1) \ |
| 357 | F(DebugEvaluateGlobal, 4, 1) \ |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 358 | F(DebugGetLoadedScripts, 0, 1) \ |
| 359 | F(DebugReferencedBy, 3, 1) \ |
| 360 | F(DebugConstructedBy, 2, 1) \ |
| 361 | F(DebugGetPrototype, 1, 1) \ |
| 362 | F(SystemBreak, 0, 1) \ |
| 363 | F(DebugDisassembleFunction, 1, 1) \ |
| 364 | F(DebugDisassembleConstructor, 1, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 365 | F(FunctionGetInferredName, 1, 1) \ |
| 366 | F(LiveEditFindSharedFunctionInfosForScript, 1, 1) \ |
| 367 | F(LiveEditGatherCompileInfo, 2, 1) \ |
| 368 | F(LiveEditReplaceScript, 3, 1) \ |
| 369 | F(LiveEditReplaceFunctionCode, 2, 1) \ |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 370 | F(LiveEditFunctionSourceUpdated, 1, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 371 | F(LiveEditFunctionSetScript, 2, 1) \ |
| 372 | F(LiveEditReplaceRefToNestedFunction, 3, 1) \ |
| 373 | F(LiveEditPatchFunctionPositions, 2, 1) \ |
| 374 | F(LiveEditCheckAndDropActivations, 2, 1) \ |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 375 | F(LiveEditCompareStrings, 2, 1) \ |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 376 | F(GetFunctionCodePositionFromSource, 2, 1) \ |
Ben Murdoch | 086aeea | 2011-05-13 15:57:08 +0100 | [diff] [blame] | 377 | F(ExecuteInDebugContext, 2, 1) \ |
| 378 | \ |
| 379 | F(SetFlags, 1, 1) \ |
| 380 | F(CollectGarbage, 1, 1) \ |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 381 | F(GetHeapUsage, 0, 1) \ |
| 382 | \ |
| 383 | /* LiveObjectList support*/ \ |
| 384 | F(HasLOLEnabled, 0, 1) \ |
| 385 | F(CaptureLOL, 0, 1) \ |
| 386 | F(DeleteLOL, 1, 1) \ |
| 387 | F(DumpLOL, 5, 1) \ |
| 388 | F(GetLOLObj, 1, 1) \ |
| 389 | F(GetLOLObjId, 1, 1) \ |
| 390 | F(GetLOLObjRetainers, 6, 1) \ |
| 391 | F(GetLOLPath, 3, 1) \ |
| 392 | F(InfoLOL, 2, 1) \ |
| 393 | F(PrintLOLObj, 1, 1) \ |
| 394 | F(ResetLOL, 0, 1) \ |
| 395 | F(SummarizeLOL, 3, 1) |
Ben Murdoch | 086aeea | 2011-05-13 15:57:08 +0100 | [diff] [blame] | 396 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 397 | #else |
| 398 | #define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) |
| 399 | #endif |
| 400 | |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 401 | #ifdef ENABLE_LOGGING_AND_PROFILING |
| 402 | #define RUNTIME_FUNCTION_LIST_PROFILER_SUPPORT(F) \ |
Andrei Popescu | 402d937 | 2010-02-26 13:31:12 +0000 | [diff] [blame] | 403 | F(ProfilerResume, 2, 1) \ |
| 404 | F(ProfilerPause, 2, 1) |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 405 | #else |
| 406 | #define RUNTIME_FUNCTION_LIST_PROFILER_SUPPORT(F) |
| 407 | #endif |
| 408 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 409 | #ifdef DEBUG |
| 410 | #define RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
| 411 | /* Testing */ \ |
| 412 | F(ListNatives, 0, 1) |
| 413 | #else |
| 414 | #define RUNTIME_FUNCTION_LIST_DEBUG(F) |
| 415 | #endif |
| 416 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 417 | // ---------------------------------------------------------------------------- |
| 418 | // RUNTIME_FUNCTION_LIST defines all runtime functions accessed |
| 419 | // either directly by id (via the code generator), or indirectly |
| 420 | // via a native call by name (from within JS code). |
| 421 | |
| 422 | #define RUNTIME_FUNCTION_LIST(F) \ |
| 423 | RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
| 424 | RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
| 425 | RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 426 | RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ |
| 427 | RUNTIME_FUNCTION_LIST_PROFILER_SUPPORT(F) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 428 | |
| 429 | // ---------------------------------------------------------------------------- |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 430 | // INLINE_FUNCTION_LIST defines all inlined functions accessed |
| 431 | // with a native call of the form %_name from within JS code. |
| 432 | // Entries have the form F(name, number of arguments, number of return values). |
| 433 | #define INLINE_FUNCTION_LIST(F) \ |
| 434 | F(IsSmi, 1, 1) \ |
| 435 | F(IsNonNegativeSmi, 1, 1) \ |
| 436 | F(IsArray, 1, 1) \ |
| 437 | F(IsRegExp, 1, 1) \ |
| 438 | F(CallFunction, -1 /* receiver + n args + function */, 1) \ |
| 439 | F(ArgumentsLength, 0, 1) \ |
| 440 | F(Arguments, 1, 1) \ |
| 441 | F(ValueOf, 1, 1) \ |
| 442 | F(SetValueOf, 2, 1) \ |
| 443 | F(StringCharFromCode, 1, 1) \ |
| 444 | F(StringCharAt, 2, 1) \ |
| 445 | F(ObjectEquals, 2, 1) \ |
| 446 | F(RandomHeapNumber, 0, 1) \ |
| 447 | F(IsObject, 1, 1) \ |
| 448 | F(IsFunction, 1, 1) \ |
| 449 | F(IsUndetectableObject, 1, 1) \ |
| 450 | F(IsSpecObject, 1, 1) \ |
| 451 | F(IsStringWrapperSafeForDefaultValueOf, 1, 1) \ |
| 452 | F(MathPow, 2, 1) \ |
| 453 | F(MathSin, 1, 1) \ |
| 454 | F(MathCos, 1, 1) \ |
| 455 | F(MathSqrt, 1, 1) \ |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 456 | F(MathLog, 1, 1) \ |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 457 | F(IsRegExpEquivalent, 2, 1) \ |
| 458 | F(HasCachedArrayIndex, 1, 1) \ |
Shimeng (Simon) Wang | 8a31eba | 2010-12-06 19:01:33 -0800 | [diff] [blame] | 459 | F(GetCachedArrayIndex, 1, 1) \ |
| 460 | F(FastAsciiArrayJoin, 2, 1) |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 461 | |
| 462 | |
| 463 | // ---------------------------------------------------------------------------- |
| 464 | // INLINE_AND_RUNTIME_FUNCTION_LIST defines all inlined functions accessed |
| 465 | // with a native call of the form %_name from within JS code that also have |
Teng-Hui Zhu | 3e5fa29 | 2010-11-09 16:16:48 -0800 | [diff] [blame] | 466 | // a corresponding runtime function, that is called for slow cases. |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 467 | // Entries have the form F(name, number of arguments, number of return values). |
| 468 | #define INLINE_RUNTIME_FUNCTION_LIST(F) \ |
| 469 | F(IsConstructCall, 0, 1) \ |
| 470 | F(ClassOf, 1, 1) \ |
| 471 | F(StringCharCodeAt, 2, 1) \ |
| 472 | F(Log, 3, 1) \ |
| 473 | F(StringAdd, 2, 1) \ |
| 474 | F(SubString, 3, 1) \ |
| 475 | F(StringCompare, 2, 1) \ |
| 476 | F(RegExpExec, 4, 1) \ |
| 477 | F(RegExpConstructResult, 3, 1) \ |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 478 | F(GetFromCache, 2, 1) \ |
| 479 | F(NumberToString, 1, 1) \ |
| 480 | F(SwapElements, 3, 1) |
| 481 | |
| 482 | |
| 483 | //--------------------------------------------------------------------------- |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 484 | // Runtime provides access to all C++ runtime functions. |
| 485 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 486 | class RuntimeState { |
| 487 | public: |
| 488 | |
| 489 | StaticResource<StringInputBuffer>* string_input_buffer() { |
| 490 | return &string_input_buffer_; |
| 491 | } |
| 492 | unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() { |
| 493 | return &to_upper_mapping_; |
| 494 | } |
| 495 | unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() { |
| 496 | return &to_lower_mapping_; |
| 497 | } |
| 498 | StringInputBuffer* string_input_buffer_compare_bufx() { |
| 499 | return &string_input_buffer_compare_bufx_; |
| 500 | } |
| 501 | StringInputBuffer* string_input_buffer_compare_bufy() { |
| 502 | return &string_input_buffer_compare_bufy_; |
| 503 | } |
| 504 | StringInputBuffer* string_locale_compare_buf1() { |
| 505 | return &string_locale_compare_buf1_; |
| 506 | } |
| 507 | StringInputBuffer* string_locale_compare_buf2() { |
| 508 | return &string_locale_compare_buf2_; |
| 509 | } |
| 510 | int* smi_lexicographic_compare_x_elms() { |
| 511 | return smi_lexicographic_compare_x_elms_; |
| 512 | } |
| 513 | int* smi_lexicographic_compare_y_elms() { |
| 514 | return smi_lexicographic_compare_y_elms_; |
| 515 | } |
| 516 | |
| 517 | private: |
| 518 | RuntimeState() {} |
| 519 | // Non-reentrant string buffer for efficient general use in the runtime. |
| 520 | StaticResource<StringInputBuffer> string_input_buffer_; |
| 521 | unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; |
| 522 | unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; |
| 523 | StringInputBuffer string_input_buffer_compare_bufx_; |
| 524 | StringInputBuffer string_input_buffer_compare_bufy_; |
| 525 | StringInputBuffer string_locale_compare_buf1_; |
| 526 | StringInputBuffer string_locale_compare_buf2_; |
| 527 | int smi_lexicographic_compare_x_elms_[10]; |
| 528 | int smi_lexicographic_compare_y_elms_[10]; |
| 529 | |
| 530 | friend class Isolate; |
| 531 | friend class Runtime; |
| 532 | |
| 533 | DISALLOW_COPY_AND_ASSIGN(RuntimeState); |
| 534 | }; |
| 535 | |
| 536 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 537 | class Runtime : public AllStatic { |
| 538 | public: |
| 539 | enum FunctionId { |
| 540 | #define F(name, nargs, ressize) k##name, |
| 541 | RUNTIME_FUNCTION_LIST(F) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 542 | #undef F |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 543 | #define F(name, nargs, ressize) kInline##name, |
| 544 | INLINE_FUNCTION_LIST(F) |
| 545 | INLINE_RUNTIME_FUNCTION_LIST(F) |
| 546 | #undef F |
| 547 | kNumFunctions, |
| 548 | kFirstInlineFunction = kInlineIsSmi |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 549 | }; |
| 550 | |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 551 | enum IntrinsicType { |
| 552 | RUNTIME, |
| 553 | INLINE |
| 554 | }; |
| 555 | |
| 556 | // Intrinsic function descriptor. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 557 | struct Function { |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 558 | FunctionId function_id; |
| 559 | IntrinsicType intrinsic_type; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 560 | // The JS name of the function. |
| 561 | const char* name; |
| 562 | |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 563 | // The C++ (native) entry point. NULL if the function is inlined. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 564 | byte* entry; |
| 565 | |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 566 | // The number of arguments expected. nargs is -1 if the function takes |
| 567 | // a variable number of arguments. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 568 | int nargs; |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 569 | // Size of result. Most functions return a single pointer, size 1. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 570 | int result_size; |
| 571 | }; |
| 572 | |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 573 | static const int kNotFound = -1; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 574 | |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 575 | // Add symbols for all the intrinsic function names to a StringDictionary. |
| 576 | // Returns failure if an allocation fails. In this case, it must be |
| 577 | // retried with a new, empty StringDictionary, not with the same one. |
| 578 | // Alternatively, heap initialization can be completely restarted. |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 579 | MUST_USE_RESULT static MaybeObject* InitializeIntrinsicFunctionNames( |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 580 | Heap* heap, Object* dictionary); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 581 | |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 582 | // Get the intrinsic function with the given name, which must be a symbol. |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 583 | static const Function* FunctionForSymbol(Handle<String> name); |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 584 | |
| 585 | // Get the intrinsic function with the given FunctionId. |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 586 | static const Function* FunctionForId(FunctionId id); |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 587 | |
| 588 | // General-purpose helper functions for runtime system. |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 589 | static int StringMatch(Isolate* isolate, |
| 590 | Handle<String> sub, |
| 591 | Handle<String> pat, |
| 592 | int index); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 593 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 594 | static bool IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 595 | |
| 596 | // TODO(1240886): The following three methods are *not* handle safe, |
| 597 | // but accept handle arguments. This seems fragile. |
| 598 | |
| 599 | // Support getting the characters in a string using [] notation as |
| 600 | // in Firefox/SpiderMonkey, Safari and Opera. |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 601 | MUST_USE_RESULT static MaybeObject* GetElementOrCharAt(Isolate* isolate, |
| 602 | Handle<Object> object, |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 603 | uint32_t index); |
| 604 | MUST_USE_RESULT static MaybeObject* GetElement(Handle<Object> object, |
| 605 | uint32_t index); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 606 | |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 607 | MUST_USE_RESULT static MaybeObject* SetObjectProperty( |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 608 | Isolate* isolate, |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 609 | Handle<Object> object, |
| 610 | Handle<Object> key, |
| 611 | Handle<Object> value, |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 612 | PropertyAttributes attr, |
| 613 | StrictModeFlag strict_mode); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 614 | |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 615 | MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty( |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 616 | Isolate* isolate, |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 617 | Handle<JSObject> object, |
| 618 | Handle<Object> key, |
| 619 | Handle<Object> value, |
| 620 | PropertyAttributes attr); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 621 | |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 622 | MUST_USE_RESULT static MaybeObject* ForceDeleteObjectProperty( |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 623 | Isolate* isolate, |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 624 | Handle<JSObject> object, |
| 625 | Handle<Object> key); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 626 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 627 | MUST_USE_RESULT static MaybeObject* GetObjectProperty( |
| 628 | Isolate* isolate, |
| 629 | Handle<Object> object, |
| 630 | Handle<Object> key); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 631 | |
| 632 | // This function is used in FunctionNameUsing* tests. |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 633 | static Object* FindSharedFunctionInfoInScript(Isolate* isolate, |
| 634 | Handle<Script> script, |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 635 | int position); |
| 636 | |
| 637 | // Helper functions used stubs. |
| 638 | static void PerformGC(Object* result); |
| 639 | }; |
| 640 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 641 | } } // namespace v8::internal |
| 642 | |
| 643 | #endif // V8_RUNTIME_H_ |