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/code-stub-assembler.h" | 7 #include "src/code-stub-assembler.h" |
8 #include "src/ic/accessor-assembler.h" | |
9 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
10 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
11 #include "src/ic/keyed-store-generic.h" | 10 #include "src/ic/keyed-store-generic.h" |
12 | 11 |
13 namespace v8 { | 12 namespace v8 { |
14 namespace internal { | 13 namespace internal { |
15 | 14 |
16 void Builtins::Generate_KeyedLoadIC_Megamorphic_TF( | 15 TF_BUILTIN(KeyedLoadIC_Miss, CodeStubAssembler) { |
17 compiler::CodeAssemblerState* state) { | 16 typedef LoadWithVectorDescriptor Descriptor; |
18 AccessorAssembler::GenerateKeyedLoadICMegamorphic(state); | 17 |
| 18 Node* receiver = Parameter(Descriptor::kReceiver); |
| 19 Node* name = Parameter(Descriptor::kName); |
| 20 Node* slot = Parameter(Descriptor::kSlot); |
| 21 Node* vector = Parameter(Descriptor::kVector); |
| 22 Node* context = Parameter(Descriptor::kContext); |
| 23 |
| 24 TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, name, slot, |
| 25 vector); |
19 } | 26 } |
20 | 27 |
21 void Builtins::Generate_KeyedLoadIC_Miss(compiler::CodeAssemblerState* state) { | 28 TF_BUILTIN(KeyedLoadIC_Slow, CodeStubAssembler) { |
22 typedef compiler::Node Node; | |
23 typedef LoadWithVectorDescriptor Descriptor; | 29 typedef LoadWithVectorDescriptor Descriptor; |
24 CodeStubAssembler assembler(state); | |
25 | 30 |
26 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | 31 Node* receiver = Parameter(Descriptor::kReceiver); |
27 Node* name = assembler.Parameter(Descriptor::kName); | 32 Node* name = Parameter(Descriptor::kName); |
28 Node* slot = assembler.Parameter(Descriptor::kSlot); | 33 Node* context = Parameter(Descriptor::kContext); |
29 Node* vector = assembler.Parameter(Descriptor::kVector); | |
30 Node* context = assembler.Parameter(Descriptor::kContext); | |
31 | 34 |
32 assembler.TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, name, | 35 TailCallRuntime(Runtime::kKeyedGetProperty, context, receiver, name); |
33 slot, vector); | |
34 } | 36 } |
35 | 37 |
36 void Builtins::Generate_KeyedLoadIC_Slow(compiler::CodeAssemblerState* state) { | 38 void Builtins::Generate_KeyedStoreIC_Megamorphic( |
37 typedef compiler::Node Node; | |
38 typedef LoadWithVectorDescriptor Descriptor; | |
39 CodeStubAssembler assembler(state); | |
40 | |
41 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | |
42 Node* name = assembler.Parameter(Descriptor::kName); | |
43 Node* context = assembler.Parameter(Descriptor::kContext); | |
44 | |
45 assembler.TailCallRuntime(Runtime::kKeyedGetProperty, context, receiver, | |
46 name); | |
47 } | |
48 | |
49 void Builtins::Generate_KeyedStoreIC_Megamorphic_TF( | |
50 compiler::CodeAssemblerState* state) { | 39 compiler::CodeAssemblerState* state) { |
51 KeyedStoreGenericGenerator::Generate(state, SLOPPY); | 40 KeyedStoreGenericGenerator::Generate(state, SLOPPY); |
52 } | 41 } |
53 | 42 |
54 void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict_TF( | 43 void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict( |
55 compiler::CodeAssemblerState* state) { | 44 compiler::CodeAssemblerState* state) { |
56 KeyedStoreGenericGenerator::Generate(state, STRICT); | 45 KeyedStoreGenericGenerator::Generate(state, STRICT); |
57 } | 46 } |
58 | 47 |
59 void Builtins::Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { | 48 void Builtins::Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { |
60 KeyedStoreIC::GenerateMiss(masm); | 49 KeyedStoreIC::GenerateMiss(masm); |
61 } | 50 } |
62 | 51 |
63 void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { | 52 void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { |
64 KeyedStoreIC::GenerateSlow(masm); | 53 KeyedStoreIC::GenerateSlow(masm); |
65 } | 54 } |
66 | 55 |
67 void Builtins::Generate_LoadGlobalIC_Miss(compiler::CodeAssemblerState* state) { | 56 TF_BUILTIN(LoadGlobalIC_Miss, CodeStubAssembler) { |
68 typedef compiler::Node Node; | |
69 typedef LoadGlobalWithVectorDescriptor Descriptor; | 57 typedef LoadGlobalWithVectorDescriptor Descriptor; |
70 CodeStubAssembler assembler(state); | |
71 | 58 |
72 Node* name = assembler.Parameter(Descriptor::kName); | 59 Node* name = Parameter(Descriptor::kName); |
73 Node* slot = assembler.Parameter(Descriptor::kSlot); | 60 Node* slot = Parameter(Descriptor::kSlot); |
74 Node* vector = assembler.Parameter(Descriptor::kVector); | 61 Node* vector = Parameter(Descriptor::kVector); |
75 Node* context = assembler.Parameter(Descriptor::kContext); | 62 Node* context = Parameter(Descriptor::kContext); |
76 | 63 |
77 assembler.TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, name, slot, | 64 TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, name, slot, vector); |
78 vector); | |
79 } | 65 } |
80 | 66 |
81 void Builtins::Generate_LoadGlobalIC_Slow(compiler::CodeAssemblerState* state) { | 67 TF_BUILTIN(LoadGlobalIC_Slow, CodeStubAssembler) { |
82 typedef compiler::Node Node; | |
83 typedef LoadGlobalWithVectorDescriptor Descriptor; | 68 typedef LoadGlobalWithVectorDescriptor Descriptor; |
84 CodeStubAssembler assembler(state); | |
85 | 69 |
86 Node* name = assembler.Parameter(Descriptor::kName); | 70 Node* name = Parameter(Descriptor::kName); |
87 Node* context = assembler.Parameter(Descriptor::kContext); | 71 Node* context = Parameter(Descriptor::kContext); |
88 | 72 |
89 assembler.TailCallRuntime(Runtime::kLoadGlobalIC_Slow, context, name); | 73 TailCallRuntime(Runtime::kLoadGlobalIC_Slow, context, name); |
90 } | 74 } |
91 | 75 |
92 void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { | 76 void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { |
93 NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm); | 77 NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm); |
94 } | 78 } |
95 | 79 |
96 void Builtins::Generate_LoadIC_Miss(compiler::CodeAssemblerState* state) { | 80 TF_BUILTIN(LoadIC_Miss, CodeStubAssembler) { |
97 typedef compiler::Node Node; | |
98 typedef LoadWithVectorDescriptor Descriptor; | 81 typedef LoadWithVectorDescriptor Descriptor; |
99 CodeStubAssembler assembler(state); | |
100 | 82 |
101 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | 83 Node* receiver = Parameter(Descriptor::kReceiver); |
102 Node* name = assembler.Parameter(Descriptor::kName); | 84 Node* name = Parameter(Descriptor::kName); |
103 Node* slot = assembler.Parameter(Descriptor::kSlot); | 85 Node* slot = Parameter(Descriptor::kSlot); |
104 Node* vector = assembler.Parameter(Descriptor::kVector); | 86 Node* vector = Parameter(Descriptor::kVector); |
105 Node* context = assembler.Parameter(Descriptor::kContext); | 87 Node* context = Parameter(Descriptor::kContext); |
106 | 88 |
107 assembler.TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name, | 89 TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name, slot, vector); |
108 slot, vector); | |
109 } | 90 } |
110 | 91 |
111 TF_BUILTIN(LoadIC_Normal, CodeStubAssembler) { | 92 TF_BUILTIN(LoadIC_Normal, CodeStubAssembler) { |
112 typedef LoadWithVectorDescriptor Descriptor; | 93 typedef LoadWithVectorDescriptor Descriptor; |
113 | 94 |
114 Node* receiver = Parameter(Descriptor::kReceiver); | 95 Node* receiver = Parameter(Descriptor::kReceiver); |
115 Node* name = Parameter(Descriptor::kName); | 96 Node* name = Parameter(Descriptor::kName); |
116 Node* context = Parameter(Descriptor::kContext); | 97 Node* context = Parameter(Descriptor::kContext); |
117 | 98 |
118 Label slow(this); | 99 Label slow(this); |
(...skipping 12 matching lines...) Expand all Loading... |
131 Node* value = CallGetterIfAccessor(var_value.value(), var_details.value(), | 112 Node* value = CallGetterIfAccessor(var_value.value(), var_details.value(), |
132 context, receiver, &slow); | 113 context, receiver, &slow); |
133 Return(value); | 114 Return(value); |
134 } | 115 } |
135 } | 116 } |
136 | 117 |
137 Bind(&slow); | 118 Bind(&slow); |
138 TailCallRuntime(Runtime::kGetProperty, context, receiver, name); | 119 TailCallRuntime(Runtime::kGetProperty, context, receiver, name); |
139 } | 120 } |
140 | 121 |
141 void Builtins::Generate_LoadIC_Slow(compiler::CodeAssemblerState* state) { | 122 TF_BUILTIN(LoadIC_Slow, CodeStubAssembler) { |
142 typedef compiler::Node Node; | |
143 typedef LoadWithVectorDescriptor Descriptor; | 123 typedef LoadWithVectorDescriptor Descriptor; |
144 CodeStubAssembler assembler(state); | |
145 | 124 |
146 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | 125 Node* receiver = Parameter(Descriptor::kReceiver); |
147 Node* name = assembler.Parameter(Descriptor::kName); | 126 Node* name = Parameter(Descriptor::kName); |
148 Node* context = assembler.Parameter(Descriptor::kContext); | 127 Node* context = Parameter(Descriptor::kContext); |
149 | 128 |
150 assembler.TailCallRuntime(Runtime::kGetProperty, context, receiver, name); | 129 TailCallRuntime(Runtime::kGetProperty, context, receiver, name); |
151 } | 130 } |
152 | 131 |
153 void Builtins::Generate_StoreIC_Miss(compiler::CodeAssemblerState* state) { | 132 TF_BUILTIN(StoreIC_Miss, CodeStubAssembler) { |
154 typedef compiler::Node Node; | |
155 typedef StoreWithVectorDescriptor Descriptor; | 133 typedef StoreWithVectorDescriptor Descriptor; |
156 CodeStubAssembler assembler(state); | |
157 | 134 |
158 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | 135 Node* receiver = Parameter(Descriptor::kReceiver); |
159 Node* name = assembler.Parameter(Descriptor::kName); | 136 Node* name = Parameter(Descriptor::kName); |
160 Node* value = assembler.Parameter(Descriptor::kValue); | 137 Node* value = Parameter(Descriptor::kValue); |
161 Node* slot = assembler.Parameter(Descriptor::kSlot); | 138 Node* slot = Parameter(Descriptor::kSlot); |
162 Node* vector = assembler.Parameter(Descriptor::kVector); | 139 Node* vector = Parameter(Descriptor::kVector); |
163 Node* context = assembler.Parameter(Descriptor::kContext); | 140 Node* context = Parameter(Descriptor::kContext); |
164 | 141 |
165 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, | 142 TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, vector, |
166 vector, receiver, name); | 143 receiver, name); |
167 } | 144 } |
168 | 145 |
169 TF_BUILTIN(StoreIC_Normal, CodeStubAssembler) { | 146 TF_BUILTIN(StoreIC_Normal, CodeStubAssembler) { |
170 typedef StoreWithVectorDescriptor Descriptor; | 147 typedef StoreWithVectorDescriptor Descriptor; |
171 | 148 |
172 Node* receiver = Parameter(Descriptor::kReceiver); | 149 Node* receiver = Parameter(Descriptor::kReceiver); |
173 Node* name = Parameter(Descriptor::kName); | 150 Node* name = Parameter(Descriptor::kName); |
174 Node* value = Parameter(Descriptor::kValue); | 151 Node* value = Parameter(Descriptor::kValue); |
175 Node* slot = Parameter(Descriptor::kSlot); | 152 Node* slot = Parameter(Descriptor::kSlot); |
176 Node* vector = Parameter(Descriptor::kVector); | 153 Node* vector = Parameter(Descriptor::kVector); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 Generate_StoreIC_Slow(state, SLOPPY); | 215 Generate_StoreIC_Slow(state, SLOPPY); |
239 } | 216 } |
240 | 217 |
241 void Builtins::Generate_StoreIC_SlowStrict( | 218 void Builtins::Generate_StoreIC_SlowStrict( |
242 compiler::CodeAssemblerState* state) { | 219 compiler::CodeAssemblerState* state) { |
243 Generate_StoreIC_Slow(state, STRICT); | 220 Generate_StoreIC_Slow(state, STRICT); |
244 } | 221 } |
245 | 222 |
246 } // namespace internal | 223 } // namespace internal |
247 } // namespace v8 | 224 } // namespace v8 |
OLD | NEW |