OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_RUNTIME_H_ | 5 #ifndef V8_RUNTIME_H_ |
6 #define V8_RUNTIME_H_ | 6 #define V8_RUNTIME_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/zone.h" | 9 #include "src/zone.h" |
10 | 10 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 F(HasFixedInt32Elements, 1, 1) \ | 390 F(HasFixedInt32Elements, 1, 1) \ |
391 F(HasFixedUint32Elements, 1, 1) \ | 391 F(HasFixedUint32Elements, 1, 1) \ |
392 F(HasFixedFloat32Elements, 1, 1) \ | 392 F(HasFixedFloat32Elements, 1, 1) \ |
393 F(HasFixedFloat64Elements, 1, 1) \ | 393 F(HasFixedFloat64Elements, 1, 1) \ |
394 F(HasFastProperties, 1, 1) \ | 394 F(HasFastProperties, 1, 1) \ |
395 F(TransitionElementsKind, 2, 1) \ | 395 F(TransitionElementsKind, 2, 1) \ |
396 F(HaveSameMap, 2, 1) \ | 396 F(HaveSameMap, 2, 1) \ |
397 F(IsJSGlobalProxy, 1, 1) | 397 F(IsJSGlobalProxy, 1, 1) |
398 | 398 |
399 | 399 |
| 400 #define RUNTIME_FUNCTION_LIST_ALWAYS_3(F) \ |
| 401 /* String and Regexp */ \ |
| 402 F(NumberToStringRT, 1, 1) \ |
| 403 F(RegExpConstructResult, 3, 1) \ |
| 404 F(RegExpExecRT, 4, 1) \ |
| 405 F(StringAdd, 2, 1) \ |
| 406 F(SubString, 3, 1) \ |
| 407 F(StringCompare, 2, 1) \ |
| 408 F(StringCharCodeAtRT, 2, 1) \ |
| 409 F(GetFromCache, 2, 1) \ |
| 410 \ |
| 411 /* Compilation */ \ |
| 412 F(CompileUnoptimized, 1, 1) \ |
| 413 F(CompileOptimized, 2, 1) \ |
| 414 F(TryInstallOptimizedCode, 1, 1) \ |
| 415 F(NotifyDeoptimized, 1, 1) \ |
| 416 F(NotifyStubFailure, 0, 1) \ |
| 417 \ |
| 418 /* Utilities */ \ |
| 419 F(AllocateInNewSpace, 1, 1) \ |
| 420 F(AllocateInTargetSpace, 2, 1) \ |
| 421 F(AllocateHeapNumber, 0, 1) \ |
| 422 F(NumberToSmi, 1, 1) \ |
| 423 F(NumberToStringSkipCache, 1, 1) \ |
| 424 \ |
| 425 F(NewSloppyArguments, 3, 1) \ |
| 426 F(NewStrictArguments, 3, 1) \ |
| 427 \ |
| 428 /* Harmony generators */ \ |
| 429 F(CreateJSGeneratorObject, 0, 1) \ |
| 430 F(SuspendJSGeneratorObject, 1, 1) \ |
| 431 F(ResumeJSGeneratorObject, 3, 1) \ |
| 432 F(ThrowGeneratorStateError, 1, 1) \ |
| 433 \ |
| 434 /* Arrays */ \ |
| 435 F(ArrayConstructor, -1, 1) \ |
| 436 F(InternalArrayConstructor, -1, 1) \ |
| 437 \ |
| 438 /* Literals */ \ |
| 439 F(MaterializeRegExpLiteral, 4, 1)\ |
| 440 F(CreateObjectLiteral, 4, 1) \ |
| 441 F(CreateArrayLiteral, 4, 1) \ |
| 442 F(CreateArrayLiteralStubBailout, 3, 1) \ |
| 443 \ |
| 444 /* Statements */ \ |
| 445 F(NewClosure, 3, 1) \ |
| 446 F(NewClosureFromStubFailure, 1, 1) \ |
| 447 F(NewObject, 1, 1) \ |
| 448 F(NewObjectWithAllocationSite, 2, 1) \ |
| 449 F(FinalizeInstanceSize, 1, 1) \ |
| 450 F(Throw, 1, 1) \ |
| 451 F(ReThrow, 1, 1) \ |
| 452 F(ThrowReferenceError, 1, 1) \ |
| 453 F(ThrowNotDateError, 0, 1) \ |
| 454 F(StackGuard, 0, 1) \ |
| 455 F(Interrupt, 0, 1) \ |
| 456 F(PromoteScheduledException, 0, 1) \ |
| 457 \ |
| 458 /* Contexts */ \ |
| 459 F(NewGlobalContext, 2, 1) \ |
| 460 F(NewFunctionContext, 1, 1) \ |
| 461 F(PushWithContext, 2, 1) \ |
| 462 F(PushCatchContext, 3, 1) \ |
| 463 F(PushBlockContext, 2, 1) \ |
| 464 F(PushModuleContext, 2, 1) \ |
| 465 F(DeleteContextSlot, 2, 1) \ |
| 466 F(LoadContextSlot, 2, 2) \ |
| 467 F(LoadContextSlotNoReferenceError, 2, 2) \ |
| 468 F(StoreContextSlot, 4, 1) \ |
| 469 \ |
| 470 /* Declarations and initialization */ \ |
| 471 F(DeclareGlobals, 3, 1) \ |
| 472 F(DeclareModules, 1, 1) \ |
| 473 F(DeclareContextSlot, 4, 1) \ |
| 474 F(InitializeConstGlobal, 2, 1) \ |
| 475 F(InitializeConstContextSlot, 3, 1) \ |
| 476 \ |
| 477 /* Eval */ \ |
| 478 F(ResolvePossiblyDirectEval, 5, 2) \ |
| 479 \ |
| 480 /* Maths */ \ |
| 481 F(MathPowSlow, 2, 1) \ |
| 482 F(MathPowRT, 2, 1) |
| 483 |
| 484 |
400 #define RUNTIME_FUNCTION_LIST_DEBUGGER(F) \ | 485 #define RUNTIME_FUNCTION_LIST_DEBUGGER(F) \ |
401 /* Debugger support*/ \ | 486 /* Debugger support*/ \ |
402 F(DebugBreak, 0, 1) \ | 487 F(DebugBreak, 0, 1) \ |
403 F(SetDebugEventListener, 2, 1) \ | 488 F(SetDebugEventListener, 2, 1) \ |
404 F(Break, 0, 1) \ | 489 F(Break, 0, 1) \ |
405 F(DebugGetPropertyDetails, 2, 1) \ | 490 F(DebugGetPropertyDetails, 2, 1) \ |
406 F(DebugGetProperty, 2, 1) \ | 491 F(DebugGetProperty, 2, 1) \ |
407 F(DebugPropertyTypeFromDetails, 1, 1) \ | 492 F(DebugPropertyTypeFromDetails, 1, 1) \ |
408 F(DebugPropertyAttributesFromDetails, 1, 1) \ | 493 F(DebugPropertyAttributesFromDetails, 1, 1) \ |
409 F(DebugPropertyIndexFromDetails, 1, 1) \ | 494 F(DebugPropertyIndexFromDetails, 1, 1) \ |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 600 |
516 // ---------------------------------------------------------------------------- | 601 // ---------------------------------------------------------------------------- |
517 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed | 602 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed |
518 // either directly by id (via the code generator), or indirectly | 603 // either directly by id (via the code generator), or indirectly |
519 // via a native call by name (from within JS code). | 604 // via a native call by name (from within JS code). |
520 // Entries have the form F(name, number of arguments, number of return values). | 605 // Entries have the form F(name, number of arguments, number of return values). |
521 | 606 |
522 #define RUNTIME_FUNCTION_LIST(F) \ | 607 #define RUNTIME_FUNCTION_LIST(F) \ |
523 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ | 608 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
524 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ | 609 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
| 610 RUNTIME_FUNCTION_LIST_ALWAYS_3(F) \ |
525 RUNTIME_FUNCTION_LIST_DEBUG(F) \ | 611 RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
526 RUNTIME_FUNCTION_LIST_DEBUGGER(F) \ | 612 RUNTIME_FUNCTION_LIST_DEBUGGER(F) \ |
527 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) | 613 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) |
528 | 614 |
529 // RUNTIME_HIDDEN_FUNCTION_LIST defines all runtime functions accessed | |
530 // by id from code generator, but not via native call by name. | |
531 // Entries have the form F(name, number of arguments, number of return values). | |
532 #define RUNTIME_HIDDEN_FUNCTION_LIST(F) \ | |
533 /* String and Regexp */ \ | |
534 F(NumberToString, 1, 1) \ | |
535 F(RegExpConstructResult, 3, 1) \ | |
536 F(RegExpExec, 4, 1) \ | |
537 F(StringAdd, 2, 1) \ | |
538 F(SubString, 3, 1) \ | |
539 F(StringCompare, 2, 1) \ | |
540 F(StringCharCodeAt, 2, 1) \ | |
541 F(GetFromCache, 2, 1) \ | |
542 \ | |
543 /* Compilation */ \ | |
544 F(CompileUnoptimized, 1, 1) \ | |
545 F(CompileOptimized, 2, 1) \ | |
546 F(TryInstallOptimizedCode, 1, 1) \ | |
547 F(NotifyDeoptimized, 1, 1) \ | |
548 F(NotifyStubFailure, 0, 1) \ | |
549 \ | |
550 /* Utilities */ \ | |
551 F(AllocateInNewSpace, 1, 1) \ | |
552 F(AllocateInTargetSpace, 2, 1) \ | |
553 F(AllocateHeapNumber, 0, 1) \ | |
554 F(NumberToSmi, 1, 1) \ | |
555 F(NumberToStringSkipCache, 1, 1) \ | |
556 \ | |
557 F(NewSloppyArguments, 3, 1) \ | |
558 F(NewStrictArguments, 3, 1) \ | |
559 \ | |
560 /* Harmony generators */ \ | |
561 F(CreateJSGeneratorObject, 0, 1) \ | |
562 F(SuspendJSGeneratorObject, 1, 1) \ | |
563 F(ResumeJSGeneratorObject, 3, 1) \ | |
564 F(ThrowGeneratorStateError, 1, 1) \ | |
565 \ | |
566 /* Arrays */ \ | |
567 F(ArrayConstructor, -1, 1) \ | |
568 F(InternalArrayConstructor, -1, 1) \ | |
569 \ | |
570 /* Literals */ \ | |
571 F(MaterializeRegExpLiteral, 4, 1)\ | |
572 F(CreateObjectLiteral, 4, 1) \ | |
573 F(CreateArrayLiteral, 4, 1) \ | |
574 F(CreateArrayLiteralStubBailout, 3, 1) \ | |
575 \ | |
576 /* Statements */ \ | |
577 F(NewClosure, 3, 1) \ | |
578 F(NewClosureFromStubFailure, 1, 1) \ | |
579 F(NewObject, 1, 1) \ | |
580 F(NewObjectWithAllocationSite, 2, 1) \ | |
581 F(FinalizeInstanceSize, 1, 1) \ | |
582 F(Throw, 1, 1) \ | |
583 F(ReThrow, 1, 1) \ | |
584 F(ThrowReferenceError, 1, 1) \ | |
585 F(ThrowNotDateError, 0, 1) \ | |
586 F(StackGuard, 0, 1) \ | |
587 F(Interrupt, 0, 1) \ | |
588 F(PromoteScheduledException, 0, 1) \ | |
589 \ | |
590 /* Contexts */ \ | |
591 F(NewGlobalContext, 2, 1) \ | |
592 F(NewFunctionContext, 1, 1) \ | |
593 F(PushWithContext, 2, 1) \ | |
594 F(PushCatchContext, 3, 1) \ | |
595 F(PushBlockContext, 2, 1) \ | |
596 F(PushModuleContext, 2, 1) \ | |
597 F(DeleteContextSlot, 2, 1) \ | |
598 F(LoadContextSlot, 2, 2) \ | |
599 F(LoadContextSlotNoReferenceError, 2, 2) \ | |
600 F(StoreContextSlot, 4, 1) \ | |
601 \ | |
602 /* Declarations and initialization */ \ | |
603 F(DeclareGlobals, 3, 1) \ | |
604 F(DeclareModules, 1, 1) \ | |
605 F(DeclareContextSlot, 4, 1) \ | |
606 F(InitializeConstGlobal, 2, 1) \ | |
607 F(InitializeConstContextSlot, 3, 1) \ | |
608 \ | |
609 /* Eval */ \ | |
610 F(ResolvePossiblyDirectEval, 5, 2) \ | |
611 \ | |
612 /* Maths */ \ | |
613 F(MathPowSlow, 2, 1) \ | |
614 F(MathPow, 2, 1) | |
615 | |
616 // ---------------------------------------------------------------------------- | 615 // ---------------------------------------------------------------------------- |
617 // INLINE_FUNCTION_LIST defines all inlined functions accessed | 616 // INLINE_FUNCTION_LIST defines all inlined functions accessed |
618 // with a native call of the form %_name from within JS code. | 617 // with a native call of the form %_name from within JS code. |
619 // Entries have the form F(name, number of arguments, number of return values). | 618 // Entries have the form F(name, number of arguments, number of return values). |
620 #define INLINE_FUNCTION_LIST(F) \ | 619 #define INLINE_FUNCTION_LIST(F) \ |
621 F(IsSmi, 1, 1) \ | 620 F(IsSmi, 1, 1) \ |
622 F(IsNonNegativeSmi, 1, 1) \ | 621 F(IsNonNegativeSmi, 1, 1) \ |
623 F(IsArray, 1, 1) \ | 622 F(IsArray, 1, 1) \ |
624 F(IsRegExp, 1, 1) \ | 623 F(IsRegExp, 1, 1) \ |
625 F(IsConstructCall, 0, 1) \ | 624 F(IsConstructCall, 0, 1) \ |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 }; | 729 }; |
731 | 730 |
732 | 731 |
733 class Runtime : public AllStatic { | 732 class Runtime : public AllStatic { |
734 public: | 733 public: |
735 enum FunctionId { | 734 enum FunctionId { |
736 #define F(name, nargs, ressize) k##name, | 735 #define F(name, nargs, ressize) k##name, |
737 RUNTIME_FUNCTION_LIST(F) | 736 RUNTIME_FUNCTION_LIST(F) |
738 INLINE_OPTIMIZED_FUNCTION_LIST(F) | 737 INLINE_OPTIMIZED_FUNCTION_LIST(F) |
739 #undef F | 738 #undef F |
740 #define F(name, nargs, ressize) kHidden##name, | |
741 RUNTIME_HIDDEN_FUNCTION_LIST(F) | |
742 #undef F | |
743 #define F(name, nargs, ressize) kInline##name, | 739 #define F(name, nargs, ressize) kInline##name, |
744 INLINE_FUNCTION_LIST(F) | 740 INLINE_FUNCTION_LIST(F) |
745 #undef F | 741 #undef F |
746 #define F(name, nargs, ressize) kInlineOptimized##name, | 742 #define F(name, nargs, ressize) kInlineOptimized##name, |
747 INLINE_OPTIMIZED_FUNCTION_LIST(F) | 743 INLINE_OPTIMIZED_FUNCTION_LIST(F) |
748 #undef F | 744 #undef F |
749 kNumFunctions, | 745 kNumFunctions, |
750 kFirstInlineFunction = kInlineIsSmi | 746 kFirstInlineFunction = kInlineIsSmi |
751 }; | 747 }; |
752 | 748 |
753 enum IntrinsicType { | 749 enum IntrinsicType { |
754 RUNTIME, | 750 RUNTIME, |
755 RUNTIME_HIDDEN, | |
756 INLINE, | 751 INLINE, |
757 INLINE_OPTIMIZED | 752 INLINE_OPTIMIZED |
758 }; | 753 }; |
759 | 754 |
760 // Intrinsic function descriptor. | 755 // Intrinsic function descriptor. |
761 struct Function { | 756 struct Function { |
762 FunctionId function_id; | 757 FunctionId function_id; |
763 IntrinsicType intrinsic_type; | 758 IntrinsicType intrinsic_type; |
764 // The JS name of the function. | 759 // The JS name of the function. |
765 const char* name; | 760 const char* name; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; | 886 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; |
892 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; | 887 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; |
893 | 888 |
894 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; | 889 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; |
895 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; | 890 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; |
896 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; | 891 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; |
897 | 892 |
898 } } // namespace v8::internal | 893 } } // namespace v8::internal |
899 | 894 |
900 #endif // V8_RUNTIME_H_ | 895 #endif // V8_RUNTIME_H_ |
OLD | NEW |