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

Side by Side Diff: runtime/vm/intermediate_language_ia32.cc

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

Powered by Google App Engine
This is Rietveld 408576698