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

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

Issue 15946002: Allow breakpoints on strict equal (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 1390
1391 1391
1392 void FlowGraphOptimizer::InlineStringIsEmptyGetter(InstanceCallInstr* call) { 1392 void FlowGraphOptimizer::InlineStringIsEmptyGetter(InstanceCallInstr* call) {
1393 AddReceiverCheck(call); 1393 AddReceiverCheck(call);
1394 1394
1395 LoadFieldInstr* load = BuildLoadStringLength(call->ArgumentAt(0)); 1395 LoadFieldInstr* load = BuildLoadStringLength(call->ArgumentAt(0));
1396 InsertBefore(call, load, NULL, Definition::kValue); 1396 InsertBefore(call, load, NULL, Definition::kValue);
1397 1397
1398 ConstantInstr* zero = flow_graph()->GetConstant(Smi::Handle(Smi::New(0))); 1398 ConstantInstr* zero = flow_graph()->GetConstant(Smi::Handle(Smi::New(0)));
1399 StrictCompareInstr* compare = 1399 StrictCompareInstr* compare =
1400 new StrictCompareInstr(Token::kEQ_STRICT, 1400 new StrictCompareInstr(call->token_pos(),
1401 Token::kEQ_STRICT,
1401 new Value(load), 1402 new Value(load),
1402 new Value(zero)); 1403 new Value(zero));
1403 ReplaceCall(call, compare); 1404 ReplaceCall(call, compare);
1404 } 1405 }
1405 1406
1406 1407
1407 void FlowGraphOptimizer::InlineObjectCid(InstanceCallInstr* call) { 1408 void FlowGraphOptimizer::InlineObjectCid(InstanceCallInstr* call) {
1408 LoadClassIdInstr* load = new LoadClassIdInstr(new Value(call->ArgumentAt(0))); 1409 LoadClassIdInstr* load = new LoadClassIdInstr(new Value(call->ArgumentAt(0)));
1409 ReplaceCall(call, load); 1410 ReplaceCall(call, load);
1410 } 1411 }
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 2601
2601 2602
2602 template <typename T> 2603 template <typename T>
2603 bool FlowGraphOptimizer::StrictifyEqualityCompare( 2604 bool FlowGraphOptimizer::StrictifyEqualityCompare(
2604 EqualityCompareInstr* compare, 2605 EqualityCompareInstr* compare,
2605 T current_instruction) const { 2606 T current_instruction) const {
2606 if (CanStrictifyEqualityCompare(compare)) { 2607 if (CanStrictifyEqualityCompare(compare)) {
2607 Token::Kind strict_kind = (compare->kind() == Token::kEQ) ? 2608 Token::Kind strict_kind = (compare->kind() == Token::kEQ) ?
2608 Token::kEQ_STRICT : Token::kNE_STRICT; 2609 Token::kEQ_STRICT : Token::kNE_STRICT;
2609 StrictCompareInstr* strict_comp = 2610 StrictCompareInstr* strict_comp =
2610 new StrictCompareInstr(strict_kind, 2611 new StrictCompareInstr(compare->token_pos(),
2612 strict_kind,
2611 compare->left()->CopyWithType(), 2613 compare->left()->CopyWithType(),
2612 compare->right()->CopyWithType()); 2614 compare->right()->CopyWithType());
2613 current_instruction->ReplaceWith(strict_comp, current_iterator()); 2615 current_instruction->ReplaceWith(strict_comp, current_iterator());
2614 return true; 2616 return true;
2615 } 2617 }
2616 return false; 2618 return false;
2617 } 2619 }
2618 2620
2619 2621
2620 template <typename T> 2622 template <typename T>
(...skipping 3364 matching lines...) Expand 10 before | Expand all | Expand 10 after
5985 return join; 5987 return join;
5986 } 5988 }
5987 5989
5988 5990
5989 BranchInstr* BranchSimplifier::CloneBranch(BranchInstr* branch, 5991 BranchInstr* BranchSimplifier::CloneBranch(BranchInstr* branch,
5990 Value* left, 5992 Value* left,
5991 Value* right) { 5993 Value* right) {
5992 ComparisonInstr* comparison = branch->comparison(); 5994 ComparisonInstr* comparison = branch->comparison();
5993 ComparisonInstr* new_comparison = NULL; 5995 ComparisonInstr* new_comparison = NULL;
5994 if (comparison->IsStrictCompare()) { 5996 if (comparison->IsStrictCompare()) {
5995 new_comparison = new StrictCompareInstr(comparison->kind(), left, right); 5997 new_comparison = new StrictCompareInstr(comparison->token_pos(),
5998 comparison->kind(),
5999 left,
6000 right);
5996 } else if (comparison->IsEqualityCompare()) { 6001 } else if (comparison->IsEqualityCompare()) {
5997 EqualityCompareInstr* equality_compare = comparison->AsEqualityCompare(); 6002 EqualityCompareInstr* equality_compare = comparison->AsEqualityCompare();
5998 EqualityCompareInstr* new_equality_compare = 6003 EqualityCompareInstr* new_equality_compare =
5999 new EqualityCompareInstr(equality_compare->token_pos(), 6004 new EqualityCompareInstr(equality_compare->token_pos(),
6000 comparison->kind(), 6005 comparison->kind(),
6001 left, 6006 left,
6002 right, 6007 right,
6003 Array::Handle()); 6008 Array::Handle());
6004 new_equality_compare->set_ic_data(equality_compare->ic_data()); 6009 new_equality_compare->set_ic_data(equality_compare->ic_data());
6005 new_comparison = new_equality_compare; 6010 new_comparison = new_equality_compare;
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
6511 6516
6512 // Insert materializations at environment uses. 6517 // Insert materializations at environment uses.
6513 const Class& cls = Class::Handle(alloc->constructor().Owner()); 6518 const Class& cls = Class::Handle(alloc->constructor().Owner());
6514 for (intptr_t i = 0; i < exits.length(); i++) { 6519 for (intptr_t i = 0; i < exits.length(); i++) {
6515 CreateMaterializationAt(exits[i], alloc, cls, *fields); 6520 CreateMaterializationAt(exits[i], alloc, cls, *fields);
6516 } 6521 }
6517 } 6522 }
6518 6523
6519 6524
6520 } // namespace dart 6525 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698