| OLD | NEW |
| 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 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1869 Append(for_left_value); | 1869 Append(for_left_value); |
| 1870 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); | 1870 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); |
| 1871 arguments->Add(push_left); | 1871 arguments->Add(push_left); |
| 1872 | 1872 |
| 1873 ValueGraphVisitor for_right_value(owner()); | 1873 ValueGraphVisitor for_right_value(owner()); |
| 1874 node->right()->Visit(&for_right_value); | 1874 node->right()->Visit(&for_right_value); |
| 1875 Append(for_right_value); | 1875 Append(for_right_value); |
| 1876 PushArgumentInstr* push_right = PushArgument(for_right_value.value()); | 1876 PushArgumentInstr* push_right = PushArgument(for_right_value.value()); |
| 1877 arguments->Add(push_right); | 1877 arguments->Add(push_right); |
| 1878 | 1878 |
| 1879 const intptr_t kNumArgsChecked = 2; |
| 1879 Definition* result = new(Z) InstanceCallInstr( | 1880 Definition* result = new(Z) InstanceCallInstr( |
| 1880 node->token_pos(), | 1881 node->token_pos(), |
| 1881 Symbols::EqualOperator(), | 1882 Symbols::EqualOperator(), |
| 1882 Token::kEQ, // Result is negated later for kNE. | 1883 Token::kEQ, // Result is negated later for kNE. |
| 1883 arguments, | 1884 arguments, |
| 1884 Object::null_array(), | 1885 Object::null_array(), |
| 1885 2, | 1886 kNumArgsChecked, |
| 1886 owner()->ic_data_array()); | 1887 owner()->ic_data_array()); |
| 1887 if (node->kind() == Token::kNE) { | 1888 if (node->kind() == Token::kNE) { |
| 1888 if (Isolate::Current()->TypeChecksEnabled() || | 1889 if (Isolate::Current()->TypeChecksEnabled() || |
| 1889 Isolate::Current()->AssertsEnabled()) { | 1890 Isolate::Current()->AssertsEnabled()) { |
| 1890 Value* value = Bind(result); | 1891 Value* value = Bind(result); |
| 1891 result = new(Z) AssertBooleanInstr(node->token_pos(), value); | 1892 result = new(Z) AssertBooleanInstr(node->token_pos(), value); |
| 1892 } | 1893 } |
| 1893 Value* value = Bind(result); | 1894 Value* value = Bind(result); |
| 1894 result = new(Z) BooleanNegateInstr(value); | 1895 result = new(Z) BooleanNegateInstr(value); |
| 1895 } | 1896 } |
| (...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3086 arguments->Add(PushArgument(value)); | 3087 arguments->Add(PushArgument(value)); |
| 3087 } | 3088 } |
| 3088 | 3089 |
| 3089 | 3090 |
| 3090 void EffectGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { | 3091 void EffectGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { |
| 3091 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 3092 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 3092 new(Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 3093 new(Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 3093 BuildInstanceSetterArguments(node, arguments, kResultNotNeeded); | 3094 BuildInstanceSetterArguments(node, arguments, kResultNotNeeded); |
| 3094 const String& name = | 3095 const String& name = |
| 3095 String::ZoneHandle(Z, Field::SetterSymbol(node->field_name())); | 3096 String::ZoneHandle(Z, Field::SetterSymbol(node->field_name())); |
| 3097 const intptr_t kNumArgsChecked = 1; // Do not check value type. |
| 3096 InstanceCallInstr* call = new(Z) InstanceCallInstr(node->token_pos(), | 3098 InstanceCallInstr* call = new(Z) InstanceCallInstr(node->token_pos(), |
| 3097 name, | 3099 name, |
| 3098 Token::kSET, | 3100 Token::kSET, |
| 3099 arguments, | 3101 arguments, |
| 3100 Object::null_array(), | 3102 Object::null_array(), |
| 3101 2, // Checked arg count. | 3103 kNumArgsChecked, |
| 3102 owner()->ic_data_array()); | 3104 owner()->ic_data_array()); |
| 3103 ReturnDefinition(call); | 3105 ReturnDefinition(call); |
| 3104 } | 3106 } |
| 3105 | 3107 |
| 3106 | 3108 |
| 3107 void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { | 3109 void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { |
| 3108 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 3110 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 3109 new(Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 3111 new(Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 3110 BuildInstanceSetterArguments(node, arguments, kResultNeeded); | 3112 BuildInstanceSetterArguments(node, arguments, kResultNeeded); |
| 3111 const String& name = | 3113 const String& name = |
| 3112 String::ZoneHandle(Z, Field::SetterSymbol(node->field_name())); | 3114 String::ZoneHandle(Z, Field::SetterSymbol(node->field_name())); |
| 3115 const intptr_t kNumArgsChecked = 1; // Do not check value type. |
| 3113 Do(new(Z) InstanceCallInstr(node->token_pos(), | 3116 Do(new(Z) InstanceCallInstr(node->token_pos(), |
| 3114 name, | 3117 name, |
| 3115 Token::kSET, | 3118 Token::kSET, |
| 3116 arguments, | 3119 arguments, |
| 3117 Object::null_array(), | 3120 Object::null_array(), |
| 3118 2, // Checked argument count. | 3121 kNumArgsChecked, |
| 3119 owner()->ic_data_array())); | 3122 owner()->ic_data_array())); |
| 3120 ReturnDefinition(BuildLoadExprTemp()); | 3123 ReturnDefinition(BuildLoadExprTemp()); |
| 3121 } | 3124 } |
| 3122 | 3125 |
| 3123 | 3126 |
| 3124 void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { | 3127 void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { |
| 3125 const String& getter_name = | 3128 const String& getter_name = |
| 3126 String::ZoneHandle(Z, Field::GetterSymbol(node->field_name())); | 3129 String::ZoneHandle(Z, Field::GetterSymbol(node->field_name())); |
| 3127 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 3130 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 3128 new(Z) ZoneGrowableArray<PushArgumentInstr*>(); | 3131 new(Z) ZoneGrowableArray<PushArgumentInstr*>(); |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3731 arguments, | 3734 arguments, |
| 3732 owner()->ic_data_array()); | 3735 owner()->ic_data_array()); |
| 3733 if (result_is_needed) { | 3736 if (result_is_needed) { |
| 3734 Do(store); | 3737 Do(store); |
| 3735 return BuildLoadExprTemp(); | 3738 return BuildLoadExprTemp(); |
| 3736 } else { | 3739 } else { |
| 3737 return store; | 3740 return store; |
| 3738 } | 3741 } |
| 3739 } else { | 3742 } else { |
| 3740 // Generate dynamic call to operator []=. | 3743 // Generate dynamic call to operator []=. |
| 3741 const intptr_t checked_argument_count = 3; | 3744 const intptr_t checked_argument_count = 2; // Do not check for value type. |
| 3742 const String& name = | 3745 const String& name = |
| 3743 String::ZoneHandle(Z, Symbols::New(Token::Str(Token::kASSIGN_INDEX))); | 3746 String::ZoneHandle(Z, Symbols::New(Token::Str(Token::kASSIGN_INDEX))); |
| 3744 InstanceCallInstr* store = | 3747 InstanceCallInstr* store = |
| 3745 new(Z) InstanceCallInstr(node->token_pos(), | 3748 new(Z) InstanceCallInstr(node->token_pos(), |
| 3746 name, | 3749 name, |
| 3747 Token::kASSIGN_INDEX, | 3750 Token::kASSIGN_INDEX, |
| 3748 arguments, | 3751 arguments, |
| 3749 Object::null_array(), | 3752 Object::null_array(), |
| 3750 checked_argument_count, | 3753 checked_argument_count, |
| 3751 owner()->ic_data_array()); | 3754 owner()->ic_data_array()); |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4407 Report::MessageF(Report::kBailout, | 4410 Report::MessageF(Report::kBailout, |
| 4408 Script::Handle(function.script()), | 4411 Script::Handle(function.script()), |
| 4409 function.token_pos(), | 4412 function.token_pos(), |
| 4410 "FlowGraphBuilder Bailout: %s %s", | 4413 "FlowGraphBuilder Bailout: %s %s", |
| 4411 String::Handle(function.name()).ToCString(), | 4414 String::Handle(function.name()).ToCString(), |
| 4412 reason); | 4415 reason); |
| 4413 UNREACHABLE(); | 4416 UNREACHABLE(); |
| 4414 } | 4417 } |
| 4415 | 4418 |
| 4416 } // namespace dart | 4419 } // namespace dart |
| OLD | NEW |