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

Side by Side Diff: src/builtins.h

Issue 1491883002: [builtins] Some refactoring on the builtin mechanism. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/arm64/builtins-arm64.cc ('k') | src/builtins.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 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_H_ 5 #ifndef V8_BUILTINS_H_
6 #define V8_BUILTINS_H_ 6 #define V8_BUILTINS_H_
7 7
8 #include "src/base/flags.h"
8 #include "src/handles.h" 9 #include "src/handles.h"
9 10
10 namespace v8 { 11 namespace v8 {
11 namespace internal { 12 namespace internal {
12 13
13 // Specifies extra arguments required by a C++ builtin. 14 // Specifies extra arguments required by a C++ builtin.
14 enum BuiltinExtraArguments { 15 enum class BuiltinExtraArguments : uint8_t {
15 NO_EXTRA_ARGUMENTS = 0, 16 kNone = 0u,
16 NEEDS_CALLED_FUNCTION = 1 17 kTarget = 1u << 0,
18 kNewTarget = 1u << 1,
19 kTargetAndNewTarget = kTarget | kNewTarget
17 }; 20 };
18 21
22 inline bool operator&(BuiltinExtraArguments lhs, BuiltinExtraArguments rhs) {
23 return static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs);
24 }
25
19 26
20 #define CODE_AGE_LIST_WITH_ARG(V, A) \ 27 #define CODE_AGE_LIST_WITH_ARG(V, A) \
21 V(Quadragenarian, A) \ 28 V(Quadragenarian, A) \
22 V(Quinquagenarian, A) \ 29 V(Quinquagenarian, A) \
23 V(Sexagenarian, A) \ 30 V(Sexagenarian, A) \
24 V(Septuagenarian, A) \ 31 V(Septuagenarian, A) \
25 V(Octogenarian, A) 32 V(Octogenarian, A)
26 33
27 #define CODE_AGE_LIST_IGNORE_ARG(X, V) V(X) 34 #define CODE_AGE_LIST_IGNORE_ARG(X, V) V(X)
28 35
29 #define CODE_AGE_LIST(V) \ 36 #define CODE_AGE_LIST(V) \
30 CODE_AGE_LIST_WITH_ARG(CODE_AGE_LIST_IGNORE_ARG, V) 37 CODE_AGE_LIST_WITH_ARG(CODE_AGE_LIST_IGNORE_ARG, V)
31 38
32 #define CODE_AGE_LIST_COMPLETE(V) \ 39 #define CODE_AGE_LIST_COMPLETE(V) \
33 V(ToBeExecutedOnce) \ 40 V(ToBeExecutedOnce) \
34 V(NotExecuted) \ 41 V(NotExecuted) \
35 V(ExecutedOnce) \ 42 V(ExecutedOnce) \
36 V(NoAge) \ 43 V(NoAge) \
37 CODE_AGE_LIST_WITH_ARG(CODE_AGE_LIST_IGNORE_ARG, V) 44 CODE_AGE_LIST_WITH_ARG(CODE_AGE_LIST_IGNORE_ARG, V)
38 45
39 #define DECLARE_CODE_AGE_BUILTIN(C, V) \ 46 #define DECLARE_CODE_AGE_BUILTIN(C, V) \
40 V(Make##C##CodeYoungAgainOddMarking, BUILTIN, \ 47 V(Make##C##CodeYoungAgainOddMarking, BUILTIN, \
41 UNINITIALIZED, kNoExtraICState) \ 48 UNINITIALIZED, kNoExtraICState) \
42 V(Make##C##CodeYoungAgainEvenMarking, BUILTIN, \ 49 V(Make##C##CodeYoungAgainEvenMarking, BUILTIN, \
43 UNINITIALIZED, kNoExtraICState) 50 UNINITIALIZED, kNoExtraICState)
44 51
45 52
46 // Define list of builtins implemented in C++. 53 // Define list of builtins implemented in C++.
47 #define BUILTIN_LIST_C(V) \ 54 #define BUILTIN_LIST_C(V) \
48 V(Illegal, NO_EXTRA_ARGUMENTS) \ 55 V(Illegal, kNone) \
49 \ 56 \
50 V(EmptyFunction, NO_EXTRA_ARGUMENTS) \ 57 V(EmptyFunction, kNone) \
51 \ 58 \
52 V(ArrayPush, NO_EXTRA_ARGUMENTS) \ 59 V(ArrayPush, kNone) \
53 V(ArrayPop, NO_EXTRA_ARGUMENTS) \ 60 V(ArrayPop, kNone) \
54 V(ArrayShift, NO_EXTRA_ARGUMENTS) \ 61 V(ArrayShift, kNone) \
55 V(ArrayUnshift, NO_EXTRA_ARGUMENTS) \ 62 V(ArrayUnshift, kNone) \
56 V(ArraySlice, NO_EXTRA_ARGUMENTS) \ 63 V(ArraySlice, kNone) \
57 V(ArraySplice, NO_EXTRA_ARGUMENTS) \ 64 V(ArraySplice, kNone) \
58 V(ArrayConcat, NO_EXTRA_ARGUMENTS) \ 65 V(ArrayConcat, kNone) \
59 \ 66 \
60 V(DateToPrimitive, NO_EXTRA_ARGUMENTS) \ 67 V(DateToPrimitive, kNone) \
61 \ 68 \
62 V(ReflectDefineProperty, NO_EXTRA_ARGUMENTS) \ 69 V(ReflectDefineProperty, kNone) \
63 V(ReflectDeleteProperty, NO_EXTRA_ARGUMENTS) \ 70 V(ReflectDeleteProperty, kNone) \
64 V(ReflectGet, NO_EXTRA_ARGUMENTS) \ 71 V(ReflectGet, kNone) \
65 V(ReflectGetOwnPropertyDescriptor, NO_EXTRA_ARGUMENTS) \ 72 V(ReflectGetOwnPropertyDescriptor, kNone) \
66 V(ReflectGetPrototypeOf, NO_EXTRA_ARGUMENTS) \ 73 V(ReflectGetPrototypeOf, kNone) \
67 V(ReflectHas, NO_EXTRA_ARGUMENTS) \ 74 V(ReflectHas, kNone) \
68 V(ReflectIsExtensible, NO_EXTRA_ARGUMENTS) \ 75 V(ReflectIsExtensible, kNone) \
69 V(ReflectOwnKeys, NO_EXTRA_ARGUMENTS) \ 76 V(ReflectOwnKeys, kNone) \
70 V(ReflectPreventExtensions, NO_EXTRA_ARGUMENTS) \ 77 V(ReflectPreventExtensions, kNone) \
71 V(ReflectSet, NO_EXTRA_ARGUMENTS) \ 78 V(ReflectSet, kNone) \
72 V(ReflectSetPrototypeOf, NO_EXTRA_ARGUMENTS) \ 79 V(ReflectSetPrototypeOf, kNone) \
73 \ 80 \
74 V(SymbolConstructor, NO_EXTRA_ARGUMENTS) \ 81 V(SymbolConstructor, kNone) \
75 V(SymbolConstructor_ConstructStub, NEEDS_CALLED_FUNCTION) \ 82 V(SymbolConstructor_ConstructStub, kTarget) \
76 \ 83 \
77 V(HandleApiCall, NEEDS_CALLED_FUNCTION) \ 84 V(HandleApiCall, kTarget) \
78 V(HandleApiCallConstruct, NEEDS_CALLED_FUNCTION) \ 85 V(HandleApiCallConstruct, kTarget) \
79 V(HandleApiCallAsFunction, NO_EXTRA_ARGUMENTS) \ 86 V(HandleApiCallAsFunction, kNone) \
80 V(HandleApiCallAsConstructor, NO_EXTRA_ARGUMENTS) \ 87 V(HandleApiCallAsConstructor, kNone) \
81 \ 88 \
82 V(RestrictedFunctionPropertiesThrower, NO_EXTRA_ARGUMENTS) \ 89 V(RestrictedFunctionPropertiesThrower, kNone) \
83 V(RestrictedStrictArgumentsPropertiesThrower, NO_EXTRA_ARGUMENTS) 90 V(RestrictedStrictArgumentsPropertiesThrower, kNone)
84 91
85 // Define list of builtins implemented in assembly. 92 // Define list of builtins implemented in assembly.
86 #define BUILTIN_LIST_A(V) \ 93 #define BUILTIN_LIST_A(V) \
87 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 94 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
88 \ 95 \
89 V(ConstructedNonConstructable, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 96 V(ConstructedNonConstructable, BUILTIN, UNINITIALIZED, kNoExtraICState) \
90 \ 97 \
91 V(CallFunction_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \ 98 V(CallFunction_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \
92 kNoExtraICState) \ 99 kNoExtraICState) \
93 V(CallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ 100 V(CallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 friend class BuiltinFunctionTable; 383 friend class BuiltinFunctionTable;
377 friend class Isolate; 384 friend class Isolate;
378 385
379 DISALLOW_COPY_AND_ASSIGN(Builtins); 386 DISALLOW_COPY_AND_ASSIGN(Builtins);
380 }; 387 };
381 388
382 } // namespace internal 389 } // namespace internal
383 } // namespace v8 390 } // namespace v8
384 391
385 #endif // V8_BUILTINS_H_ 392 #endif // V8_BUILTINS_H_
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698