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

Side by Side Diff: src/builtins/builtins.h

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap Created 3 years, 11 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
« no previous file with comments | « src/bootstrapper.cc ('k') | src/builtins/builtins-async.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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_BUILTINS_BUILTINS_H_ 5 #ifndef V8_BUILTINS_BUILTINS_H_
6 #define V8_BUILTINS_BUILTINS_H_ 6 #define V8_BUILTINS_BUILTINS_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 TFS(FastCloneShallowObject5, BUILTIN, kNoExtraICState, \ 112 TFS(FastCloneShallowObject5, BUILTIN, kNoExtraICState, \
113 FastCloneShallowObject) \ 113 FastCloneShallowObject) \
114 TFS(FastCloneShallowObject6, BUILTIN, kNoExtraICState, \ 114 TFS(FastCloneShallowObject6, BUILTIN, kNoExtraICState, \
115 FastCloneShallowObject) \ 115 FastCloneShallowObject) \
116 \ 116 \
117 /* Apply and entries */ \ 117 /* Apply and entries */ \
118 ASM(Apply) \ 118 ASM(Apply) \
119 ASM(JSEntryTrampoline) \ 119 ASM(JSEntryTrampoline) \
120 ASM(JSConstructEntryTrampoline) \ 120 ASM(JSConstructEntryTrampoline) \
121 ASM(ResumeGeneratorTrampoline) \ 121 ASM(ResumeGeneratorTrampoline) \
122 ASM(ResumeAwaitedGeneratorTrampoline) \
122 \ 123 \
123 /* Stack and interrupt check */ \ 124 /* Stack and interrupt check */ \
124 ASM(InterruptCheck) \ 125 ASM(InterruptCheck) \
125 ASM(StackCheck) \ 126 ASM(StackCheck) \
126 \ 127 \
127 /* String helpers */ \ 128 /* String helpers */ \
128 TFS(StringEqual, BUILTIN, kNoExtraICState, Compare) \ 129 TFS(StringEqual, BUILTIN, kNoExtraICState, Compare) \
129 TFS(StringNotEqual, BUILTIN, kNoExtraICState, Compare) \ 130 TFS(StringNotEqual, BUILTIN, kNoExtraICState, Compare) \
130 TFS(StringLessThan, BUILTIN, kNoExtraICState, Compare) \ 131 TFS(StringLessThan, BUILTIN, kNoExtraICState, Compare) \
131 TFS(StringLessThanOrEqual, BUILTIN, kNoExtraICState, Compare) \ 132 TFS(StringLessThanOrEqual, BUILTIN, kNoExtraICState, Compare) \
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 TFJ(TypedArrayPrototypeByteLength, 0) \ 765 TFJ(TypedArrayPrototypeByteLength, 0) \
765 /* ES6 section 22.2.3.3 get %TypedArray%.prototype.byteOffset */ \ 766 /* ES6 section 22.2.3.3 get %TypedArray%.prototype.byteOffset */ \
766 TFJ(TypedArrayPrototypeByteOffset, 0) \ 767 TFJ(TypedArrayPrototypeByteOffset, 0) \
767 /* ES6 section 22.2.3.18 get %TypedArray%.prototype.length */ \ 768 /* ES6 section 22.2.3.18 get %TypedArray%.prototype.length */ \
768 TFJ(TypedArrayPrototypeLength, 0) \ 769 TFJ(TypedArrayPrototypeLength, 0) \
769 /* ES6 #sec-%typedarray%.prototype.entries */ \ 770 /* ES6 #sec-%typedarray%.prototype.entries */ \
770 TFJ(TypedArrayPrototypeEntries, 0) \ 771 TFJ(TypedArrayPrototypeEntries, 0) \
771 /* ES6 #sec-%typedarray%.prototype.keys */ \ 772 /* ES6 #sec-%typedarray%.prototype.keys */ \
772 TFJ(TypedArrayPrototypeKeys, 0) \ 773 TFJ(TypedArrayPrototypeKeys, 0) \
773 /* ES6 #sec-%typedarray%.prototype.values */ \ 774 /* ES6 #sec-%typedarray%.prototype.values */ \
774 TFJ(TypedArrayPrototypeValues, 0) 775 TFJ(TypedArrayPrototypeValues, 0) \
776 \
777 /* AsyncGenerator builtins */ \
778 \
779 /* AsyncGeneratorFunction( p1, p2, ... pn, body ) */ \
780 /* proposal-async-iteration/#sec-asyncgeneratorfunction-constructor */ \
781 CPP(AsyncGeneratorFunctionConstructor) \
782 /* AsyncGenerator.prototype.next ( value ) */ \
783 /* proposal-async-iteration/#sec-asyncgenerator-prototype-next */ \
784 TFJ(AsyncGeneratorPrototypeNext, 1) \
785 /* AsyncGenerator.prototype.return ( value ) */ \
786 /* proposal-async-iteration/#sec-asyncgenerator-prototype-return */ \
787 TFJ(AsyncGeneratorPrototypeReturn, 1) \
788 /* AsyncGenerator.prototype.throw ( exception ) */ \
789 /* proposal-async-iteration/#sec-asyncgenerator-prototype-throw */ \
790 TFJ(AsyncGeneratorPrototypeThrow, 1) \
791 \
792 /* Await (proposal-async-iteration/#await), with resume behaviour */ \
793 /* specific to Async Generators. Internal / Not exposed to JS code. */ \
794 TFJ(AsyncGeneratorAwaitCaught, 2) \
795 TFJ(AsyncGeneratorAwaitUncaught, 2) \
796 TFJ(AsyncGeneratorAwaitResolveClosure, 1) \
797 TFJ(AsyncGeneratorAwaitRejectClosure, 1) \
798 \
799 /* GeneratorYield (proposal-async-iteration/#sec-generatoryield) with */ \
800 /* resume behaviour specific to Async Generators. Internal / not exposed */ \
801 /* to JS code. */ \
802 TFJ(AsyncGeneratorYield, 1) \
803 TFJ(AsyncGeneratorRawYield, 1) \
804 \
805 /* Async-from-Sync Iterator builtins */ \
806 \
807 /* %AsyncFromSyncIteratorPrototype% */ \
808 /* (proposal-async-iteration/#sec-%asyncfromsynciteratorprototype%-object)*/ \
809 TFJ(AsyncFromSyncIteratorPrototypeNext, 1) \
810 TFJ(AsyncFromSyncIteratorPrototypeThrow, 1) \
811 TFJ(AsyncFromSyncIteratorPrototypeReturn, 1) \
812 \
813 /* proposal-async-iteration/#sec-async-iterator-value-unwrap-functions */ \
814 TFJ(AsyncIteratorValueUnwrap, 1)
775 815
776 #define IGNORE_BUILTIN(...) 816 #define IGNORE_BUILTIN(...)
777 817
778 #define BUILTIN_LIST_ALL(V) BUILTIN_LIST(V, V, V, V, V, V, V) 818 #define BUILTIN_LIST_ALL(V) BUILTIN_LIST(V, V, V, V, V, V, V)
779 819
780 #define BUILTIN_LIST_C(V) \ 820 #define BUILTIN_LIST_C(V) \
781 BUILTIN_LIST(V, V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ 821 BUILTIN_LIST(V, V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
782 IGNORE_BUILTIN, IGNORE_BUILTIN) 822 IGNORE_BUILTIN, IGNORE_BUILTIN)
783 823
784 #define BUILTIN_LIST_A(V) \ 824 #define BUILTIN_LIST_A(V) \
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode, 928 static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode,
889 TailCallMode tail_call_mode); 929 TailCallMode tail_call_mode);
890 930
891 static void Generate_InterpreterPushArgsAndCallImpl( 931 static void Generate_InterpreterPushArgsAndCallImpl(
892 MacroAssembler* masm, TailCallMode tail_call_mode, 932 MacroAssembler* masm, TailCallMode tail_call_mode,
893 CallableType function_type); 933 CallableType function_type);
894 934
895 static void Generate_InterpreterPushArgsAndConstructImpl( 935 static void Generate_InterpreterPushArgsAndConstructImpl(
896 MacroAssembler* masm, CallableType function_type); 936 MacroAssembler* masm, CallableType function_type);
897 937
938 enum class ResumeGeneratorType {
939 kYield, // Resume generator after Yield
940 kAwait // Resume async generator after Await
941 };
942 static void Generate_ResumeGenerator(MacroAssembler* masm,
943 ResumeGeneratorType type);
944
898 enum class MathMaxMinKind { kMax, kMin }; 945 enum class MathMaxMinKind { kMax, kMin };
899 static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind); 946 static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind);
900 947
901 #define DECLARE_ASM(Name, ...) \ 948 #define DECLARE_ASM(Name, ...) \
902 static void Generate_##Name(MacroAssembler* masm); 949 static void Generate_##Name(MacroAssembler* masm);
903 #define DECLARE_TF(Name, ...) \ 950 #define DECLARE_TF(Name, ...) \
904 static void Generate_##Name(compiler::CodeAssemblerState* state); 951 static void Generate_##Name(compiler::CodeAssemblerState* state);
905 952
906 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF, 953 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF,
907 DECLARE_ASM, DECLARE_ASM, DECLARE_ASM) 954 DECLARE_ASM, DECLARE_ASM, DECLARE_ASM)
908 955
909 #undef DECLARE_ASM 956 #undef DECLARE_ASM
910 #undef DECLARE_TF 957 #undef DECLARE_TF
911 958
912 // Note: These are always Code objects, but to conform with 959 // Note: These are always Code objects, but to conform with
913 // IterateBuiltins() above which assumes Object**'s for the callback 960 // IterateBuiltins() above which assumes Object**'s for the callback
914 // function f, we use an Object* array here. 961 // function f, we use an Object* array here.
915 Object* builtins_[builtin_count]; 962 Object* builtins_[builtin_count];
916 bool initialized_; 963 bool initialized_;
917 964
918 friend class Isolate; 965 friend class Isolate;
919 966
920 DISALLOW_COPY_AND_ASSIGN(Builtins); 967 DISALLOW_COPY_AND_ASSIGN(Builtins);
921 }; 968 };
922 969
923 } // namespace internal 970 } // namespace internal
924 } // namespace v8 971 } // namespace v8
925 972
926 #endif // V8_BUILTINS_BUILTINS_H_ 973 #endif // V8_BUILTINS_BUILTINS_H_
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/builtins/builtins-async.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698