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

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

Issue 10872096: Simplify EmitTestAndCall and eliminated excessive code generation (two Smi tests emitted). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « no previous file | runtime/vm/flow_graph_compiler_ia32.h » ('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_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 instr->PrintTo(&f); 454 instr->PrintTo(&f);
455 assembler()->Comment("%s", buffer); 455 assembler()->Comment("%s", buffer);
456 } 456 }
457 457
458 458
459 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, 459 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
460 Register class_id_reg, 460 Register class_id_reg,
461 intptr_t arg_count, 461 intptr_t arg_count,
462 const Array& arg_names, 462 const Array& arg_names,
463 Label* deopt, 463 Label* deopt,
464 Label* done,
465 intptr_t deopt_id, 464 intptr_t deopt_id,
466 intptr_t token_index, 465 intptr_t token_index,
467 intptr_t try_index, 466 intptr_t try_index,
468 LocationSummary* locs) { 467 LocationSummary* locs) {
469 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0)); 468 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0));
470 Label match_found; 469 Label match_found;
471 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { 470 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) {
472 const bool is_last_check = (i == (ic_data.NumberOfChecks() - 1)); 471 const bool is_last_check = (i == (ic_data.NumberOfChecks() - 1));
473 Label next_test; 472 Label next_test;
474 assembler()->cmpl(class_id_reg, Immediate(ic_data.GetReceiverClassIdAt(i))); 473 assembler()->cmpl(class_id_reg, Immediate(ic_data.GetReceiverClassIdAt(i)));
475 if (is_last_check) { 474 if (is_last_check) {
476 assembler()->j(NOT_EQUAL, deopt); 475 assembler()->j(NOT_EQUAL, deopt);
477 } else { 476 } else {
478 assembler()->j(NOT_EQUAL, &next_test); 477 assembler()->j(NOT_EQUAL, &next_test);
479 } 478 }
480 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(i)); 479 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(i));
481 GenerateStaticCall(deopt_id, 480 GenerateStaticCall(deopt_id,
482 token_index, 481 token_index,
483 try_index, 482 try_index,
484 target, 483 target,
485 arg_count, 484 arg_count,
486 arg_names, 485 arg_names,
487 locs); 486 locs);
488 if (!is_last_check) { 487 if (!is_last_check) {
489 assembler()->jmp(&match_found); 488 assembler()->jmp(&match_found);
490 } 489 }
491 assembler()->Bind(&next_test); 490 assembler()->Bind(&next_test);
492 } 491 }
493 assembler()->Bind(&match_found); 492 assembler()->Bind(&match_found);
494 if (done != NULL) {
495 assembler()->jmp(done);
496 }
497 } 493 }
498 494
499 495
500 void FlowGraphCompiler::EmitDoubleCompareBranch(Condition true_condition, 496 void FlowGraphCompiler::EmitDoubleCompareBranch(Condition true_condition,
501 XmmRegister left, 497 XmmRegister left,
502 XmmRegister right, 498 XmmRegister right,
503 BranchInstr* branch) { 499 BranchInstr* branch) {
504 ASSERT(branch != NULL); 500 ASSERT(branch != NULL);
505 assembler()->comisd(left, right); 501 assembler()->comisd(left, right);
506 BlockEntryInstr* nan_result = (true_condition == NOT_EQUAL) ? 502 BlockEntryInstr* nan_result = (true_condition == NOT_EQUAL) ?
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 return; 734 return;
739 } 735 }
740 } 736 }
741 737
742 // This move is not blocked. 738 // This move is not blocked.
743 EmitMove(index); 739 EmitMove(index);
744 } 740 }
745 741
746 742
747 } // namespace dart 743 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698