Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 F(URIEscape, 1, 1) \ | 130 F(URIEscape, 1, 1) \ |
| 131 F(URIUnescape, 1, 1) \ | 131 F(URIUnescape, 1, 1) \ |
| 132 \ | 132 \ |
| 133 F(NumberToStringSkipCache, 1, 1) \ | 133 F(NumberToStringSkipCache, 1, 1) \ |
| 134 F(NumberToInteger, 1, 1) \ | 134 F(NumberToInteger, 1, 1) \ |
| 135 F(NumberToPositiveInteger, 1, 1) \ | 135 F(NumberToPositiveInteger, 1, 1) \ |
| 136 F(NumberToIntegerMapMinusZero, 1, 1) \ | 136 F(NumberToIntegerMapMinusZero, 1, 1) \ |
| 137 F(NumberToJSUint32, 1, 1) \ | 137 F(NumberToJSUint32, 1, 1) \ |
| 138 F(NumberToJSInt32, 1, 1) \ | 138 F(NumberToJSInt32, 1, 1) \ |
| 139 F(NumberToSmi, 1, 1) \ | 139 F(NumberToSmi, 1, 1) \ |
| 140 F(NumberToStringInternal, 1, 1) \ | |
| 140 F(AllocateHeapNumber, 0, 1) \ | 141 F(AllocateHeapNumber, 0, 1) \ |
| 141 \ | 142 \ |
| 142 /* Arithmetic operations */ \ | 143 /* Arithmetic operations */ \ |
| 143 F(NumberAdd, 2, 1) \ | 144 F(NumberAdd, 2, 1) \ |
| 144 F(NumberSub, 2, 1) \ | 145 F(NumberSub, 2, 1) \ |
| 145 F(NumberMul, 2, 1) \ | 146 F(NumberMul, 2, 1) \ |
| 146 F(NumberDiv, 2, 1) \ | 147 F(NumberDiv, 2, 1) \ |
| 147 F(NumberMod, 2, 1) \ | 148 F(NumberMod, 2, 1) \ |
| 148 F(NumberUnaryMinus, 1, 1) \ | 149 F(NumberUnaryMinus, 1, 1) \ |
| 149 F(NumberAlloc, 0, 1) \ | 150 F(NumberAlloc, 0, 1) \ |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 180 F(Math_pow, 2, 1) \ | 181 F(Math_pow, 2, 1) \ |
| 181 F(Math_pow_cfunction, 2, 1) \ | 182 F(Math_pow_cfunction, 2, 1) \ |
| 182 F(Math_atan2, 2, 1) \ | 183 F(Math_atan2, 2, 1) \ |
| 183 F(RoundNumber, 1, 1) \ | 184 F(RoundNumber, 1, 1) \ |
| 184 F(Math_fround, 1, 1) \ | 185 F(Math_fround, 1, 1) \ |
| 185 \ | 186 \ |
| 186 /* Regular expressions */ \ | 187 /* Regular expressions */ \ |
| 187 F(RegExpCompile, 3, 1) \ | 188 F(RegExpCompile, 3, 1) \ |
| 188 F(RegExpExecMultiple, 4, 1) \ | 189 F(RegExpExecMultiple, 4, 1) \ |
| 189 F(RegExpInitializeObject, 5, 1) \ | 190 F(RegExpInitializeObject, 5, 1) \ |
| 191 F(RegExpConstructResultInternal, 3, 1) \ | |
| 192 F(RegExpExecInternal, 4, 1) \ | |
| 190 \ | 193 \ |
| 191 /* JSON */ \ | 194 /* JSON */ \ |
| 192 F(ParseJson, 1, 1) \ | 195 F(ParseJson, 1, 1) \ |
| 193 F(BasicJSONStringify, 1, 1) \ | 196 F(BasicJSONStringify, 1, 1) \ |
| 194 F(QuoteJSONString, 1, 1) \ | 197 F(QuoteJSONString, 1, 1) \ |
| 195 \ | 198 \ |
| 196 /* Strings */ \ | 199 /* Strings */ \ |
| 197 F(StringIndexOf, 3, 1) \ | 200 F(StringIndexOf, 3, 1) \ |
| 198 F(StringLastIndexOf, 3, 1) \ | 201 F(StringLastIndexOf, 3, 1) \ |
| 199 F(StringLocaleCompare, 2, 1) \ | 202 F(StringLocaleCompare, 2, 1) \ |
| 200 F(StringReplaceGlobalRegExpWithString, 4, 1) \ | 203 F(StringReplaceGlobalRegExpWithString, 4, 1) \ |
| 201 F(StringReplaceOneCharWithString, 3, 1) \ | 204 F(StringReplaceOneCharWithString, 3, 1) \ |
| 202 F(StringMatch, 3, 1) \ | 205 F(StringMatch, 3, 1) \ |
| 203 F(StringTrim, 3, 1) \ | 206 F(StringTrim, 3, 1) \ |
| 204 F(StringToArray, 2, 1) \ | 207 F(StringToArray, 2, 1) \ |
| 205 F(NewStringWrapper, 1, 1) \ | 208 F(NewStringWrapper, 1, 1) \ |
| 206 F(NewString, 2, 1) \ | 209 F(NewString, 2, 1) \ |
| 207 F(TruncateString, 2, 1) \ | 210 F(TruncateString, 2, 1) \ |
| 211 F(StringAddInternal, 2, 1) \ | |
| 212 F(SubStringInternal, 3, 1) \ | |
| 213 F(StringCompareInternal, 2, 1) \ | |
| 214 F(StringCharCodeAtInternal, 2, 1) \ | |
| 208 \ | 215 \ |
| 209 /* Numbers */ \ | 216 /* Numbers */ \ |
| 210 F(NumberToRadixString, 2, 1) \ | 217 F(NumberToRadixString, 2, 1) \ |
| 211 F(NumberToFixed, 2, 1) \ | 218 F(NumberToFixed, 2, 1) \ |
| 212 F(NumberToExponential, 2, 1) \ | 219 F(NumberToExponential, 2, 1) \ |
| 213 F(NumberToPrecision, 2, 1) \ | 220 F(NumberToPrecision, 2, 1) \ |
| 214 F(IsValidSmi, 1, 1) | 221 F(IsValidSmi, 1, 1) |
| 215 | 222 |
| 216 | 223 |
| 217 #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ | 224 #define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 F(DateToUTC, 1, 1) \ | 263 F(DateToUTC, 1, 1) \ |
| 257 F(DateMakeDay, 2, 1) \ | 264 F(DateMakeDay, 2, 1) \ |
| 258 F(DateSetValue, 3, 1) \ | 265 F(DateSetValue, 3, 1) \ |
| 259 F(DateCacheVersion, 0, 1) \ | 266 F(DateCacheVersion, 0, 1) \ |
| 260 \ | 267 \ |
| 261 /* Numbers */ \ | 268 /* Numbers */ \ |
| 262 \ | 269 \ |
| 263 /* Globals */ \ | 270 /* Globals */ \ |
| 264 F(CompileString, 2, 1) \ | 271 F(CompileString, 2, 1) \ |
| 265 F(GlobalPrint, 1, 1) \ | 272 F(GlobalPrint, 1, 1) \ |
| 273 F(LogInternal, 3, 1) \ | |
| 274 F(GetFromCacheInternal, 2, 1) \ | |
| 266 \ | 275 \ |
| 267 /* Eval */ \ | 276 /* Eval */ \ |
| 268 F(GlobalReceiver, 1, 1) \ | 277 F(GlobalReceiver, 1, 1) \ |
| 269 F(IsAttachedGlobal, 1, 1) \ | 278 F(IsAttachedGlobal, 1, 1) \ |
| 270 F(ResolvePossiblyDirectEval, 5, 2) \ | 279 F(ResolvePossiblyDirectEval, 5, 2) \ |
| 271 \ | 280 \ |
| 272 F(SetProperty, -1 /* 4 or 5 */, 1) \ | 281 F(SetProperty, -1 /* 4 or 5 */, 1) \ |
| 273 F(DefineOrRedefineDataProperty, 4, 1) \ | 282 F(DefineOrRedefineDataProperty, 4, 1) \ |
| 274 F(DefineOrRedefineAccessorProperty, 5, 1) \ | 283 F(DefineOrRedefineAccessorProperty, 5, 1) \ |
| 275 F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */, 1) \ | 284 F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */, 1) \ |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 593 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed | 602 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed |
| 594 // either directly by id (via the code generator), or indirectly | 603 // either directly by id (via the code generator), or indirectly |
| 595 // via a native call by name (from within JS code). | 604 // via a native call by name (from within JS code). |
| 596 | 605 |
| 597 #define RUNTIME_FUNCTION_LIST(F) \ | 606 #define RUNTIME_FUNCTION_LIST(F) \ |
| 598 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ | 607 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ |
| 599 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ | 608 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ |
| 600 RUNTIME_FUNCTION_LIST_DEBUG(F) \ | 609 RUNTIME_FUNCTION_LIST_DEBUG(F) \ |
| 601 RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ | 610 RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ |
| 602 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) \ | 611 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) \ |
| 603 INLINE_RUNTIME_FUNCTION_LIST(F) | 612 INLINE_OPTIMIZED_FUNCTION_LIST(F) |
| 604 | 613 |
| 605 // ---------------------------------------------------------------------------- | 614 // ---------------------------------------------------------------------------- |
| 606 // INLINE_FUNCTION_LIST defines all inlined functions accessed | 615 // INLINE_FUNCTION_LIST defines all inlined functions accessed |
| 607 // with a native call of the form %_name from within JS code. | 616 // with a native call of the form %_name from within JS code. |
| 608 // Entries have the form F(name, number of arguments, number of return values). | 617 // Entries have the form F(name, number of arguments, number of return values). |
| 609 #define INLINE_FUNCTION_LIST(F) \ | 618 #define INLINE_FUNCTION_LIST(F) \ |
| 610 F(IsSmi, 1, 1) \ | 619 F(IsSmi, 1, 1) \ |
| 611 F(IsNonNegativeSmi, 1, 1) \ | 620 F(IsNonNegativeSmi, 1, 1) \ |
| 612 F(IsArray, 1, 1) \ | 621 F(IsArray, 1, 1) \ |
| 613 F(IsRegExp, 1, 1) \ | 622 F(IsRegExp, 1, 1) \ |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 631 F(MathPow, 2, 1) \ | 640 F(MathPow, 2, 1) \ |
| 632 F(MathSqrt, 1, 1) \ | 641 F(MathSqrt, 1, 1) \ |
| 633 F(MathLog, 1, 1) \ | 642 F(MathLog, 1, 1) \ |
| 634 F(IsMinusZero, 1, 1) \ | 643 F(IsMinusZero, 1, 1) \ |
| 635 F(HasCachedArrayIndex, 1, 1) \ | 644 F(HasCachedArrayIndex, 1, 1) \ |
| 636 F(GetCachedArrayIndex, 1, 1) \ | 645 F(GetCachedArrayIndex, 1, 1) \ |
| 637 F(FastAsciiArrayJoin, 2, 1) \ | 646 F(FastAsciiArrayJoin, 2, 1) \ |
| 638 F(GeneratorNext, 2, 1) \ | 647 F(GeneratorNext, 2, 1) \ |
| 639 F(GeneratorThrow, 2, 1) \ | 648 F(GeneratorThrow, 2, 1) \ |
| 640 F(DebugBreakInOptimizedCode, 0, 1) \ | 649 F(DebugBreakInOptimizedCode, 0, 1) \ |
| 641 INLINE_RUNTIME_FUNCTION_LIST(F) | |
| 642 | |
| 643 | |
| 644 // ---------------------------------------------------------------------------- | |
| 645 // INLINE_RUNTIME_FUNCTION_LIST defines all inlined functions accessed | |
| 646 // with a native call of the form %_name from within JS code that also have | |
| 647 // a corresponding runtime function, that is called for slow cases. | |
| 648 // Entries have the form F(name, number of arguments, number of return values). | |
| 649 #define INLINE_RUNTIME_FUNCTION_LIST(F) \ | |
|
Yang
2014/03/24 14:04:02
Entries in this list are expanded to kFoo and kInl
| |
| 650 F(ClassOf, 1, 1) \ | 650 F(ClassOf, 1, 1) \ |
| 651 F(StringCharCodeAt, 2, 1) \ | 651 F(StringCharCodeAt, 2, 1) \ |
| 652 F(Log, 3, 1) \ | 652 F(Log, 3, 1) \ |
| 653 F(StringAdd, 2, 1) \ | 653 F(StringAdd, 2, 1) \ |
| 654 F(SubString, 3, 1) \ | 654 F(SubString, 3, 1) \ |
| 655 F(StringCompare, 2, 1) \ | 655 F(StringCompare, 2, 1) \ |
| 656 F(RegExpExec, 4, 1) \ | 656 F(RegExpExec, 4, 1) \ |
| 657 F(RegExpConstructResult, 3, 1) \ | 657 F(RegExpConstructResult, 3, 1) \ |
| 658 F(GetFromCache, 2, 1) \ | 658 F(GetFromCache, 2, 1) \ |
| 659 F(NumberToString, 1, 1) \ | 659 F(NumberToString, 1, 1) |
| 660 | |
| 661 | |
| 662 // ---------------------------------------------------------------------------- | |
| 663 // INLINE_OPTIMIZED_FUNCTION_LIST defines all inlined functions accessed | |
| 664 // with a native call of the form %_name from within JS code that also have | |
| 665 // a corresponding runtime function, that is called from non-optimized code. | |
| 666 // Entries have the form F(name, number of arguments, number of return values). | |
| 667 #define INLINE_OPTIMIZED_FUNCTION_LIST(F) \ | |
| 660 F(DoubleHi, 1, 1) \ | 668 F(DoubleHi, 1, 1) \ |
| 661 F(DoubleLo, 1, 1) \ | 669 F(DoubleLo, 1, 1) \ |
| 662 F(ConstructDouble, 2, 1) \ | 670 F(ConstructDouble, 2, 1) \ |
| 663 F(TypedArrayInitialize, 5, 1) \ | 671 F(TypedArrayInitialize, 5, 1) \ |
| 664 F(DataViewInitialize, 4, 1) \ | 672 F(DataViewInitialize, 4, 1) \ |
| 665 F(MaxSmi, 0, 1) | 673 F(MaxSmi, 0, 1) |
| 666 | 674 |
| 667 | 675 |
| 668 //--------------------------------------------------------------------------- | 676 //--------------------------------------------------------------------------- |
| 669 // Runtime provides access to all C++ runtime functions. | 677 // Runtime provides access to all C++ runtime functions. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 712 | 720 |
| 713 class Runtime : public AllStatic { | 721 class Runtime : public AllStatic { |
| 714 public: | 722 public: |
| 715 enum FunctionId { | 723 enum FunctionId { |
| 716 #define F(name, nargs, ressize) k##name, | 724 #define F(name, nargs, ressize) k##name, |
| 717 RUNTIME_FUNCTION_LIST(F) | 725 RUNTIME_FUNCTION_LIST(F) |
| 718 #undef F | 726 #undef F |
| 719 #define F(name, nargs, ressize) kInline##name, | 727 #define F(name, nargs, ressize) kInline##name, |
| 720 INLINE_FUNCTION_LIST(F) | 728 INLINE_FUNCTION_LIST(F) |
| 721 #undef F | 729 #undef F |
| 730 #define F(name, nargs, ressize) kInlineOptimized##name, | |
| 731 INLINE_OPTIMIZED_FUNCTION_LIST(F) | |
| 732 #undef F | |
| 722 kNumFunctions, | 733 kNumFunctions, |
| 723 kFirstInlineFunction = kInlineIsSmi | 734 kFirstInlineFunction = kInlineIsSmi |
| 724 }; | 735 }; |
| 725 | 736 |
| 726 enum IntrinsicType { | 737 enum IntrinsicType { |
| 727 RUNTIME, | 738 RUNTIME, |
| 728 INLINE | 739 INLINE, |
| 740 INLINE_OPTIMIZED | |
| 729 }; | 741 }; |
| 730 | 742 |
| 731 // Intrinsic function descriptor. | 743 // Intrinsic function descriptor. |
| 732 struct Function { | 744 struct Function { |
| 733 FunctionId function_id; | 745 FunctionId function_id; |
| 734 IntrinsicType intrinsic_type; | 746 IntrinsicType intrinsic_type; |
| 735 // The JS name of the function. | 747 // The JS name of the function. |
| 736 const char* name; | 748 const char* name; |
| 737 | 749 |
| 738 // The C++ (native) entry point. NULL if the function is inlined. | 750 // The C++ (native) entry point. NULL if the function is inlined. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 870 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; | 882 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; |
| 871 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; | 883 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; |
| 872 | 884 |
| 873 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; | 885 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; |
| 874 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; | 886 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; |
| 875 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; | 887 class DeclareGlobalsStrictMode: public BitField<StrictMode, 2, 1> {}; |
| 876 | 888 |
| 877 } } // namespace v8::internal | 889 } } // namespace v8::internal |
| 878 | 890 |
| 879 #endif // V8_RUNTIME_H_ | 891 #endif // V8_RUNTIME_H_ |
| OLD | NEW |