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

Side by Side Diff: src/builtins/builtins-call.cc

Issue 2178943002: [builtins] move remaining builtins into separate files. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/builtins/builtins-api.cc ('k') | src/builtins/builtins-function.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h"
7
8 namespace v8 {
9 namespace internal {
10
11 Handle<Code> Builtins::CallFunction(ConvertReceiverMode mode,
12 TailCallMode tail_call_mode) {
13 switch (tail_call_mode) {
14 case TailCallMode::kDisallow:
15 switch (mode) {
16 case ConvertReceiverMode::kNullOrUndefined:
17 return CallFunction_ReceiverIsNullOrUndefined();
18 case ConvertReceiverMode::kNotNullOrUndefined:
19 return CallFunction_ReceiverIsNotNullOrUndefined();
20 case ConvertReceiverMode::kAny:
21 return CallFunction_ReceiverIsAny();
22 }
23 break;
24 case TailCallMode::kAllow:
25 switch (mode) {
26 case ConvertReceiverMode::kNullOrUndefined:
27 return TailCallFunction_ReceiverIsNullOrUndefined();
28 case ConvertReceiverMode::kNotNullOrUndefined:
29 return TailCallFunction_ReceiverIsNotNullOrUndefined();
30 case ConvertReceiverMode::kAny:
31 return TailCallFunction_ReceiverIsAny();
32 }
33 break;
34 }
35 UNREACHABLE();
36 return Handle<Code>::null();
37 }
38
39 Handle<Code> Builtins::Call(ConvertReceiverMode mode,
40 TailCallMode tail_call_mode) {
41 switch (tail_call_mode) {
42 case TailCallMode::kDisallow:
43 switch (mode) {
44 case ConvertReceiverMode::kNullOrUndefined:
45 return Call_ReceiverIsNullOrUndefined();
46 case ConvertReceiverMode::kNotNullOrUndefined:
47 return Call_ReceiverIsNotNullOrUndefined();
48 case ConvertReceiverMode::kAny:
49 return Call_ReceiverIsAny();
50 }
51 break;
52 case TailCallMode::kAllow:
53 switch (mode) {
54 case ConvertReceiverMode::kNullOrUndefined:
55 return TailCall_ReceiverIsNullOrUndefined();
56 case ConvertReceiverMode::kNotNullOrUndefined:
57 return TailCall_ReceiverIsNotNullOrUndefined();
58 case ConvertReceiverMode::kAny:
59 return TailCall_ReceiverIsAny();
60 }
61 break;
62 }
63 UNREACHABLE();
64 return Handle<Code>::null();
65 }
66
67 Handle<Code> Builtins::CallBoundFunction(TailCallMode tail_call_mode) {
68 switch (tail_call_mode) {
69 case TailCallMode::kDisallow:
70 return CallBoundFunction();
71 case TailCallMode::kAllow:
72 return TailCallBoundFunction();
73 }
74 UNREACHABLE();
75 return Handle<Code>::null();
76 }
77
78 void Builtins::Generate_CallFunction_ReceiverIsNullOrUndefined(
79 MacroAssembler* masm) {
80 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined,
81 TailCallMode::kDisallow);
82 }
83
84 void Builtins::Generate_CallFunction_ReceiverIsNotNullOrUndefined(
85 MacroAssembler* masm) {
86 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined,
87 TailCallMode::kDisallow);
88 }
89
90 void Builtins::Generate_CallFunction_ReceiverIsAny(MacroAssembler* masm) {
91 Generate_CallFunction(masm, ConvertReceiverMode::kAny,
92 TailCallMode::kDisallow);
93 }
94
95 void Builtins::Generate_TailCallFunction_ReceiverIsNullOrUndefined(
96 MacroAssembler* masm) {
97 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined,
98 TailCallMode::kAllow);
99 }
100
101 void Builtins::Generate_TailCallFunction_ReceiverIsNotNullOrUndefined(
102 MacroAssembler* masm) {
103 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined,
104 TailCallMode::kAllow);
105 }
106
107 void Builtins::Generate_TailCallFunction_ReceiverIsAny(MacroAssembler* masm) {
108 Generate_CallFunction(masm, ConvertReceiverMode::kAny, TailCallMode::kAllow);
109 }
110
111 void Builtins::Generate_CallBoundFunction(MacroAssembler* masm) {
112 Generate_CallBoundFunctionImpl(masm, TailCallMode::kDisallow);
113 }
114
115 void Builtins::Generate_TailCallBoundFunction(MacroAssembler* masm) {
116 Generate_CallBoundFunctionImpl(masm, TailCallMode::kAllow);
117 }
118
119 void Builtins::Generate_Call_ReceiverIsNullOrUndefined(MacroAssembler* masm) {
120 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined,
121 TailCallMode::kDisallow);
122 }
123
124 void Builtins::Generate_Call_ReceiverIsNotNullOrUndefined(
125 MacroAssembler* masm) {
126 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined,
127 TailCallMode::kDisallow);
128 }
129
130 void Builtins::Generate_Call_ReceiverIsAny(MacroAssembler* masm) {
131 Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kDisallow);
132 }
133
134 void Builtins::Generate_TailCall_ReceiverIsNullOrUndefined(
135 MacroAssembler* masm) {
136 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined,
137 TailCallMode::kAllow);
138 }
139
140 void Builtins::Generate_TailCall_ReceiverIsNotNullOrUndefined(
141 MacroAssembler* masm) {
142 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined,
143 TailCallMode::kAllow);
144 }
145
146 void Builtins::Generate_TailCall_ReceiverIsAny(MacroAssembler* masm) {
147 Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kAllow);
148 }
149
150 } // namespace internal
151 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-api.cc ('k') | src/builtins/builtins-function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698