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