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

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

Issue 772513003: Revert r42145 to fix co19 tests (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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/code_generator.cc ('k') | runtime/vm/intermediate_language_arm.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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 20 matching lines...) Expand all
31 31
32 namespace dart { 32 namespace dart {
33 33
34 DEFINE_FLAG(bool, eliminate_type_checks, true, 34 DEFINE_FLAG(bool, eliminate_type_checks, true,
35 "Eliminate type checks when allowed by static type analysis."); 35 "Eliminate type checks when allowed by static type analysis.");
36 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree."); 36 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree.");
37 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables."); 37 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables.");
38 DEFINE_FLAG(bool, trace_type_check_elimination, false, 38 DEFINE_FLAG(bool, trace_type_check_elimination, false,
39 "Trace type check elimination at compile time."); 39 "Trace type check elimination at compile time.");
40 40
41 DECLARE_FLAG(bool, enable_asserts);
42 DECLARE_FLAG(bool, enable_type_checks); 41 DECLARE_FLAG(bool, enable_type_checks);
43 DECLARE_FLAG(int, optimization_counter_threshold); 42 DECLARE_FLAG(int, optimization_counter_threshold);
44 DECLARE_FLAG(bool, warn_on_javascript_compatibility); 43 DECLARE_FLAG(bool, warn_on_javascript_compatibility);
45 44
46 // Quick access to the locally defined isolate() method. 45 // Quick access to the locally defined isolate() method.
47 #define I (isolate()) 46 #define I (isolate())
48 47
49 // TODO(srdjan): Allow compiler to add constants as they are encountered in 48 // TODO(srdjan): Allow compiler to add constants as they are encountered in
50 // the compilation. 49 // the compilation.
51 const double kCommonDoubleConstants[] = 50 const double kCommonDoubleConstants[] =
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 return CreateSuccessorFor(true_successor_addresses_); 877 return CreateSuccessorFor(true_successor_addresses_);
879 } 878 }
880 879
881 880
882 BlockEntryInstr* TestGraphVisitor::CreateFalseSuccessor() const { 881 BlockEntryInstr* TestGraphVisitor::CreateFalseSuccessor() const {
883 return CreateSuccessorFor(false_successor_addresses_); 882 return CreateSuccessorFor(false_successor_addresses_);
884 } 883 }
885 884
886 885
887 void TestGraphVisitor::ReturnValue(Value* value) { 886 void TestGraphVisitor::ReturnValue(Value* value) {
888 if (FLAG_enable_type_checks || FLAG_enable_asserts) { 887 if (FLAG_enable_type_checks) {
889 value = Bind(new(I) AssertBooleanInstr(condition_token_pos(), value)); 888 value = Bind(new(I) AssertBooleanInstr(condition_token_pos(), value));
890 } 889 }
891 Value* constant_true = Bind(new(I) ConstantInstr(Bool::True())); 890 Value* constant_true = Bind(new(I) ConstantInstr(Bool::True()));
892 StrictCompareInstr* comp = 891 StrictCompareInstr* comp =
893 new(I) StrictCompareInstr(condition_token_pos(), 892 new(I) StrictCompareInstr(condition_token_pos(),
894 Token::kEQ_STRICT, 893 Token::kEQ_STRICT,
895 value, 894 value,
896 constant_true, 895 constant_true,
897 false); // No number check. 896 false); // No number check.
898 BranchInstr* branch = new(I) BranchInstr(comp); 897 BranchInstr* branch = new(I) BranchInstr(comp);
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 // left: <Expression> 1232 // left: <Expression>
1234 // right: <Expression> } 1233 // right: <Expression> }
1235 void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { 1234 void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) {
1236 // Operators "&&" and "||" cannot be overloaded therefore do not call 1235 // Operators "&&" and "||" cannot be overloaded therefore do not call
1237 // operator. 1236 // operator.
1238 if ((node->kind() == Token::kAND) || (node->kind() == Token::kOR)) { 1237 if ((node->kind() == Token::kAND) || (node->kind() == Token::kOR)) {
1239 // See ValueGraphVisitor::VisitBinaryOpNode. 1238 // See ValueGraphVisitor::VisitBinaryOpNode.
1240 TestGraphVisitor for_left(owner(), node->left()->token_pos()); 1239 TestGraphVisitor for_left(owner(), node->left()->token_pos());
1241 node->left()->Visit(&for_left); 1240 node->left()->Visit(&for_left);
1242 EffectGraphVisitor empty(owner()); 1241 EffectGraphVisitor empty(owner());
1243 if (FLAG_enable_type_checks || FLAG_enable_asserts) { 1242 if (FLAG_enable_type_checks) {
1244 ValueGraphVisitor for_right(owner()); 1243 ValueGraphVisitor for_right(owner());
1245 node->right()->Visit(&for_right); 1244 node->right()->Visit(&for_right);
1246 Value* right_value = for_right.value(); 1245 Value* right_value = for_right.value();
1247 for_right.Do(new(I) AssertBooleanInstr(node->right()->token_pos(), 1246 for_right.Do(new(I) AssertBooleanInstr(node->right()->token_pos(),
1248 right_value)); 1247 right_value));
1249 if (node->kind() == Token::kAND) { 1248 if (node->kind() == Token::kAND) {
1250 Join(for_left, for_right, empty); 1249 Join(for_left, for_right, empty);
1251 } else { 1250 } else {
1252 Join(for_left, empty, for_right); 1251 Join(for_left, empty, for_right);
1253 } 1252 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 // of left is sufficient. 1297 // of left is sufficient.
1299 // AND: left ? right === true : false; 1298 // AND: left ? right === true : false;
1300 // OR: left ? true : right === true; 1299 // OR: left ? true : right === true;
1301 1300
1302 TestGraphVisitor for_test(owner(), node->left()->token_pos()); 1301 TestGraphVisitor for_test(owner(), node->left()->token_pos());
1303 node->left()->Visit(&for_test); 1302 node->left()->Visit(&for_test);
1304 1303
1305 ValueGraphVisitor for_right(owner()); 1304 ValueGraphVisitor for_right(owner());
1306 node->right()->Visit(&for_right); 1305 node->right()->Visit(&for_right);
1307 Value* right_value = for_right.value(); 1306 Value* right_value = for_right.value();
1308 if (FLAG_enable_type_checks|| FLAG_enable_asserts) { 1307 if (FLAG_enable_type_checks) {
1309 right_value = 1308 right_value =
1310 for_right.Bind(new(I) AssertBooleanInstr(node->right()->token_pos(), 1309 for_right.Bind(new(I) AssertBooleanInstr(node->right()->token_pos(),
1311 right_value)); 1310 right_value));
1312 } 1311 }
1313 Value* constant_true = for_right.Bind(new(I) ConstantInstr(Bool::True())); 1312 Value* constant_true = for_right.Bind(new(I) ConstantInstr(Bool::True()));
1314 Value* compare = 1313 Value* compare =
1315 for_right.Bind(new(I) StrictCompareInstr(node->token_pos(), 1314 for_right.Bind(new(I) StrictCompareInstr(node->token_pos(),
1316 Token::kEQ_STRICT, 1315 Token::kEQ_STRICT,
1317 right_value, 1316 right_value,
1318 constant_true, 1317 constant_true,
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 1756
1758 Definition* result = new(I) InstanceCallInstr( 1757 Definition* result = new(I) InstanceCallInstr(
1759 node->token_pos(), 1758 node->token_pos(),
1760 Symbols::EqualOperator(), 1759 Symbols::EqualOperator(),
1761 Token::kEQ, // Result is negated later for kNE. 1760 Token::kEQ, // Result is negated later for kNE.
1762 arguments, 1761 arguments,
1763 Object::null_array(), 1762 Object::null_array(),
1764 2, 1763 2,
1765 owner()->ic_data_array()); 1764 owner()->ic_data_array());
1766 if (node->kind() == Token::kNE) { 1765 if (node->kind() == Token::kNE) {
1767 if (FLAG_enable_type_checks || FLAG_enable_asserts) { 1766 if (FLAG_enable_type_checks) {
1768 Value* value = Bind(result); 1767 Value* value = Bind(result);
1769 result = new(I) AssertBooleanInstr(node->token_pos(), value); 1768 result = new(I) AssertBooleanInstr(node->token_pos(), value);
1770 } 1769 }
1771 Value* value = Bind(result); 1770 Value* value = Bind(result);
1772 result = new(I) BooleanNegateInstr(value); 1771 result = new(I) BooleanNegateInstr(value);
1773 } 1772 }
1774 ReturnDefinition(result); 1773 ReturnDefinition(result);
1775 return; 1774 return;
1776 } 1775 }
1777 1776
(...skipping 25 matching lines...) Expand all
1803 } 1802 }
1804 1803
1805 1804
1806 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { 1805 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) {
1807 // "!" cannot be overloaded, therefore do not call operator. 1806 // "!" cannot be overloaded, therefore do not call operator.
1808 if (node->kind() == Token::kNOT) { 1807 if (node->kind() == Token::kNOT) {
1809 ValueGraphVisitor for_value(owner()); 1808 ValueGraphVisitor for_value(owner());
1810 node->operand()->Visit(&for_value); 1809 node->operand()->Visit(&for_value);
1811 Append(for_value); 1810 Append(for_value);
1812 Value* value = for_value.value(); 1811 Value* value = for_value.value();
1813 if (FLAG_enable_type_checks || FLAG_enable_asserts) { 1812 if (FLAG_enable_type_checks) {
1814 value = 1813 value =
1815 Bind(new(I) AssertBooleanInstr(node->operand()->token_pos(), value)); 1814 Bind(new(I) AssertBooleanInstr(node->operand()->token_pos(), value));
1816 } 1815 }
1817 BooleanNegateInstr* negate = new(I) BooleanNegateInstr(value); 1816 BooleanNegateInstr* negate = new(I) BooleanNegateInstr(value);
1818 ReturnDefinition(negate); 1817 ReturnDefinition(negate);
1819 return; 1818 return;
1820 } 1819 }
1821 1820
1822 ValueGraphVisitor for_value(owner()); 1821 ValueGraphVisitor for_value(owner());
1823 node->operand()->Visit(&for_value); 1822 node->operand()->Visit(&for_value);
(...skipping 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after
4303 Report::MessageF(Report::kBailout, 4302 Report::MessageF(Report::kBailout,
4304 Script::Handle(function.script()), 4303 Script::Handle(function.script()),
4305 function.token_pos(), 4304 function.token_pos(),
4306 "FlowGraphBuilder Bailout: %s %s", 4305 "FlowGraphBuilder Bailout: %s %s",
4307 String::Handle(function.name()).ToCString(), 4306 String::Handle(function.name()).ToCString(),
4308 reason); 4307 reason);
4309 UNREACHABLE(); 4308 UNREACHABLE();
4310 } 4309 }
4311 4310
4312 } // namespace dart 4311 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698