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

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

Issue 10917005: Add explicit class checks: LoadVMField. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: removed now unused helper 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 | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/cha.h" 7 #include "vm/cha.h"
8 #include "vm/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/hash_map.h" 9 #include "vm/hash_map.h"
10 #include "vm/il_printer.h" 10 #include "vm/il_printer.h"
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 case MethodRecognizer::kObjectArrayLength: 514 case MethodRecognizer::kObjectArrayLength:
515 case MethodRecognizer::kImmutableArrayLength: 515 case MethodRecognizer::kImmutableArrayLength:
516 length_offset = Array::length_offset(); 516 length_offset = Array::length_offset();
517 break; 517 break;
518 case MethodRecognizer::kGrowableArrayLength: 518 case MethodRecognizer::kGrowableArrayLength:
519 length_offset = GrowableObjectArray::length_offset(); 519 length_offset = GrowableObjectArray::length_offset();
520 break; 520 break;
521 default: 521 default:
522 UNREACHABLE(); 522 UNREACHABLE();
523 } 523 }
524 // Check receiver class.
525 AddCheckClass(instr, comp, comp->ArgumentAt(0)->value()->CopyValue());
526
524 LoadVMFieldComp* load = new LoadVMFieldComp( 527 LoadVMFieldComp* load = new LoadVMFieldComp(
525 comp->ArgumentAt(0)->value(), 528 comp->ArgumentAt(0)->value(),
526 length_offset, 529 length_offset,
527 Type::ZoneHandle(Type::SmiType())); 530 Type::ZoneHandle(Type::SmiType()));
528 load->set_result_cid(kSmiCid); 531 load->set_result_cid(kSmiCid);
529 load->set_original(comp);
530 load->set_ic_data(comp->ic_data());
531 instr->set_computation(load); 532 instr->set_computation(load);
532 RemovePushArguments(comp); 533 RemovePushArguments(comp);
533 return true; 534 return true;
534 } 535 }
535 536
536 if (recognized_kind == MethodRecognizer::kStringBaseLength) { 537 if (recognized_kind == MethodRecognizer::kStringBaseLength) {
537 if (!HasOneTarget(ic_data)) { 538 if (!HasOneTarget(ic_data)) {
538 // Target is not only StringBase_get_length. 539 // Target is not only StringBase_get_length.
539 return false; 540 return false;
540 } 541 }
541 ASSERT(HasOneTarget(ic_data)); 542 // Check receiver class.
543 AddCheckClass(instr, comp, comp->ArgumentAt(0)->value()->CopyValue());
544
542 LoadVMFieldComp* load = new LoadVMFieldComp( 545 LoadVMFieldComp* load = new LoadVMFieldComp(
543 comp->ArgumentAt(0)->value(), 546 comp->ArgumentAt(0)->value(),
544 String::length_offset(), 547 String::length_offset(),
545 Type::ZoneHandle(Type::SmiType())); 548 Type::ZoneHandle(Type::SmiType()));
546 load->set_result_cid(kSmiCid); 549 load->set_result_cid(kSmiCid);
547 load->set_original(comp);
548 load->set_ic_data(comp->ic_data());
549 instr->set_computation(load); 550 instr->set_computation(load);
550 RemovePushArguments(comp); 551 RemovePushArguments(comp);
551 return true; 552 return true;
552 } 553 }
553 return false; 554 return false;
554 } 555 }
555 556
556 557
557 // Inline only simple, frequently called core library methods. 558 // Inline only simple, frequently called core library methods.
558 bool FlowGraphOptimizer::TryInlineInstanceMethod(BindInstr* instr, 559 bool FlowGraphOptimizer::TryInlineInstanceMethod(BindInstr* instr,
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map. 1070 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map.
1070 OptimizeRecursive(child, &child_map); 1071 OptimizeRecursive(child, &child_map);
1071 } else { 1072 } else {
1072 OptimizeRecursive(child, map); // Reuse map for the last child. 1073 OptimizeRecursive(child, map); // Reuse map for the last child.
1073 } 1074 }
1074 } 1075 }
1075 } 1076 }
1076 1077
1077 1078
1078 } // namespace dart 1079 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698