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

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

Issue 10466006: Implemented in ia32: branch, strict compare, instance setter, instanceof and assertassigneable with… (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/flow_graph_compiler_x64.cc ('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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return NULL; 149 return NULL;
150 } 150 }
151 151
152 152
153 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 153 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
154 UNIMPLEMENTED(); 154 UNIMPLEMENTED();
155 } 155 }
156 156
157 157
158 LocationSummary* BranchInstr::MakeLocationSummary() const { 158 LocationSummary* BranchInstr::MakeLocationSummary() const {
159 return NULL; 159 const int kNumInputs = 1;
160 const int kNumTemps = 0;
161 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps);
162 locs->set_in(0, Location::RequiresRegister());
163 return locs;
160 } 164 }
161 165
162 166
163 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 167 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
164 UNIMPLEMENTED(); 168 Register value = locs()->in(0).reg();
169 __ CompareObject(value, Bool::ZoneHandle(Bool::True()));
170 if (compiler->IsNextBlock(false_successor())) {
171 // If the next block is the false sucessor we will fall through to it if
regis 2012/06/04 11:54:34 successor
srdjan 2012/06/04 16:10:47 Done.
172 // comparison with true fails.
173 __ j(EQUAL, compiler->GetBlockLabel(true_successor()));
174 } else {
175 // If the next block is the true sucessor we negate comparison and fall
Florian Schneider 2012/06/04 07:28:59 Maybe add an ASSERT(compiler->IsNextBlock(true_suc
regis 2012/06/04 11:54:34 successor
srdjan 2012/06/04 16:10:47 Done.
176 // through to it.
177 __ j(NOT_EQUAL, compiler->GetBlockLabel(false_successor()));
178 }
165 } 179 }
166 180
167 181
168 LocationSummary* CurrentContextComp::MakeLocationSummary() const { 182 LocationSummary* CurrentContextComp::MakeLocationSummary() const {
169 return LocationSummary::Make(0, Location::RequiresRegister()); 183 return LocationSummary::Make(0, Location::RequiresRegister());
170 } 184 }
171 185
172 186
173 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { 187 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
174 __ movl(locs()->out().reg(), CTX); 188 __ movl(locs()->out().reg(), CTX);
175 } 189 }
176 190
177 191
178 LocationSummary* StoreContextComp::MakeLocationSummary() const { 192 LocationSummary* StoreContextComp::MakeLocationSummary() const {
179 const intptr_t kNumInputs = 1; 193 const intptr_t kNumInputs = 1;
180 const intptr_t kNumTemps = 0; 194 const intptr_t kNumTemps = 0;
181 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps); 195 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps);
182 summary->set_in(0, Location::RegisterLocation(CTX)); 196 summary->set_in(0, Location::RegisterLocation(CTX));
183 return summary; 197 return summary;
184 } 198 }
185 199
186 200
187 void StoreContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { 201 void StoreContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
188 // Nothing to do. Context register were loaded by register allocator. 202 // Nothing to do. Context register were loaded by register allocator.
189 ASSERT(locs()->in(0).reg() == CTX); 203 ASSERT(locs()->in(0).reg() == CTX);
190 } 204 }
191 205
192 206
193 LocationSummary* StrictCompareComp::MakeLocationSummary() const { 207 LocationSummary* StrictCompareComp::MakeLocationSummary() const {
194 return NULL; 208 return LocationSummary::Make(2, Location::SameAsFirstInput());
195 } 209 }
196 210
197 211
198 void StrictCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) { 212 void StrictCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) {
199 UNIMPLEMENTED(); 213 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
214 const Bool& bool_false = Bool::ZoneHandle(Bool::False());
215
216 Register left = locs()->in(0).reg();
217 Register right = locs()->in(1).reg();
218 Register result = locs()->out().reg();
219
220 __ cmpl(left, right);
221 Label load_true, done;
222 if (kind() == Token::kEQ_STRICT) {
223 __ j(EQUAL, &load_true, Assembler::kNearJump);
224 } else {
225 ASSERT(kind() == Token::kNE_STRICT);
226 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump);
227 }
228 __ LoadObject(result, bool_false);
229 __ jmp(&done, Assembler::kNearJump);
230 __ Bind(&load_true);
231 __ LoadObject(result, bool_true);
232 __ Bind(&done);
200 } 233 }
201 234
202 235
203 LocationSummary* ClosureCallComp::MakeLocationSummary() const { 236 LocationSummary* ClosureCallComp::MakeLocationSummary() const {
204 return MakeCallSummary(); 237 return MakeCallSummary();
205 } 238 }
206 239
207 240
208 void ClosureCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { 241 void ClosureCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
209 ASSERT(VerifyCallComputation(this)); 242 ASSERT(VerifyCallComputation(this));
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 return NULL; 336 return NULL;
304 } 337 }
305 338
306 339
307 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) { 340 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) {
308 UNIMPLEMENTED(); 341 UNIMPLEMENTED();
309 } 342 }
310 343
311 344
312 LocationSummary* AssertAssignableComp::MakeLocationSummary() const { 345 LocationSummary* AssertAssignableComp::MakeLocationSummary() const {
313 return NULL; 346 LocationSummary* summary = new LocationSummary(3, 0);
347 summary->set_in(0, Location::RegisterLocation(EAX));
348 summary->set_in(1, Location::RegisterLocation(ECX));
349 summary->set_in(2, Location::RegisterLocation(EDX));
350 summary->set_out(Location::RegisterLocation(EAX));
351 return summary;
314 } 352 }
315 353
316 354
317 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { 355 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) {
318 UNIMPLEMENTED(); 356 ASSERT(locs()->in(0).reg() == EAX); // Value.
357 ASSERT(locs()->in(1).reg() == ECX); // Instantiator.
358 ASSERT(locs()->in(2).reg() == EDX); // Instantiator type arguments.
359
360 compiler->GenerateAssertAssignable(cid(),
361 token_index(),
362 try_index(),
363 dst_type(),
364 dst_name());
365 ASSERT(locs()->in(0).reg() == locs()->out().reg());
319 } 366 }
320 367
321 368
322 LocationSummary* AssertBooleanComp::MakeLocationSummary() const { 369 LocationSummary* AssertBooleanComp::MakeLocationSummary() const {
323 return NULL; 370 return NULL;
324 } 371 }
325 372
326 373
327 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) { 374 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) {
328 UNIMPLEMENTED(); 375 UNIMPLEMENTED();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 return NULL; 424 return NULL;
378 } 425 }
379 426
380 427
381 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { 428 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) {
382 UNIMPLEMENTED(); 429 UNIMPLEMENTED();
383 } 430 }
384 431
385 432
386 LocationSummary* InstanceSetterComp::MakeLocationSummary() const { 433 LocationSummary* InstanceSetterComp::MakeLocationSummary() const {
434 const intptr_t kNumInputs = 2;
435 return LocationSummary::Make(kNumInputs, Location::RequiresRegister());
387 return NULL; 436 return NULL;
388 } 437 }
389 438
390 439
391 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { 440 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) {
392 UNIMPLEMENTED(); 441 Register receiver = locs()->in(0).reg();
442 Register value = locs()->in(1).reg();
443 Register result = locs()->out().reg();
444
445 // Preserve the value (second argument) under the arguments as the result
446 // of the computation, then call the setter.
447 const String& function_name =
448 String::ZoneHandle(Field::SetterSymbol(field_name()));
449
450 // Insert a copy of the second (last) argument under the arguments.
451 // TODO(fschneider): Avoid preserving the value if the result is not used.
452 __ pushl(value);
453 __ pushl(receiver);
454 __ pushl(value);
455 compiler->EmitInstanceCall(cid(),
456 token_index(),
457 try_index(),
458 function_name,
459 2,
460 Array::ZoneHandle(),
461 1);
462 __ popl(result);
393 } 463 }
394 464
395 465
396 LocationSummary* StaticSetterComp::MakeLocationSummary() const { 466 LocationSummary* StaticSetterComp::MakeLocationSummary() const {
397 return NULL; 467 return NULL;
398 } 468 }
399 469
400 470
401 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { 471 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) {
402 UNIMPLEMENTED(); 472 UNIMPLEMENTED();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 return NULL; 517 return NULL;
448 } 518 }
449 519
450 520
451 void BooleanNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { 521 void BooleanNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) {
452 UNIMPLEMENTED(); 522 UNIMPLEMENTED();
453 } 523 }
454 524
455 525
456 LocationSummary* InstanceOfComp::MakeLocationSummary() const { 526 LocationSummary* InstanceOfComp::MakeLocationSummary() const {
457 return NULL; 527 LocationSummary* summary = new LocationSummary(3, 0);
528 summary->set_in(0, Location::RegisterLocation(EAX));
529 summary->set_in(1, Location::RegisterLocation(ECX));
530 summary->set_in(2, Location::RegisterLocation(EDX));
531 summary->set_out(Location::RegisterLocation(EAX));
532 return summary;
458 } 533 }
459 534
460 535
461 void InstanceOfComp::EmitNativeCode(FlowGraphCompiler* compiler) { 536 void InstanceOfComp::EmitNativeCode(FlowGraphCompiler* compiler) {
462 UNIMPLEMENTED(); 537 ASSERT(locs()->in(0).reg() == EAX); // Value.
538 ASSERT(locs()->in(1).reg() == ECX); // Instantiator.
539 ASSERT(locs()->in(2).reg() == EDX); // Instantiator type arguments.
540
541 compiler->GenerateInstanceOf(cid(),
542 token_index(),
543 try_index(),
544 type(),
545 negate_result());
546 ASSERT(locs()->out().reg() == EAX);
463 } 547 }
464 548
465 549
466 LocationSummary* CreateArrayComp::MakeLocationSummary() const { 550 LocationSummary* CreateArrayComp::MakeLocationSummary() const {
467 return NULL; 551 return NULL;
468 } 552 }
469 553
470 554
471 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) { 555 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) {
472 UNIMPLEMENTED(); 556 UNIMPLEMENTED();
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 UNREACHABLE(); 825 UNREACHABLE();
742 } 826 }
743 } 827 }
744 828
745 829
746 } // namespace dart 830 } // namespace dart
747 831
748 #undef __ 832 #undef __
749 833
750 #endif // defined TARGET_ARCH_X64 834 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698