| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 /* Numbers */ \ | 204 /* Numbers */ \ |
| 205 F(NumberToRadixString, 2, 1) \ | 205 F(NumberToRadixString, 2, 1) \ |
| 206 F(NumberToFixed, 2, 1) \ | 206 F(NumberToFixed, 2, 1) \ |
| 207 F(NumberToExponential, 2, 1) \ | 207 F(NumberToExponential, 2, 1) \ |
| 208 F(NumberToPrecision, 2, 1) | 208 F(NumberToPrecision, 2, 1) |
| 209 | 209 |
| 210 #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ | 210 #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
| 211 /* Reflection */ \ | 211 /* Reflection */ \ |
| 212 F(FunctionSetInstanceClassName, 2, 1) \ | 212 F(FunctionSetInstanceClassName, 2, 1) \ |
| 213 F(FunctionSetLength, 2, 1) \ | 213 F(FunctionSetLength, 2, 1) \ |
| 214 F(BoundFunctionSetLength, 2, 1) \ | |
| 215 F(FunctionSetPrototype, 2, 1) \ | 214 F(FunctionSetPrototype, 2, 1) \ |
| 216 F(FunctionSetReadOnlyPrototype, 1, 1) \ | 215 F(FunctionSetReadOnlyPrototype, 1, 1) \ |
| 217 F(FunctionGetName, 1, 1) \ | 216 F(FunctionGetName, 1, 1) \ |
| 218 F(FunctionSetName, 2, 1) \ | 217 F(FunctionSetName, 2, 1) \ |
| 219 F(FunctionNameShouldPrintAsAnonymous, 1, 1) \ | 218 F(FunctionNameShouldPrintAsAnonymous, 1, 1) \ |
| 220 F(FunctionMarkNameShouldPrintAsAnonymous, 1, 1) \ | 219 F(FunctionMarkNameShouldPrintAsAnonymous, 1, 1) \ |
| 221 F(FunctionSetBound, 1, 1) \ | 220 F(FunctionBindArguments, 4, 1) \ |
| 221 F(BoundFunctionGetBindings, 1, 1) \ |
| 222 F(FunctionRemovePrototype, 1, 1) \ | 222 F(FunctionRemovePrototype, 1, 1) \ |
| 223 F(FunctionGetSourceCode, 1, 1) \ | 223 F(FunctionGetSourceCode, 1, 1) \ |
| 224 F(FunctionGetScript, 1, 1) \ | 224 F(FunctionGetScript, 1, 1) \ |
| 225 F(FunctionGetScriptSourcePosition, 1, 1) \ | 225 F(FunctionGetScriptSourcePosition, 1, 1) \ |
| 226 F(FunctionGetPositionForOffset, 2, 1) \ | 226 F(FunctionGetPositionForOffset, 2, 1) \ |
| 227 F(FunctionIsAPIFunction, 1, 1) \ | 227 F(FunctionIsAPIFunction, 1, 1) \ |
| 228 F(FunctionIsBuiltin, 1, 1) \ | 228 F(FunctionIsBuiltin, 1, 1) \ |
| 229 F(GetScript, 1, 1) \ | 229 F(GetScript, 1, 1) \ |
| 230 F(CollectStackTrace, 2, 1) \ | 230 F(CollectStackTrace, 2, 1) \ |
| 231 F(GetV8Version, 0, 1) \ | 231 F(GetV8Version, 0, 1) \ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 F(MoveArrayContents, 2, 1) \ | 271 F(MoveArrayContents, 2, 1) \ |
| 272 F(EstimateNumberOfElements, 1, 1) \ | 272 F(EstimateNumberOfElements, 1, 1) \ |
| 273 F(SwapElements, 3, 1) \ | 273 F(SwapElements, 3, 1) \ |
| 274 \ | 274 \ |
| 275 /* Getters and Setters */ \ | 275 /* Getters and Setters */ \ |
| 276 F(DefineAccessor, -1 /* 4 or 5 */, 1) \ | 276 F(DefineAccessor, -1 /* 4 or 5 */, 1) \ |
| 277 F(LookupAccessor, 3, 1) \ | 277 F(LookupAccessor, 3, 1) \ |
| 278 \ | 278 \ |
| 279 /* Literals */ \ | 279 /* Literals */ \ |
| 280 F(MaterializeRegExpLiteral, 4, 1)\ | 280 F(MaterializeRegExpLiteral, 4, 1)\ |
| 281 F(CreateArrayLiteralBoilerplate, 3, 1) \ | 281 F(CreateArrayLiteralBoilerplate, 4, 1) \ |
| 282 F(CloneLiteralBoilerplate, 1, 1) \ | 282 F(CloneLiteralBoilerplate, 1, 1) \ |
| 283 F(CloneShallowLiteralBoilerplate, 1, 1) \ | 283 F(CloneShallowLiteralBoilerplate, 1, 1) \ |
| 284 F(CreateObjectLiteral, 4, 1) \ | 284 F(CreateObjectLiteral, 4, 1) \ |
| 285 F(CreateObjectLiteralShallow, 4, 1) \ | 285 F(CreateObjectLiteralShallow, 4, 1) \ |
| 286 F(CreateArrayLiteral, 3, 1) \ | 286 F(CreateArrayLiteral, 3, 1) \ |
| 287 F(CreateArrayLiteralShallow, 3, 1) \ | 287 F(CreateArrayLiteralShallow, 3, 1) \ |
| 288 \ | 288 \ |
| 289 /* Harmony proxies */ \ | 289 /* Harmony proxies */ \ |
| 290 F(CreateJSProxy, 2, 1) \ | 290 F(CreateJSProxy, 2, 1) \ |
| 291 F(CreateJSFunctionProxy, 4, 1) \ | 291 F(CreateJSFunctionProxy, 4, 1) \ |
| 292 F(IsJSProxy, 1, 1) \ | 292 F(IsJSProxy, 1, 1) \ |
| 293 F(IsJSFunctionProxy, 1, 1) \ | 293 F(IsJSFunctionProxy, 1, 1) \ |
| 294 F(GetHandler, 1, 1) \ | 294 F(GetHandler, 1, 1) \ |
| 295 F(GetCallTrap, 1, 1) \ | 295 F(GetCallTrap, 1, 1) \ |
| 296 F(GetConstructTrap, 1, 1) \ | 296 F(GetConstructTrap, 1, 1) \ |
| 297 F(Fix, 1, 1) \ | 297 F(Fix, 1, 1) \ |
| 298 \ | 298 \ |
| 299 /* Harmony sets */ \ |
| 300 F(SetInitialize, 1, 1) \ |
| 301 F(SetAdd, 2, 1) \ |
| 302 F(SetHas, 2, 1) \ |
| 303 F(SetDelete, 2, 1) \ |
| 304 \ |
| 305 /* Harmony maps */ \ |
| 306 F(MapInitialize, 1, 1) \ |
| 307 F(MapGet, 2, 1) \ |
| 308 F(MapSet, 3, 1) \ |
| 309 \ |
| 299 /* Harmony weakmaps */ \ | 310 /* Harmony weakmaps */ \ |
| 300 F(WeakMapInitialize, 1, 1) \ | 311 F(WeakMapInitialize, 1, 1) \ |
| 301 F(WeakMapGet, 2, 1) \ | 312 F(WeakMapGet, 2, 1) \ |
| 302 F(WeakMapSet, 3, 1) \ | 313 F(WeakMapSet, 3, 1) \ |
| 303 \ | 314 \ |
| 304 /* Statements */ \ | 315 /* Statements */ \ |
| 305 F(NewClosure, 3, 1) \ | 316 F(NewClosure, 3, 1) \ |
| 306 F(NewObject, 1, 1) \ | 317 F(NewObject, 1, 1) \ |
| 307 F(NewObjectFromBound, 2, 1) \ | 318 F(NewObjectFromBound, 1, 1) \ |
| 308 F(FinalizeInstanceSize, 1, 1) \ | 319 F(FinalizeInstanceSize, 1, 1) \ |
| 309 F(Throw, 1, 1) \ | 320 F(Throw, 1, 1) \ |
| 310 F(ReThrow, 1, 1) \ | 321 F(ReThrow, 1, 1) \ |
| 311 F(ThrowReferenceError, 1, 1) \ | 322 F(ThrowReferenceError, 1, 1) \ |
| 312 F(StackGuard, 0, 1) \ | 323 F(StackGuard, 0, 1) \ |
| 313 F(PromoteScheduledException, 0, 1) \ | 324 F(PromoteScheduledException, 0, 1) \ |
| 314 \ | 325 \ |
| 315 /* Contexts */ \ | 326 /* Contexts */ \ |
| 316 F(NewFunctionContext, 1, 1) \ | 327 F(NewFunctionContext, 1, 1) \ |
| 317 F(PushWithContext, 2, 1) \ | 328 F(PushWithContext, 2, 1) \ |
| 318 F(PushCatchContext, 3, 1) \ | 329 F(PushCatchContext, 3, 1) \ |
| 319 F(PushBlockContext, 2, 1) \ | 330 F(PushBlockContext, 2, 1) \ |
| 320 F(DeleteContextSlot, 2, 1) \ | 331 F(DeleteContextSlot, 2, 1) \ |
| 321 F(LoadContextSlot, 2, 2) \ | 332 F(LoadContextSlot, 2, 2) \ |
| 322 F(LoadContextSlotNoReferenceError, 2, 2) \ | 333 F(LoadContextSlotNoReferenceError, 2, 2) \ |
| 323 F(StoreContextSlot, 4, 1) \ | 334 F(StoreContextSlot, 4, 1) \ |
| 324 \ | 335 \ |
| 325 /* Declarations and initialization */ \ | 336 /* Declarations and initialization */ \ |
| 326 F(DeclareGlobals, 3, 1) \ | 337 F(DeclareGlobals, 3, 1) \ |
| 327 F(DeclareContextSlot, 4, 1) \ | 338 F(DeclareContextSlot, 4, 1) \ |
| 328 F(InitializeVarGlobal, -1 /* 2 or 3 */, 1) \ | 339 F(InitializeVarGlobal, -1 /* 2 or 3 */, 1) \ |
| 329 F(InitializeConstGlobal, 2, 1) \ | 340 F(InitializeConstGlobal, 2, 1) \ |
| 330 F(InitializeConstContextSlot, 3, 1) \ | 341 F(InitializeConstContextSlot, 3, 1) \ |
| 331 F(OptimizeObjectForAddingMultipleProperties, 2, 1) \ | 342 F(OptimizeObjectForAddingMultipleProperties, 2, 1) \ |
| 332 \ | 343 \ |
| 333 /* Arrays */ \ | |
| 334 F(NonSmiElementStored, 1, 1) \ | |
| 335 /* Debugging */ \ | 344 /* Debugging */ \ |
| 336 F(DebugPrint, 1, 1) \ | 345 F(DebugPrint, 1, 1) \ |
| 337 F(DebugTrace, 0, 1) \ | 346 F(DebugTrace, 0, 1) \ |
| 347 F(TraceElementsKindTransition, 5, 1) \ |
| 338 F(TraceEnter, 0, 1) \ | 348 F(TraceEnter, 0, 1) \ |
| 339 F(TraceExit, 1, 1) \ | 349 F(TraceExit, 1, 1) \ |
| 340 F(Abort, 2, 1) \ | 350 F(Abort, 2, 1) \ |
| 341 /* Logging */ \ | 351 /* Logging */ \ |
| 342 F(Log, 2, 1) \ | 352 F(Log, 2, 1) \ |
| 343 /* ES5 */ \ | 353 /* ES5 */ \ |
| 344 F(LocalKeys, 1, 1) \ | 354 F(LocalKeys, 1, 1) \ |
| 345 /* Cache suport */ \ | 355 /* Cache suport */ \ |
| 346 F(GetFromCache, 2, 1) \ | 356 F(GetFromCache, 2, 1) \ |
| 347 \ | 357 \ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 363 F(HasExternalPixelElements, 1, 1) \ | 373 F(HasExternalPixelElements, 1, 1) \ |
| 364 F(HasExternalArrayElements, 1, 1) \ | 374 F(HasExternalArrayElements, 1, 1) \ |
| 365 F(HasExternalByteElements, 1, 1) \ | 375 F(HasExternalByteElements, 1, 1) \ |
| 366 F(HasExternalUnsignedByteElements, 1, 1) \ | 376 F(HasExternalUnsignedByteElements, 1, 1) \ |
| 367 F(HasExternalShortElements, 1, 1) \ | 377 F(HasExternalShortElements, 1, 1) \ |
| 368 F(HasExternalUnsignedShortElements, 1, 1) \ | 378 F(HasExternalUnsignedShortElements, 1, 1) \ |
| 369 F(HasExternalIntElements, 1, 1) \ | 379 F(HasExternalIntElements, 1, 1) \ |
| 370 F(HasExternalUnsignedIntElements, 1, 1) \ | 380 F(HasExternalUnsignedIntElements, 1, 1) \ |
| 371 F(HasExternalFloatElements, 1, 1) \ | 381 F(HasExternalFloatElements, 1, 1) \ |
| 372 F(HasExternalDoubleElements, 1, 1) \ | 382 F(HasExternalDoubleElements, 1, 1) \ |
| 383 F(TransitionElementsSmiToDouble, 1, 1) \ |
| 384 F(TransitionElementsDoubleToObject, 1, 1) \ |
| 373 F(HaveSameMap, 2, 1) \ | 385 F(HaveSameMap, 2, 1) \ |
| 374 /* profiler */ \ | 386 /* profiler */ \ |
| 375 F(ProfilerResume, 0, 1) \ | 387 F(ProfilerResume, 0, 1) \ |
| 376 F(ProfilerPause, 0, 1) | 388 F(ProfilerPause, 0, 1) |
| 377 | 389 |
| 378 | 390 |
| 379 #ifdef ENABLE_DEBUGGER_SUPPORT | 391 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 380 #define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ | 392 #define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ |
| 381 /* Debugger support*/ \ | 393 /* Debugger support*/ \ |
| 382 F(DebugBreak, 0, 1) \ | 394 F(DebugBreak, 0, 1) \ |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 static const Function* FunctionForId(FunctionId id); | 633 static const Function* FunctionForId(FunctionId id); |
| 622 | 634 |
| 623 // General-purpose helper functions for runtime system. | 635 // General-purpose helper functions for runtime system. |
| 624 static int StringMatch(Isolate* isolate, | 636 static int StringMatch(Isolate* isolate, |
| 625 Handle<String> sub, | 637 Handle<String> sub, |
| 626 Handle<String> pat, | 638 Handle<String> pat, |
| 627 int index); | 639 int index); |
| 628 | 640 |
| 629 static bool IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch); | 641 static bool IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch); |
| 630 | 642 |
| 631 // TODO(1240886): The following three methods are *not* handle safe, | 643 // TODO(1240886): Some of the following methods are *not* handle safe, but |
| 632 // but accept handle arguments. This seems fragile. | 644 // accept handle arguments. This seems fragile. |
| 633 | 645 |
| 634 // Support getting the characters in a string using [] notation as | 646 // Support getting the characters in a string using [] notation as |
| 635 // in Firefox/SpiderMonkey, Safari and Opera. | 647 // in Firefox/SpiderMonkey, Safari and Opera. |
| 636 MUST_USE_RESULT static MaybeObject* GetElementOrCharAt(Isolate* isolate, | 648 MUST_USE_RESULT static MaybeObject* GetElementOrCharAt(Isolate* isolate, |
| 637 Handle<Object> object, | 649 Handle<Object> object, |
| 638 uint32_t index); | 650 uint32_t index); |
| 639 MUST_USE_RESULT static MaybeObject* GetElement(Handle<Object> object, | |
| 640 uint32_t index); | |
| 641 | 651 |
| 642 MUST_USE_RESULT static MaybeObject* SetObjectProperty( | 652 MUST_USE_RESULT static MaybeObject* SetObjectProperty( |
| 643 Isolate* isolate, | 653 Isolate* isolate, |
| 644 Handle<Object> object, | 654 Handle<Object> object, |
| 645 Handle<Object> key, | 655 Handle<Object> key, |
| 646 Handle<Object> value, | 656 Handle<Object> value, |
| 647 PropertyAttributes attr, | 657 PropertyAttributes attr, |
| 648 StrictModeFlag strict_mode); | 658 StrictModeFlag strict_mode); |
| 649 | 659 |
| 650 MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty( | 660 MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 670 int position); | 680 int position); |
| 671 | 681 |
| 672 // Helper functions used stubs. | 682 // Helper functions used stubs. |
| 673 static void PerformGC(Object* result); | 683 static void PerformGC(Object* result); |
| 674 }; | 684 }; |
| 675 | 685 |
| 676 | 686 |
| 677 //--------------------------------------------------------------------------- | 687 //--------------------------------------------------------------------------- |
| 678 // Constants used by interface to runtime functions. | 688 // Constants used by interface to runtime functions. |
| 679 | 689 |
| 680 enum kDeclareGlobalsFlags { | 690 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; |
| 681 kDeclareGlobalsEvalFlag = 1 << 0, | 691 class DeclareGlobalsStrictModeFlag: public BitField<StrictModeFlag, 1, 1> {}; |
| 682 kDeclareGlobalsStrictModeFlag = 1 << 1, | 692 class DeclareGlobalsNativeFlag: public BitField<bool, 2, 1> {}; |
| 683 kDeclareGlobalsNativeFlag = 1 << 2 | |
| 684 }; | |
| 685 | 693 |
| 686 } } // namespace v8::internal | 694 } } // namespace v8::internal |
| 687 | 695 |
| 688 #endif // V8_RUNTIME_H_ | 696 #endif // V8_RUNTIME_H_ |
| OLD | NEW |