OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 #include "vm/locations.h" | 9 #include "vm/locations.h" |
| 10 #include "vm/stub_code.h" |
10 | 11 |
11 #define __ compiler->assembler()-> | 12 #define __ compiler->assembler()-> |
12 | 13 |
13 namespace dart { | 14 namespace dart { |
14 | 15 |
| 16 DECLARE_FLAG(bool, optimization_counter_threshold); |
| 17 DECLARE_FLAG(bool, trace_functions); |
| 18 |
| 19 // True iff. the arguments to a call will be properly pushed and can |
| 20 // be popped after the call. |
| 21 template <typename T> static bool VerifyCallComputation(T* comp) { |
| 22 // Argument values should be consecutive temps. |
| 23 // |
| 24 // TODO(kmillikin): implement stack height tracking so we can also assert |
| 25 // they are on top of the stack. |
| 26 intptr_t previous = -1; |
| 27 for (int i = 0; i < comp->ArgumentCount(); ++i) { |
| 28 Value* val = comp->ArgumentAt(i); |
| 29 if (!val->IsUse()) return false; |
| 30 intptr_t current = val->AsUse()->definition()->temp_index(); |
| 31 if (i != 0) { |
| 32 if (current != (previous + 1)) return false; |
| 33 } |
| 34 previous = current; |
| 35 } |
| 36 return true; |
| 37 } |
| 38 |
| 39 |
| 40 // Generic summary for call instructions that have all arguments pushed |
| 41 // on the stack and return the result in a fixed register EAX. |
| 42 static LocationSummary* MakeCallSummary() { |
| 43 LocationSummary* result = new LocationSummary(0, 0); |
| 44 result->set_out(Location::RegisterLocation(EAX)); |
| 45 return result; |
| 46 } |
| 47 |
| 48 |
15 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 49 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
16 UNIMPLEMENTED(); | 50 computation()->EmitNativeCode(compiler); |
| 51 __ pushl(locs()->out().reg()); |
| 52 } |
| 53 |
| 54 |
| 55 LocationSummary* ReturnInstr::locs() { |
| 56 if (locs_ == NULL) { |
| 57 const intptr_t kNumInputs = 1; |
| 58 const intptr_t kNumTemps = 1; |
| 59 locs_ = new LocationSummary(kNumInputs, kNumTemps); |
| 60 locs_->set_in(0, Location::RegisterLocation(EAX)); |
| 61 locs_->set_temp(0, Location::RequiresRegister()); |
| 62 } |
| 63 return locs_; |
| 64 } |
| 65 |
| 66 |
| 67 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 68 Register result = locs()->in(0).reg(); |
| 69 Register temp = locs()->temp(0).reg(); |
| 70 ASSERT(result == EAX); |
| 71 if (!compiler->is_optimizing()) { |
| 72 // Count only in unoptimized code. |
| 73 // TODO(srdjan): Replace the counting code with a type feedback |
| 74 // collection and counting stub. |
| 75 const Function& function = |
| 76 Function::ZoneHandle(compiler->parsed_function().function().raw()); |
| 77 __ LoadObject(temp, function); |
| 78 __ incl(FieldAddress(temp, Function::usage_counter_offset())); |
| 79 if (CodeGenerator::CanOptimize()) { |
| 80 // Do not optimize if usage count must be reported. |
| 81 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()), |
| 82 Immediate(FLAG_optimization_counter_threshold)); |
| 83 Label not_yet_hot; |
| 84 __ j(LESS_EQUAL, ¬_yet_hot, Assembler::kNearJump); |
| 85 __ pushl(result); // Preserve result. |
| 86 __ pushl(temp); // Argument for runtime: function to optimize. |
| 87 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); |
| 88 __ popl(temp); // Remove argument. |
| 89 __ popl(result); // Restore result. |
| 90 __ Bind(¬_yet_hot); |
| 91 } |
| 92 } |
| 93 if (FLAG_trace_functions) { |
| 94 const Function& function = |
| 95 Function::ZoneHandle(compiler->parsed_function().function().raw()); |
| 96 __ LoadObject(temp, function); |
| 97 __ pushl(result); // Preserve result. |
| 98 __ pushl(temp); |
| 99 compiler->GenerateCallRuntime(AstNode::kNoId, |
| 100 0, |
| 101 CatchClauseNode::kInvalidTryIndex, |
| 102 kTraceFunctionExitRuntimeEntry); |
| 103 __ popl(temp); // Remove argument. |
| 104 __ popl(result); // Restore result. |
| 105 } |
| 106 __ LeaveFrame(); |
| 107 __ ret(); |
| 108 // Add a NOP to make return code pattern 5 bytes long for patching |
| 109 // in breakpoints during debugging. |
| 110 __ nop(1); |
| 111 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, |
| 112 cid(), |
| 113 token_index(), |
| 114 CatchClauseNode::kInvalidTryIndex); |
17 } | 115 } |
18 | 116 |
19 | 117 |
20 LocationSummary* CurrentContextComp::MakeLocationSummary() const { | 118 LocationSummary* CurrentContextComp::MakeLocationSummary() const { |
21 return NULL; | 119 return NULL; |
22 } | 120 } |
23 | 121 |
24 | 122 |
25 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compile) { | 123 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
26 UNIMPLEMENTED(); | 124 UNIMPLEMENTED(); |
27 } | 125 } |
28 | 126 |
29 | 127 |
30 LocationSummary* StoreContextComp::MakeLocationSummary() const { | 128 LocationSummary* StoreContextComp::MakeLocationSummary() const { |
31 return NULL; | 129 return NULL; |
32 } | 130 } |
33 | 131 |
34 | 132 |
35 void StoreContextComp::EmitNativeCode(FlowGraphCompiler* compile) { | 133 void StoreContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
36 UNIMPLEMENTED(); | 134 UNIMPLEMENTED(); |
37 } | 135 } |
38 | 136 |
39 | 137 |
40 LocationSummary* StrictCompareComp::MakeLocationSummary() const { | 138 LocationSummary* StrictCompareComp::MakeLocationSummary() const { |
41 return NULL; | 139 return NULL; |
42 } | 140 } |
43 | 141 |
44 | 142 |
45 void StrictCompareComp::EmitNativeCode(FlowGraphCompiler* compile) { | 143 void StrictCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
46 UNIMPLEMENTED(); | 144 UNIMPLEMENTED(); |
47 } | 145 } |
48 | 146 |
49 | 147 |
50 LocationSummary* ClosureCallComp::MakeLocationSummary() const { | 148 LocationSummary* ClosureCallComp::MakeLocationSummary() const { |
51 return NULL; | 149 return NULL; |
52 } | 150 } |
53 | 151 |
54 | 152 |
55 void ClosureCallComp::EmitNativeCode(FlowGraphCompiler* compile) { | 153 void ClosureCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
56 UNIMPLEMENTED(); | 154 UNIMPLEMENTED(); |
57 } | 155 } |
58 | 156 |
59 | 157 |
60 LocationSummary* InstanceCallComp::MakeLocationSummary() const { | 158 LocationSummary* InstanceCallComp::MakeLocationSummary() const { |
61 return NULL; | 159 return MakeCallSummary(); |
62 } | 160 } |
63 | 161 |
64 | 162 |
65 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compile) { | 163 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
66 UNIMPLEMENTED(); | 164 ASSERT(VerifyCallComputation(this)); |
| 165 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 166 cid(), |
| 167 token_index(), |
| 168 try_index()); |
| 169 compiler->EmitInstanceCall(cid(), |
| 170 token_index(), |
| 171 try_index(), |
| 172 function_name(), |
| 173 ArgumentCount(), |
| 174 argument_names(), |
| 175 checked_argument_count()); |
67 } | 176 } |
68 | 177 |
69 | 178 |
70 LocationSummary* StaticCallComp::MakeLocationSummary() const { | 179 LocationSummary* StaticCallComp::MakeLocationSummary() const { |
71 return NULL; | 180 return MakeCallSummary(); |
72 } | 181 } |
73 | 182 |
74 | 183 |
75 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compile) { | 184 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
76 UNIMPLEMENTED(); | 185 ASSERT(VerifyCallComputation(this)); |
| 186 compiler->EmitStaticCall(token_index(), |
| 187 try_index(), |
| 188 function(), |
| 189 ArgumentCount(), |
| 190 argument_names()); |
77 } | 191 } |
78 | 192 |
79 | 193 |
80 LocationSummary* LoadLocalComp::MakeLocationSummary() const { | 194 LocationSummary* LoadLocalComp::MakeLocationSummary() const { |
81 return NULL; | 195 return LocationSummary::Make(0, Location::RequiresRegister()); |
82 } | 196 } |
83 | 197 |
84 | 198 |
85 void LoadLocalComp::EmitNativeCode(FlowGraphCompiler* compile) { | 199 void LoadLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
86 UNIMPLEMENTED(); | 200 Register result = locs()->out().reg(); |
| 201 __ movl(result, Address(EBP, local().index() * kWordSize)); |
87 } | 202 } |
88 | 203 |
89 | 204 |
90 LocationSummary* StoreLocalComp::MakeLocationSummary() const { | 205 LocationSummary* StoreLocalComp::MakeLocationSummary() const { |
91 return NULL; | 206 return LocationSummary::Make(1, Location::SameAsFirstInput()); |
92 } | 207 } |
93 | 208 |
94 | 209 |
95 void StoreLocalComp::EmitNativeCode(FlowGraphCompiler* compile) { | 210 void StoreLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
96 UNIMPLEMENTED(); | 211 Register value = locs()->in(0).reg(); |
| 212 Register result = locs()->out().reg(); |
| 213 ASSERT(result == value); // Assert that register assignment is correct. |
| 214 __ movl(Address(EBP, local().index() * kWordSize), value); |
97 } | 215 } |
98 | 216 |
99 | 217 |
100 LocationSummary* ConstantVal::MakeLocationSummary() const { | 218 LocationSummary* ConstantVal::MakeLocationSummary() const { |
101 return NULL; | 219 return LocationSummary::Make(0, Location::RequiresRegister()); |
102 } | 220 } |
103 | 221 |
104 | 222 |
105 void ConstantVal::EmitNativeCode(FlowGraphCompiler* compile) { | 223 void ConstantVal::EmitNativeCode(FlowGraphCompiler* compiler) { |
106 UNIMPLEMENTED(); | 224 Register result = locs()->out().reg(); |
| 225 if (value().IsSmi()) { |
| 226 int32_t imm = reinterpret_cast<int32_t>(value().raw()); |
| 227 __ movl(result, Immediate(imm)); |
| 228 } else { |
| 229 __ LoadObject(result, value()); |
| 230 } |
107 } | 231 } |
108 | 232 |
109 | 233 |
110 LocationSummary* UseVal::MakeLocationSummary() const { | 234 LocationSummary* UseVal::MakeLocationSummary() const { |
111 return NULL; | 235 return NULL; |
112 } | 236 } |
113 | 237 |
114 | 238 |
115 void UseVal::EmitNativeCode(FlowGraphCompiler* compile) { | 239 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) { |
116 UNIMPLEMENTED(); | 240 UNIMPLEMENTED(); |
117 } | 241 } |
118 | 242 |
119 | 243 |
120 LocationSummary* AssertAssignableComp::MakeLocationSummary() const { | 244 LocationSummary* AssertAssignableComp::MakeLocationSummary() const { |
121 return NULL; | 245 return NULL; |
122 } | 246 } |
123 | 247 |
124 | 248 |
125 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compile) { | 249 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
126 UNIMPLEMENTED(); | 250 UNIMPLEMENTED(); |
127 } | 251 } |
128 | 252 |
129 | 253 |
130 LocationSummary* AssertBooleanComp::MakeLocationSummary() const { | 254 LocationSummary* AssertBooleanComp::MakeLocationSummary() const { |
131 return NULL; | 255 return NULL; |
132 } | 256 } |
133 | 257 |
134 | 258 |
135 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compile) { | 259 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
136 UNIMPLEMENTED(); | 260 UNIMPLEMENTED(); |
137 } | 261 } |
138 | 262 |
139 | 263 |
140 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { | 264 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { |
141 return NULL; | 265 return NULL; |
142 } | 266 } |
143 | 267 |
144 | 268 |
145 void EqualityCompareComp::EmitNativeCode(FlowGraphCompiler* compile) { | 269 void EqualityCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
146 UNIMPLEMENTED(); | 270 UNIMPLEMENTED(); |
147 } | 271 } |
148 | 272 |
149 | 273 |
150 LocationSummary* NativeCallComp::MakeLocationSummary() const { | 274 LocationSummary* NativeCallComp::MakeLocationSummary() const { |
151 return NULL; | 275 LocationSummary* locs = new LocationSummary(0, 3); |
| 276 locs->set_temp(0, Location::RegisterLocation(EAX)); |
| 277 locs->set_temp(1, Location::RegisterLocation(ECX)); |
| 278 locs->set_temp(2, Location::RegisterLocation(EDX)); |
| 279 locs->set_out(Location::RequiresRegister()); |
| 280 return locs; |
152 } | 281 } |
153 | 282 |
154 | 283 |
155 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compile) { | 284 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
156 UNIMPLEMENTED(); | 285 ASSERT(locs()->temp(0).reg() == EAX); |
| 286 ASSERT(locs()->temp(1).reg() == ECX); |
| 287 ASSERT(locs()->temp(2).reg() == EDX); |
| 288 Register result = locs()->out().reg(); |
| 289 // Push the result place holder initialized to NULL. |
| 290 __ PushObject(Object::ZoneHandle()); |
| 291 // Pass a pointer to the first argument in EAX. |
| 292 if (!has_optional_parameters()) { |
| 293 __ leal(EAX, Address(EBP, (1 + argument_count()) * kWordSize)); |
| 294 } else { |
| 295 __ leal(EAX, |
| 296 Address(EBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); |
| 297 } |
| 298 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
| 299 __ movl(EDX, Immediate(argument_count())); |
| 300 compiler->GenerateCall(token_index(), |
| 301 try_index(), |
| 302 &StubCode::CallNativeCFunctionLabel(), |
| 303 PcDescriptors::kOther); |
| 304 __ popl(result); |
157 } | 305 } |
158 | 306 |
159 | 307 |
160 LocationSummary* StoreIndexedComp::MakeLocationSummary() const { | 308 LocationSummary* StoreIndexedComp::MakeLocationSummary() const { |
161 return NULL; | 309 return NULL; |
162 } | 310 } |
163 | 311 |
164 | 312 |
165 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compile) { | 313 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
166 UNIMPLEMENTED(); | 314 UNIMPLEMENTED(); |
167 } | 315 } |
168 | 316 |
169 | 317 |
170 LocationSummary* InstanceSetterComp::MakeLocationSummary() const { | 318 LocationSummary* InstanceSetterComp::MakeLocationSummary() const { |
171 return NULL; | 319 return NULL; |
172 } | 320 } |
173 | 321 |
174 | 322 |
175 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compile) { | 323 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
176 UNIMPLEMENTED(); | 324 UNIMPLEMENTED(); |
177 } | 325 } |
178 | 326 |
179 | 327 |
180 LocationSummary* StaticSetterComp::MakeLocationSummary() const { | 328 LocationSummary* StaticSetterComp::MakeLocationSummary() const { |
181 return NULL; | 329 return NULL; |
182 } | 330 } |
183 | 331 |
184 | 332 |
185 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compile) { | 333 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
186 UNIMPLEMENTED(); | 334 UNIMPLEMENTED(); |
187 } | 335 } |
188 | 336 |
189 | 337 |
190 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const { | 338 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const { |
191 return NULL; | 339 return NULL; |
192 } | 340 } |
193 | 341 |
194 | 342 |
195 void LoadInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compile) { | 343 void LoadInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
196 UNIMPLEMENTED(); | 344 UNIMPLEMENTED(); |
197 } | 345 } |
198 | 346 |
199 | 347 |
200 LocationSummary* StoreInstanceFieldComp::MakeLocationSummary() const { | 348 LocationSummary* StoreInstanceFieldComp::MakeLocationSummary() const { |
201 return NULL; | 349 return NULL; |
202 } | 350 } |
203 | 351 |
204 | 352 |
205 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compile) { | 353 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
206 UNIMPLEMENTED(); | 354 UNIMPLEMENTED(); |
207 } | 355 } |
208 | 356 |
209 | 357 |
210 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { | 358 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { |
211 return NULL; | 359 return NULL; |
212 } | 360 } |
213 | 361 |
214 | 362 |
215 void LoadStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compile) { | 363 void LoadStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
216 UNIMPLEMENTED(); | 364 UNIMPLEMENTED(); |
217 } | 365 } |
218 | 366 |
219 | 367 |
220 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { | 368 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { |
221 return NULL; | 369 return NULL; |
222 } | 370 } |
223 | 371 |
224 | 372 |
225 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compile) { | 373 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
226 UNIMPLEMENTED(); | 374 UNIMPLEMENTED(); |
227 } | 375 } |
228 | 376 |
229 | 377 |
230 LocationSummary* BooleanNegateComp::MakeLocationSummary() const { | 378 LocationSummary* BooleanNegateComp::MakeLocationSummary() const { |
231 return NULL; | 379 return NULL; |
232 } | 380 } |
233 | 381 |
234 | 382 |
235 void BooleanNegateComp::EmitNativeCode(FlowGraphCompiler* compile) { | 383 void BooleanNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
236 UNIMPLEMENTED(); | 384 UNIMPLEMENTED(); |
237 } | 385 } |
238 | 386 |
239 | 387 |
240 LocationSummary* InstanceOfComp::MakeLocationSummary() const { | 388 LocationSummary* InstanceOfComp::MakeLocationSummary() const { |
241 return NULL; | 389 return NULL; |
242 } | 390 } |
243 | 391 |
244 | 392 |
245 void InstanceOfComp::EmitNativeCode(FlowGraphCompiler* compile) { | 393 void InstanceOfComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
246 UNIMPLEMENTED(); | 394 UNIMPLEMENTED(); |
247 } | 395 } |
248 | 396 |
249 | 397 |
250 LocationSummary* CreateArrayComp::MakeLocationSummary() const { | 398 LocationSummary* CreateArrayComp::MakeLocationSummary() const { |
251 return NULL; | 399 return NULL; |
252 } | 400 } |
253 | 401 |
254 | 402 |
255 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compile) { | 403 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
256 UNIMPLEMENTED(); | 404 UNIMPLEMENTED(); |
257 } | 405 } |
258 | 406 |
259 | 407 |
260 LocationSummary* CreateClosureComp::MakeLocationSummary() const { | 408 LocationSummary* CreateClosureComp::MakeLocationSummary() const { |
261 return NULL; | 409 return NULL; |
262 } | 410 } |
263 | 411 |
264 | 412 |
265 void CreateClosureComp::EmitNativeCode(FlowGraphCompiler* compile) { | 413 void CreateClosureComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
266 UNIMPLEMENTED(); | 414 UNIMPLEMENTED(); |
267 } | 415 } |
268 | 416 |
269 | 417 |
270 LocationSummary* AllocateObjectComp::MakeLocationSummary() const { | 418 LocationSummary* AllocateObjectComp::MakeLocationSummary() const { |
271 return NULL; | 419 return NULL; |
272 } | 420 } |
273 | 421 |
274 | 422 |
275 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compile) { | 423 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
276 UNIMPLEMENTED(); | 424 UNIMPLEMENTED(); |
277 } | 425 } |
278 | 426 |
279 | 427 |
280 LocationSummary* | 428 LocationSummary* |
281 AllocateObjectWithBoundsCheckComp::MakeLocationSummary() const { | 429 AllocateObjectWithBoundsCheckComp::MakeLocationSummary() const { |
282 return NULL; | 430 return NULL; |
283 } | 431 } |
284 | 432 |
285 | 433 |
286 void AllocateObjectWithBoundsCheckComp::EmitNativeCode( | 434 void AllocateObjectWithBoundsCheckComp::EmitNativeCode( |
287 FlowGraphCompiler* compile) { | 435 FlowGraphCompiler* compiler) { |
288 UNIMPLEMENTED(); | 436 UNIMPLEMENTED(); |
289 } | 437 } |
290 | 438 |
291 | 439 |
292 LocationSummary* LoadVMFieldComp::MakeLocationSummary() const { | 440 LocationSummary* LoadVMFieldComp::MakeLocationSummary() const { |
293 return NULL; | 441 return NULL; |
294 } | 442 } |
295 | 443 |
296 | 444 |
297 void LoadVMFieldComp::EmitNativeCode(FlowGraphCompiler* compile) { | 445 void LoadVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
298 UNIMPLEMENTED(); | 446 UNIMPLEMENTED(); |
299 } | 447 } |
300 | 448 |
301 | 449 |
302 LocationSummary* StoreVMFieldComp::MakeLocationSummary() const { | 450 LocationSummary* StoreVMFieldComp::MakeLocationSummary() const { |
303 return NULL; | 451 return NULL; |
304 } | 452 } |
305 | 453 |
306 | 454 |
307 void StoreVMFieldComp::EmitNativeCode(FlowGraphCompiler* compile) { | 455 void StoreVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
308 UNIMPLEMENTED(); | 456 UNIMPLEMENTED(); |
309 } | 457 } |
310 | 458 |
311 | 459 |
312 LocationSummary* InstantiateTypeArgumentsComp::MakeLocationSummary() const { | 460 LocationSummary* InstantiateTypeArgumentsComp::MakeLocationSummary() const { |
313 return NULL; | 461 return NULL; |
314 } | 462 } |
315 | 463 |
316 | 464 |
317 void InstantiateTypeArgumentsComp::EmitNativeCode( | 465 void InstantiateTypeArgumentsComp::EmitNativeCode( |
318 FlowGraphCompiler* compile) { | 466 FlowGraphCompiler* compiler) { |
319 UNIMPLEMENTED(); | 467 UNIMPLEMENTED(); |
320 } | 468 } |
321 | 469 |
322 | 470 |
323 LocationSummary* | 471 LocationSummary* |
324 ExtractConstructorTypeArgumentsComp::MakeLocationSummary() const { | 472 ExtractConstructorTypeArgumentsComp::MakeLocationSummary() const { |
325 return NULL; | 473 return NULL; |
326 } | 474 } |
327 | 475 |
328 | 476 |
329 void ExtractConstructorTypeArgumentsComp::EmitNativeCode( | 477 void ExtractConstructorTypeArgumentsComp::EmitNativeCode( |
330 FlowGraphCompiler* compile) { | 478 FlowGraphCompiler* compiler) { |
331 UNIMPLEMENTED(); | 479 UNIMPLEMENTED(); |
332 } | 480 } |
333 | 481 |
334 | 482 |
335 LocationSummary* | 483 LocationSummary* |
336 ExtractConstructorInstantiatorComp::MakeLocationSummary() const { | 484 ExtractConstructorInstantiatorComp::MakeLocationSummary() const { |
337 return NULL; | 485 return NULL; |
338 } | 486 } |
339 | 487 |
340 | 488 |
341 void ExtractConstructorInstantiatorComp::EmitNativeCode( | 489 void ExtractConstructorInstantiatorComp::EmitNativeCode( |
342 FlowGraphCompiler* compile) { | 490 FlowGraphCompiler* compiler) { |
343 UNIMPLEMENTED(); | 491 UNIMPLEMENTED(); |
344 } | 492 } |
345 | 493 |
346 | 494 |
347 LocationSummary* AllocateContextComp::MakeLocationSummary() const { | 495 LocationSummary* AllocateContextComp::MakeLocationSummary() const { |
348 return NULL; | 496 return NULL; |
349 } | 497 } |
350 | 498 |
351 | 499 |
352 void AllocateContextComp::EmitNativeCode(FlowGraphCompiler* compile) { | 500 void AllocateContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
353 UNIMPLEMENTED(); | 501 UNIMPLEMENTED(); |
354 } | 502 } |
355 | 503 |
356 | 504 |
357 LocationSummary* ChainContextComp::MakeLocationSummary() const { | 505 LocationSummary* ChainContextComp::MakeLocationSummary() const { |
358 return NULL; | 506 return NULL; |
359 } | 507 } |
360 | 508 |
361 | 509 |
362 void ChainContextComp::EmitNativeCode(FlowGraphCompiler* compile) { | 510 void ChainContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
363 UNIMPLEMENTED(); | 511 UNIMPLEMENTED(); |
364 } | 512 } |
365 | 513 |
366 | 514 |
367 LocationSummary* CloneContextComp::MakeLocationSummary() const { | 515 LocationSummary* CloneContextComp::MakeLocationSummary() const { |
368 return NULL; | 516 return NULL; |
369 } | 517 } |
370 | 518 |
371 | 519 |
372 void CloneContextComp::EmitNativeCode(FlowGraphCompiler* compile) { | 520 void CloneContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
373 UNIMPLEMENTED(); | 521 UNIMPLEMENTED(); |
374 } | 522 } |
375 | 523 |
376 | 524 |
377 LocationSummary* CatchEntryComp::MakeLocationSummary() const { | 525 LocationSummary* CatchEntryComp::MakeLocationSummary() const { |
378 return NULL; | 526 return NULL; |
379 } | 527 } |
380 | 528 |
381 | 529 |
382 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compile) { | 530 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
383 UNIMPLEMENTED(); | 531 UNIMPLEMENTED(); |
384 } | 532 } |
385 | 533 |
386 | 534 |
387 LocationSummary* BinaryOpComp::MakeLocationSummary() const { | 535 LocationSummary* BinaryOpComp::MakeLocationSummary() const { |
388 return NULL; | 536 const intptr_t kNumInputs = 2; |
| 537 const intptr_t kNumTemps = 0; |
| 538 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps); |
| 539 summary->set_in(0, Location::RequiresRegister()); |
| 540 summary->set_in(1, Location::RequiresRegister()); |
| 541 summary->set_out(Location::SameAsFirstInput()); |
| 542 return summary; |
389 } | 543 } |
390 | 544 |
391 | 545 |
392 void BinaryOpComp::EmitNativeCode(FlowGraphCompiler* compile) { | 546 void BinaryOpComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
393 UNIMPLEMENTED(); | 547 // TODO(srdjan): Remove this code once BinaryOpComp has been implemeneted |
| 548 // for all intended operations. |
| 549 Register left = locs()->in(0).reg(); |
| 550 Register right = locs()->in(1).reg(); |
| 551 __ pushl(left); |
| 552 __ pushl(right); |
| 553 InstanceCallComp* instance_call_comp = instance_call(); |
| 554 instance_call_comp->EmitNativeCode(compiler); |
| 555 if (locs()->out().reg() != EAX) { |
| 556 __ movl(locs()->out().reg(), EAX); |
| 557 } |
394 } | 558 } |
395 | 559 |
396 | 560 |
397 } // namespace dart | 561 } // namespace dart |
398 | 562 |
399 #undef __ | 563 #undef __ |
400 | 564 |
401 #endif // defined TARGET_ARCH_X64 | 565 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |