Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Side by Side Diff: src/runtime.h

Issue 177313005: Remove duplicates in runtime macros. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 F(StringToNumber, 1, 1) \ 124 F(StringToNumber, 1, 1) \
125 F(StringParseInt, 2, 1) \ 125 F(StringParseInt, 2, 1) \
126 F(StringParseFloat, 1, 1) \ 126 F(StringParseFloat, 1, 1) \
127 F(StringToLowerCase, 1, 1) \ 127 F(StringToLowerCase, 1, 1) \
128 F(StringToUpperCase, 1, 1) \ 128 F(StringToUpperCase, 1, 1) \
129 F(StringSplit, 3, 1) \ 129 F(StringSplit, 3, 1) \
130 F(CharFromCode, 1, 1) \ 130 F(CharFromCode, 1, 1) \
131 F(URIEscape, 1, 1) \ 131 F(URIEscape, 1, 1) \
132 F(URIUnescape, 1, 1) \ 132 F(URIUnescape, 1, 1) \
133 \ 133 \
134 F(NumberToString, 1, 1) \
135 F(NumberToStringSkipCache, 1, 1) \ 134 F(NumberToStringSkipCache, 1, 1) \
136 F(NumberToInteger, 1, 1) \ 135 F(NumberToInteger, 1, 1) \
137 F(NumberToPositiveInteger, 1, 1) \ 136 F(NumberToPositiveInteger, 1, 1) \
138 F(NumberToIntegerMapMinusZero, 1, 1) \ 137 F(NumberToIntegerMapMinusZero, 1, 1) \
139 F(NumberToJSUint32, 1, 1) \ 138 F(NumberToJSUint32, 1, 1) \
140 F(NumberToJSInt32, 1, 1) \ 139 F(NumberToJSInt32, 1, 1) \
141 F(NumberToSmi, 1, 1) \ 140 F(NumberToSmi, 1, 1) \
142 F(AllocateHeapNumber, 0, 1) \ 141 F(AllocateHeapNumber, 0, 1) \
143 \ 142 \
144 /* Arithmetic operations */ \ 143 /* Arithmetic operations */ \
145 F(NumberAdd, 2, 1) \ 144 F(NumberAdd, 2, 1) \
146 F(NumberSub, 2, 1) \ 145 F(NumberSub, 2, 1) \
147 F(NumberMul, 2, 1) \ 146 F(NumberMul, 2, 1) \
148 F(NumberDiv, 2, 1) \ 147 F(NumberDiv, 2, 1) \
149 F(NumberMod, 2, 1) \ 148 F(NumberMod, 2, 1) \
150 F(NumberUnaryMinus, 1, 1) \ 149 F(NumberUnaryMinus, 1, 1) \
151 F(NumberAlloc, 0, 1) \ 150 F(NumberAlloc, 0, 1) \
152 F(NumberImul, 2, 1) \ 151 F(NumberImul, 2, 1) \
153 \ 152 \
154 F(StringAdd, 2, 1) \
155 F(StringBuilderConcat, 3, 1) \ 153 F(StringBuilderConcat, 3, 1) \
156 F(StringBuilderJoin, 3, 1) \ 154 F(StringBuilderJoin, 3, 1) \
157 F(SparseJoinWithSeparator, 3, 1) \ 155 F(SparseJoinWithSeparator, 3, 1) \
158 \ 156 \
159 /* Bit operations */ \ 157 /* Bit operations */ \
160 F(NumberOr, 2, 1) \ 158 F(NumberOr, 2, 1) \
161 F(NumberAnd, 2, 1) \ 159 F(NumberAnd, 2, 1) \
162 F(NumberXor, 2, 1) \ 160 F(NumberXor, 2, 1) \
163 \ 161 \
164 F(NumberShl, 2, 1) \ 162 F(NumberShl, 2, 1) \
165 F(NumberShr, 2, 1) \ 163 F(NumberShr, 2, 1) \
166 F(NumberSar, 2, 1) \ 164 F(NumberSar, 2, 1) \
167 \ 165 \
168 /* Comparisons */ \ 166 /* Comparisons */ \
169 F(NumberEquals, 2, 1) \ 167 F(NumberEquals, 2, 1) \
170 F(StringEquals, 2, 1) \ 168 F(StringEquals, 2, 1) \
171 \ 169 \
172 F(NumberCompare, 3, 1) \ 170 F(NumberCompare, 3, 1) \
173 F(SmiLexicographicCompare, 2, 1) \ 171 F(SmiLexicographicCompare, 2, 1) \
174 F(StringCompare, 2, 1) \
175 \ 172 \
176 /* Math */ \ 173 /* Math */ \
177 F(Math_acos, 1, 1) \ 174 F(Math_acos, 1, 1) \
178 F(Math_asin, 1, 1) \ 175 F(Math_asin, 1, 1) \
179 F(Math_atan, 1, 1) \ 176 F(Math_atan, 1, 1) \
180 F(Math_log, 1, 1) \ 177 F(Math_log, 1, 1) \
181 F(Math_cbrt, 1, 1) \ 178 F(Math_cbrt, 1, 1) \
182 F(Math_log1p, 1, 1) \ 179 F(Math_log1p, 1, 1) \
183 F(Math_expm1, 1, 1) \ 180 F(Math_expm1, 1, 1) \
184 F(Math_sqrt, 1, 1) \ 181 F(Math_sqrt, 1, 1) \
185 F(Math_exp, 1, 1) \ 182 F(Math_exp, 1, 1) \
186 F(Math_floor, 1, 1) \ 183 F(Math_floor, 1, 1) \
187 F(Math_pow, 2, 1) \ 184 F(Math_pow, 2, 1) \
188 F(Math_pow_cfunction, 2, 1) \ 185 F(Math_pow_cfunction, 2, 1) \
189 F(Math_atan2, 2, 1) \ 186 F(Math_atan2, 2, 1) \
190 F(RoundNumber, 1, 1) \ 187 F(RoundNumber, 1, 1) \
191 F(Math_fround, 1, 1) \ 188 F(Math_fround, 1, 1) \
192 \ 189 \
193 /* Regular expressions */ \ 190 /* Regular expressions */ \
194 F(RegExpCompile, 3, 1) \ 191 F(RegExpCompile, 3, 1) \
195 F(RegExpExec, 4, 1) \
196 F(RegExpExecMultiple, 4, 1) \ 192 F(RegExpExecMultiple, 4, 1) \
197 F(RegExpInitializeObject, 5, 1) \ 193 F(RegExpInitializeObject, 5, 1) \
198 F(RegExpConstructResult, 3, 1) \
199 \ 194 \
200 /* JSON */ \ 195 /* JSON */ \
201 F(ParseJson, 1, 1) \ 196 F(ParseJson, 1, 1) \
202 F(BasicJSONStringify, 1, 1) \ 197 F(BasicJSONStringify, 1, 1) \
203 F(QuoteJSONString, 1, 1) \ 198 F(QuoteJSONString, 1, 1) \
204 \ 199 \
205 /* Strings */ \ 200 /* Strings */ \
206 F(StringCharCodeAt, 2, 1) \
207 F(StringIndexOf, 3, 1) \ 201 F(StringIndexOf, 3, 1) \
208 F(StringLastIndexOf, 3, 1) \ 202 F(StringLastIndexOf, 3, 1) \
209 F(StringLocaleCompare, 2, 1) \ 203 F(StringLocaleCompare, 2, 1) \
210 F(SubString, 3, 1) \
211 F(StringReplaceGlobalRegExpWithString, 4, 1) \ 204 F(StringReplaceGlobalRegExpWithString, 4, 1) \
212 F(StringReplaceOneCharWithString, 3, 1) \ 205 F(StringReplaceOneCharWithString, 3, 1) \
213 F(StringMatch, 3, 1) \ 206 F(StringMatch, 3, 1) \
214 F(StringTrim, 3, 1) \ 207 F(StringTrim, 3, 1) \
215 F(StringToArray, 2, 1) \ 208 F(StringToArray, 2, 1) \
216 F(NewStringWrapper, 1, 1) \ 209 F(NewStringWrapper, 1, 1) \
217 F(NewString, 2, 1) \ 210 F(NewString, 2, 1) \
218 F(TruncateString, 2, 1) \ 211 F(TruncateString, 2, 1) \
219 \ 212 \
220 /* Numbers */ \ 213 /* Numbers */ \
(...skipping 22 matching lines...) Expand all
243 F(FunctionGetScript, 1, 1) \ 236 F(FunctionGetScript, 1, 1) \
244 F(FunctionGetScriptSourcePosition, 1, 1) \ 237 F(FunctionGetScriptSourcePosition, 1, 1) \
245 F(FunctionGetPositionForOffset, 2, 1) \ 238 F(FunctionGetPositionForOffset, 2, 1) \
246 F(FunctionIsAPIFunction, 1, 1) \ 239 F(FunctionIsAPIFunction, 1, 1) \
247 F(FunctionIsBuiltin, 1, 1) \ 240 F(FunctionIsBuiltin, 1, 1) \
248 F(GetScript, 1, 1) \ 241 F(GetScript, 1, 1) \
249 F(CollectStackTrace, 3, 1) \ 242 F(CollectStackTrace, 3, 1) \
250 F(GetAndClearOverflowedStackTrace, 1, 1) \ 243 F(GetAndClearOverflowedStackTrace, 1, 1) \
251 F(GetV8Version, 0, 1) \ 244 F(GetV8Version, 0, 1) \
252 \ 245 \
253 F(ClassOf, 1, 1) \
254 F(SetCode, 2, 1) \ 246 F(SetCode, 2, 1) \
255 F(SetExpectedNumberOfProperties, 2, 1) \ 247 F(SetExpectedNumberOfProperties, 2, 1) \
256 \ 248 \
257 F(CreateApiFunction, 1, 1) \ 249 F(CreateApiFunction, 1, 1) \
258 F(IsTemplate, 1, 1) \ 250 F(IsTemplate, 1, 1) \
259 F(GetTemplateField, 2, 1) \ 251 F(GetTemplateField, 2, 1) \
260 F(DisableAccessChecks, 1, 1) \ 252 F(DisableAccessChecks, 1, 1) \
261 F(EnableAccessChecks, 1, 1) \ 253 F(EnableAccessChecks, 1, 1) \
262 F(SetAccessorProperty, 6, 1) \ 254 F(SetAccessorProperty, 6, 1) \
263 \ 255 \
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 F(InitializeConstContextSlot, 3, 1) \ 433 F(InitializeConstContextSlot, 3, 1) \
442 F(OptimizeObjectForAddingMultipleProperties, 2, 1) \ 434 F(OptimizeObjectForAddingMultipleProperties, 2, 1) \
443 \ 435 \
444 /* Debugging */ \ 436 /* Debugging */ \
445 F(DebugPrint, 1, 1) \ 437 F(DebugPrint, 1, 1) \
446 F(DebugTrace, 0, 1) \ 438 F(DebugTrace, 0, 1) \
447 F(TraceEnter, 0, 1) \ 439 F(TraceEnter, 0, 1) \
448 F(TraceExit, 1, 1) \ 440 F(TraceExit, 1, 1) \
449 F(Abort, 1, 1) \ 441 F(Abort, 1, 1) \
450 F(AbortJS, 1, 1) \ 442 F(AbortJS, 1, 1) \
451 /* Logging */ \
452 F(Log, 2, 1) \
453 /* ES5 */ \ 443 /* ES5 */ \
454 F(LocalKeys, 1, 1) \ 444 F(LocalKeys, 1, 1) \
455 /* Cache suport */ \
456 F(GetFromCache, 2, 1) \
457 \ 445 \
458 /* Message objects */ \ 446 /* Message objects */ \
459 F(MessageGetStartPosition, 1, 1) \ 447 F(MessageGetStartPosition, 1, 1) \
460 F(MessageGetScript, 1, 1) \ 448 F(MessageGetScript, 1, 1) \
461 \ 449 \
462 /* Pseudo functions - handled as macros by parser */ \ 450 /* Pseudo functions - handled as macros by parser */ \
463 F(IS_VAR, 1, 1) \ 451 F(IS_VAR, 1, 1) \
464 \ 452 \
465 /* expose boolean functions from objects-inl.h */ \ 453 /* expose boolean functions from objects-inl.h */ \
466 F(HasFastSmiElements, 1, 1) \ 454 F(HasFastSmiElements, 1, 1) \
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 // ---------------------------------------------------------------------------- 592 // ----------------------------------------------------------------------------
605 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed 593 // RUNTIME_FUNCTION_LIST defines all runtime functions accessed
606 // either directly by id (via the code generator), or indirectly 594 // either directly by id (via the code generator), or indirectly
607 // via a native call by name (from within JS code). 595 // via a native call by name (from within JS code).
608 596
609 #define RUNTIME_FUNCTION_LIST(F) \ 597 #define RUNTIME_FUNCTION_LIST(F) \
610 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \ 598 RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \
611 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \ 599 RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \
612 RUNTIME_FUNCTION_LIST_DEBUG(F) \ 600 RUNTIME_FUNCTION_LIST_DEBUG(F) \
613 RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \ 601 RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \
614 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) 602 RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) \
603 INLINE_RUNTIME_FUNCTION_LIST(F)
615 604
616 // ---------------------------------------------------------------------------- 605 // ----------------------------------------------------------------------------
617 // INLINE_FUNCTION_LIST defines all inlined functions accessed 606 // INLINE_FUNCTION_LIST defines all inlined functions accessed
618 // with a native call of the form %_name from within JS code. 607 // 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). 608 // Entries have the form F(name, number of arguments, number of return values).
620 #define INLINE_FUNCTION_LIST(F) \ 609 #define INLINE_FUNCTION_LIST(F) \
621 F(IsSmi, 1, 1) \ 610 F(IsSmi, 1, 1) \
622 F(IsNonNegativeSmi, 1, 1) \ 611 F(IsNonNegativeSmi, 1, 1) \
623 F(IsArray, 1, 1) \ 612 F(IsArray, 1, 1) \
624 F(IsRegExp, 1, 1) \ 613 F(IsRegExp, 1, 1) \
(...skipping 16 matching lines...) Expand all
641 F(IsStringWrapperSafeForDefaultValueOf, 1, 1) \ 630 F(IsStringWrapperSafeForDefaultValueOf, 1, 1) \
642 F(MathPow, 2, 1) \ 631 F(MathPow, 2, 1) \
643 F(MathSqrt, 1, 1) \ 632 F(MathSqrt, 1, 1) \
644 F(MathLog, 1, 1) \ 633 F(MathLog, 1, 1) \
645 F(IsMinusZero, 1, 1) \ 634 F(IsMinusZero, 1, 1) \
646 F(HasCachedArrayIndex, 1, 1) \ 635 F(HasCachedArrayIndex, 1, 1) \
647 F(GetCachedArrayIndex, 1, 1) \ 636 F(GetCachedArrayIndex, 1, 1) \
648 F(FastAsciiArrayJoin, 2, 1) \ 637 F(FastAsciiArrayJoin, 2, 1) \
649 F(GeneratorNext, 2, 1) \ 638 F(GeneratorNext, 2, 1) \
650 F(GeneratorThrow, 2, 1) \ 639 F(GeneratorThrow, 2, 1) \
651 F(DebugBreakInOptimizedCode, 0, 1) 640 F(DebugBreakInOptimizedCode, 0, 1) \
641 INLINE_RUNTIME_FUNCTION_LIST(F)
652 642
653 643
654 // ---------------------------------------------------------------------------- 644 // ----------------------------------------------------------------------------
655 // INLINE_RUNTIME_FUNCTION_LIST defines all inlined functions accessed 645 // INLINE_RUNTIME_FUNCTION_LIST defines all inlined functions accessed
656 // with a native call of the form %_name from within JS code that also have 646 // with a native call of the form %_name from within JS code that also have
657 // a corresponding runtime function, that is called for slow cases. 647 // a corresponding runtime function, that is called for slow cases.
658 // Entries have the form F(name, number of arguments, number of return values). 648 // Entries have the form F(name, number of arguments, number of return values).
659 #define INLINE_RUNTIME_FUNCTION_LIST(F) \ 649 #define INLINE_RUNTIME_FUNCTION_LIST(F) \
660 F(ClassOf, 1, 1) \ 650 F(ClassOf, 1, 1) \
661 F(StringCharCodeAt, 2, 1) \ 651 F(StringCharCodeAt, 2, 1) \
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 705
716 706
717 class Runtime : public AllStatic { 707 class Runtime : public AllStatic {
718 public: 708 public:
719 enum FunctionId { 709 enum FunctionId {
720 #define F(name, nargs, ressize) k##name, 710 #define F(name, nargs, ressize) k##name,
721 RUNTIME_FUNCTION_LIST(F) 711 RUNTIME_FUNCTION_LIST(F)
722 #undef F 712 #undef F
723 #define F(name, nargs, ressize) kInline##name, 713 #define F(name, nargs, ressize) kInline##name,
724 INLINE_FUNCTION_LIST(F) 714 INLINE_FUNCTION_LIST(F)
725 INLINE_RUNTIME_FUNCTION_LIST(F)
726 #undef F 715 #undef F
727 kNumFunctions, 716 kNumFunctions,
728 kFirstInlineFunction = kInlineIsSmi 717 kFirstInlineFunction = kInlineIsSmi
729 }; 718 };
730 719
731 enum IntrinsicType { 720 enum IntrinsicType {
732 RUNTIME, 721 RUNTIME,
733 INLINE 722 INLINE
734 }; 723 };
735 724
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {}; 862 class AllocateDoubleAlignFlag: public BitField<bool, 0, 1> {};
874 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {}; 863 class AllocateTargetSpace: public BitField<AllocationSpace, 1, 3> {};
875 864
876 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {}; 865 class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {};
877 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {}; 866 class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {};
878 class DeclareGlobalsLanguageMode: public BitField<LanguageMode, 2, 2> {}; 867 class DeclareGlobalsLanguageMode: public BitField<LanguageMode, 2, 2> {};
879 868
880 } } // namespace v8::internal 869 } } // namespace v8::internal
881 870
882 #endif // V8_RUNTIME_H_ 871 #endif // V8_RUNTIME_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698