OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 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 #include "src/builtins/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
9 #include "src/ic/keyed-store-generic.h" | 9 #include "src/ic/keyed-store-generic.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 void Builtins::Generate_KeyedLoadIC_Megamorphic_TF( | 14 void Builtins::Generate_KeyedLoadIC_Megamorphic_TF( |
15 CodeStubAssembler* assembler) { | 15 compiler::CodeAssemblerState* state) { |
16 typedef compiler::Node Node; | 16 typedef compiler::Node Node; |
17 typedef LoadWithVectorDescriptor Descriptor; | 17 typedef LoadWithVectorDescriptor Descriptor; |
| 18 CodeStubAssembler assembler(state); |
18 | 19 |
19 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 20 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
20 Node* name = assembler->Parameter(Descriptor::kName); | 21 Node* name = assembler.Parameter(Descriptor::kName); |
21 Node* slot = assembler->Parameter(Descriptor::kSlot); | 22 Node* slot = assembler.Parameter(Descriptor::kSlot); |
22 Node* vector = assembler->Parameter(Descriptor::kVector); | 23 Node* vector = assembler.Parameter(Descriptor::kVector); |
23 Node* context = assembler->Parameter(Descriptor::kContext); | 24 Node* context = assembler.Parameter(Descriptor::kContext); |
24 | 25 |
25 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); | 26 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); |
26 assembler->KeyedLoadICGeneric(&p); | 27 assembler.KeyedLoadICGeneric(&p); |
27 } | 28 } |
28 | 29 |
29 void Builtins::Generate_KeyedLoadIC_Miss(MacroAssembler* masm) { | 30 void Builtins::Generate_KeyedLoadIC_Miss(MacroAssembler* masm) { |
30 KeyedLoadIC::GenerateMiss(masm); | 31 KeyedLoadIC::GenerateMiss(masm); |
31 } | 32 } |
32 void Builtins::Generate_KeyedLoadIC_Slow(MacroAssembler* masm) { | 33 void Builtins::Generate_KeyedLoadIC_Slow(MacroAssembler* masm) { |
33 KeyedLoadIC::GenerateRuntimeGetProperty(masm); | 34 KeyedLoadIC::GenerateRuntimeGetProperty(masm); |
34 } | 35 } |
35 | 36 |
36 void Builtins::Generate_KeyedStoreIC_Megamorphic(MacroAssembler* masm) { | 37 void Builtins::Generate_KeyedStoreIC_Megamorphic(MacroAssembler* masm) { |
37 KeyedStoreIC::GenerateMegamorphic(masm, SLOPPY); | 38 KeyedStoreIC::GenerateMegamorphic(masm, SLOPPY); |
38 } | 39 } |
39 | 40 |
40 void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict(MacroAssembler* masm) { | 41 void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict(MacroAssembler* masm) { |
41 KeyedStoreIC::GenerateMegamorphic(masm, STRICT); | 42 KeyedStoreIC::GenerateMegamorphic(masm, STRICT); |
42 } | 43 } |
43 | 44 |
44 void KeyedStoreICMegamorphic(CodeStubAssembler* assembler, LanguageMode mode) { | |
45 typedef compiler::Node Node; | |
46 typedef StoreWithVectorDescriptor Descriptor; | |
47 | |
48 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | |
49 Node* name = assembler->Parameter(Descriptor::kName); | |
50 Node* value = assembler->Parameter(Descriptor::kValue); | |
51 Node* slot = assembler->Parameter(Descriptor::kSlot); | |
52 Node* vector = assembler->Parameter(Descriptor::kVector); | |
53 Node* context = assembler->Parameter(Descriptor::kContext); | |
54 | |
55 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, | |
56 vector); | |
57 KeyedStoreGenericGenerator::Generate(assembler, &p, mode); | |
58 } | |
59 | |
60 void Builtins::Generate_KeyedStoreIC_Megamorphic_TF( | 45 void Builtins::Generate_KeyedStoreIC_Megamorphic_TF( |
61 CodeStubAssembler* assembler) { | 46 compiler::CodeAssemblerState* state) { |
62 KeyedStoreICMegamorphic(assembler, SLOPPY); | 47 KeyedStoreGenericGenerator::Generate(state, SLOPPY); |
63 } | 48 } |
64 | 49 |
65 void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict_TF( | 50 void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict_TF( |
66 CodeStubAssembler* assembler) { | 51 compiler::CodeAssemblerState* state) { |
67 KeyedStoreICMegamorphic(assembler, STRICT); | 52 KeyedStoreGenericGenerator::Generate(state, STRICT); |
68 } | 53 } |
69 | 54 |
70 void Builtins::Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { | 55 void Builtins::Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { |
71 KeyedStoreIC::GenerateMiss(masm); | 56 KeyedStoreIC::GenerateMiss(masm); |
72 } | 57 } |
73 | 58 |
74 void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { | 59 void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { |
75 KeyedStoreIC::GenerateSlow(masm); | 60 KeyedStoreIC::GenerateSlow(masm); |
76 } | 61 } |
77 | 62 |
78 void Builtins::Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) { | 63 void Builtins::Generate_LoadGlobalIC_Miss(compiler::CodeAssemblerState* state) { |
79 typedef compiler::Node Node; | 64 typedef compiler::Node Node; |
80 typedef LoadGlobalWithVectorDescriptor Descriptor; | 65 typedef LoadGlobalWithVectorDescriptor Descriptor; |
| 66 CodeStubAssembler assembler(state); |
81 | 67 |
82 Node* slot = assembler->Parameter(Descriptor::kSlot); | 68 Node* slot = assembler.Parameter(Descriptor::kSlot); |
83 Node* vector = assembler->Parameter(Descriptor::kVector); | 69 Node* vector = assembler.Parameter(Descriptor::kVector); |
84 Node* context = assembler->Parameter(Descriptor::kContext); | 70 Node* context = assembler.Parameter(Descriptor::kContext); |
85 | 71 |
86 assembler->TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, slot, | 72 assembler.TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, slot, vector); |
87 vector); | |
88 } | 73 } |
89 | 74 |
90 void Builtins::Generate_LoadGlobalIC_Slow(CodeStubAssembler* assembler) { | 75 void Builtins::Generate_LoadGlobalIC_Slow(compiler::CodeAssemblerState* state) { |
91 typedef compiler::Node Node; | 76 typedef compiler::Node Node; |
92 typedef LoadGlobalWithVectorDescriptor Descriptor; | 77 typedef LoadGlobalWithVectorDescriptor Descriptor; |
| 78 CodeStubAssembler assembler(state); |
93 | 79 |
94 Node* slot = assembler->Parameter(Descriptor::kSlot); | 80 Node* slot = assembler.Parameter(Descriptor::kSlot); |
95 Node* vector = assembler->Parameter(Descriptor::kVector); | 81 Node* vector = assembler.Parameter(Descriptor::kVector); |
96 Node* context = assembler->Parameter(Descriptor::kContext); | 82 Node* context = assembler.Parameter(Descriptor::kContext); |
97 | 83 |
98 assembler->TailCallRuntime(Runtime::kLoadGlobalIC_Slow, context, slot, | 84 assembler.TailCallRuntime(Runtime::kLoadGlobalIC_Slow, context, slot, vector); |
99 vector); | |
100 } | 85 } |
101 | 86 |
102 void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { | 87 void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { |
103 NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm); | 88 NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm); |
104 } | 89 } |
105 | 90 |
106 void Builtins::Generate_LoadIC_Miss(CodeStubAssembler* assembler) { | 91 void Builtins::Generate_LoadIC_Miss(compiler::CodeAssemblerState* state) { |
107 typedef compiler::Node Node; | 92 typedef compiler::Node Node; |
108 typedef LoadWithVectorDescriptor Descriptor; | 93 typedef LoadWithVectorDescriptor Descriptor; |
| 94 CodeStubAssembler assembler(state); |
109 | 95 |
110 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 96 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
111 Node* name = assembler->Parameter(Descriptor::kName); | 97 Node* name = assembler.Parameter(Descriptor::kName); |
112 Node* slot = assembler->Parameter(Descriptor::kSlot); | 98 Node* slot = assembler.Parameter(Descriptor::kSlot); |
113 Node* vector = assembler->Parameter(Descriptor::kVector); | 99 Node* vector = assembler.Parameter(Descriptor::kVector); |
114 Node* context = assembler->Parameter(Descriptor::kContext); | 100 Node* context = assembler.Parameter(Descriptor::kContext); |
115 | 101 |
116 assembler->TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name, | 102 assembler.TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name, |
117 slot, vector); | 103 slot, vector); |
118 } | 104 } |
119 | 105 |
120 void Builtins::Generate_LoadIC_Normal(MacroAssembler* masm) { | 106 void Builtins::Generate_LoadIC_Normal(MacroAssembler* masm) { |
121 LoadIC::GenerateNormal(masm); | 107 LoadIC::GenerateNormal(masm); |
122 } | 108 } |
123 | 109 |
124 void Builtins::Generate_LoadIC_Slow(CodeStubAssembler* assembler) { | 110 void Builtins::Generate_LoadIC_Slow(compiler::CodeAssemblerState* state) { |
125 typedef compiler::Node Node; | 111 typedef compiler::Node Node; |
126 typedef LoadWithVectorDescriptor Descriptor; | 112 typedef LoadWithVectorDescriptor Descriptor; |
| 113 CodeStubAssembler assembler(state); |
127 | 114 |
128 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 115 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
129 Node* name = assembler->Parameter(Descriptor::kName); | 116 Node* name = assembler.Parameter(Descriptor::kName); |
130 Node* context = assembler->Parameter(Descriptor::kContext); | 117 Node* context = assembler.Parameter(Descriptor::kContext); |
131 | 118 |
132 assembler->TailCallRuntime(Runtime::kGetProperty, context, receiver, name); | 119 assembler.TailCallRuntime(Runtime::kGetProperty, context, receiver, name); |
133 } | 120 } |
134 | 121 |
135 void Builtins::Generate_StoreIC_Miss(CodeStubAssembler* assembler) { | 122 void Builtins::Generate_StoreIC_Miss(compiler::CodeAssemblerState* state) { |
136 typedef compiler::Node Node; | 123 typedef compiler::Node Node; |
137 typedef StoreWithVectorDescriptor Descriptor; | 124 typedef StoreWithVectorDescriptor Descriptor; |
| 125 CodeStubAssembler assembler(state); |
138 | 126 |
139 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 127 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
140 Node* name = assembler->Parameter(Descriptor::kName); | 128 Node* name = assembler.Parameter(Descriptor::kName); |
141 Node* value = assembler->Parameter(Descriptor::kValue); | 129 Node* value = assembler.Parameter(Descriptor::kValue); |
142 Node* slot = assembler->Parameter(Descriptor::kSlot); | 130 Node* slot = assembler.Parameter(Descriptor::kSlot); |
143 Node* vector = assembler->Parameter(Descriptor::kVector); | 131 Node* vector = assembler.Parameter(Descriptor::kVector); |
144 Node* context = assembler->Parameter(Descriptor::kContext); | 132 Node* context = assembler.Parameter(Descriptor::kContext); |
145 | 133 |
146 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, | 134 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, |
147 vector, receiver, name); | 135 vector, receiver, name); |
148 } | 136 } |
149 | 137 |
150 void Builtins::Generate_StoreIC_Normal(MacroAssembler* masm) { | 138 void Builtins::Generate_StoreIC_Normal(MacroAssembler* masm) { |
151 StoreIC::GenerateNormal(masm); | 139 StoreIC::GenerateNormal(masm); |
152 } | 140 } |
153 | 141 |
154 void Builtins::Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { | 142 void Builtins::Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { |
155 NamedStoreHandlerCompiler::GenerateStoreViaSetterForDeopt(masm); | 143 NamedStoreHandlerCompiler::GenerateStoreViaSetterForDeopt(masm); |
156 } | 144 } |
157 | 145 |
158 namespace { | 146 namespace { |
159 void Generate_StoreIC_Slow(CodeStubAssembler* assembler, | 147 void Generate_StoreIC_Slow(compiler::CodeAssemblerState* state, |
160 LanguageMode language_mode) { | 148 LanguageMode language_mode) { |
161 typedef compiler::Node Node; | 149 typedef compiler::Node Node; |
162 typedef StoreWithVectorDescriptor Descriptor; | 150 typedef StoreWithVectorDescriptor Descriptor; |
| 151 CodeStubAssembler assembler(state); |
163 | 152 |
164 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 153 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
165 Node* name = assembler->Parameter(Descriptor::kName); | 154 Node* name = assembler.Parameter(Descriptor::kName); |
166 Node* value = assembler->Parameter(Descriptor::kValue); | 155 Node* value = assembler.Parameter(Descriptor::kValue); |
167 Node* context = assembler->Parameter(Descriptor::kContext); | 156 Node* context = assembler.Parameter(Descriptor::kContext); |
168 Node* lang_mode = assembler->SmiConstant(Smi::FromInt(language_mode)); | 157 Node* lang_mode = assembler.SmiConstant(Smi::FromInt(language_mode)); |
169 | 158 |
170 // The slow case calls into the runtime to complete the store without causing | 159 // The slow case calls into the runtime to complete the store without causing |
171 // an IC miss that would otherwise cause a transition to the generic stub. | 160 // an IC miss that would otherwise cause a transition to the generic stub. |
172 assembler->TailCallRuntime(Runtime::kSetProperty, context, receiver, name, | 161 assembler.TailCallRuntime(Runtime::kSetProperty, context, receiver, name, |
173 value, lang_mode); | 162 value, lang_mode); |
174 } | 163 } |
175 } // anonymous namespace | 164 } // anonymous namespace |
176 | 165 |
177 void Builtins::Generate_StoreIC_SlowSloppy(CodeStubAssembler* assembler) { | 166 void Builtins::Generate_StoreIC_SlowSloppy( |
178 Generate_StoreIC_Slow(assembler, SLOPPY); | 167 compiler::CodeAssemblerState* state) { |
| 168 Generate_StoreIC_Slow(state, SLOPPY); |
179 } | 169 } |
180 | 170 |
181 void Builtins::Generate_StoreIC_SlowStrict(CodeStubAssembler* assembler) { | 171 void Builtins::Generate_StoreIC_SlowStrict( |
182 Generate_StoreIC_Slow(assembler, STRICT); | 172 compiler::CodeAssemblerState* state) { |
| 173 Generate_StoreIC_Slow(state, STRICT); |
183 } | 174 } |
184 | 175 |
185 } // namespace internal | 176 } // namespace internal |
186 } // namespace v8 | 177 } // namespace v8 |
OLD | NEW |