| 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 "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| 11 #include "vm/os.h" | 11 #include "vm/os.h" |
| 12 #include "vm/parser.h" | 12 #include "vm/parser.h" |
| 13 #include "vm/stub_code.h" |
| 13 | 14 |
| 14 namespace dart { | 15 namespace dart { |
| 15 | 16 |
| 16 DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph."); | 17 DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph."); |
| 17 DECLARE_FLAG(bool, enable_type_checks); | 18 DECLARE_FLAG(bool, enable_type_checks); |
| 18 DECLARE_FLAG(bool, print_ast); | 19 DECLARE_FLAG(bool, print_ast); |
| 19 | 20 |
| 20 void EffectGraphVisitor::Append(const EffectGraphVisitor& other_fragment) { | 21 void EffectGraphVisitor::Append(const EffectGraphVisitor& other_fragment) { |
| 21 ASSERT(is_open()); | 22 ASSERT(is_open()); |
| 22 if (other_fragment.is_empty()) return; | 23 if (other_fragment.is_empty()) return; |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 ConstructorCallNode* node, | 1100 ConstructorCallNode* node, |
| 1100 intptr_t start_index, | 1101 intptr_t start_index, |
| 1101 ZoneGrowableArray<Value*>* args) { | 1102 ZoneGrowableArray<Value*>* args) { |
| 1102 const Class& cls = Class::ZoneHandle(node->constructor().owner()); | 1103 const Class& cls = Class::ZoneHandle(node->constructor().owner()); |
| 1103 ASSERT(cls.HasTypeArguments() && !node->constructor().IsFactory()); | 1104 ASSERT(cls.HasTypeArguments() && !node->constructor().IsFactory()); |
| 1104 if (node->type_arguments().IsNull() || | 1105 if (node->type_arguments().IsNull() || |
| 1105 node->type_arguments().IsInstantiated()) { | 1106 node->type_arguments().IsInstantiated()) { |
| 1106 AddInstruction( | 1107 AddInstruction( |
| 1107 new BindInstr(start_index, new ConstantVal(node->type_arguments()))); | 1108 new BindInstr(start_index, new ConstantVal(node->type_arguments()))); |
| 1108 args->Add(new TempVal(start_index)); | 1109 args->Add(new TempVal(start_index)); |
| 1109 // Null instantiator. | 1110 // No instantiator required. |
| 1111 const Smi& no_instantiator = |
| 1112 Smi::ZoneHandle(Smi::New(StubCode::kNoInstantiator)); |
| 1110 AddInstruction(new BindInstr( | 1113 AddInstruction(new BindInstr( |
| 1111 start_index + 1, new ConstantVal(Object::ZoneHandle()))); | 1114 start_index + 1, new ConstantVal(no_instantiator))); |
| 1112 args->Add(new TempVal(start_index + 1)); | 1115 args->Add(new TempVal(start_index + 1)); |
| 1113 return; | 1116 return; |
| 1114 } | 1117 } |
| 1115 // The type arguments are uninstantiated. | 1118 // The type arguments are uninstantiated. |
| 1116 // Place holder to hold uninstantiated constructor type arguments. | 1119 // Place holder to hold uninstantiated constructor type arguments. |
| 1117 AddInstruction(new BindInstr(start_index, | 1120 AddInstruction(new BindInstr(start_index, |
| 1118 new ConstantVal(Object::ZoneHandle()))); | 1121 new ConstantVal(Object::ZoneHandle()))); |
| 1119 Value* instantiator_value = | 1122 Value* instantiator_value = |
| 1120 BuildInstantiatorTypeArguments(node->token_index(), start_index + 1); | 1123 BuildInstantiatorTypeArguments(node->token_index(), start_index + 1); |
| 1121 AddInstruction(new PickTempInstr(start_index + 2, start_index + 1)); | 1124 AddInstruction(new PickTempInstr(start_index + 2, start_index + 1)); |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 char* chars = reinterpret_cast<char*>( | 2062 char* chars = reinterpret_cast<char*>( |
| 2060 Isolate::Current()->current_zone()->Allocate(len)); | 2063 Isolate::Current()->current_zone()->Allocate(len)); |
| 2061 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2064 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2062 const Error& error = Error::Handle( | 2065 const Error& error = Error::Handle( |
| 2063 LanguageError::New(String::Handle(String::New(chars)))); | 2066 LanguageError::New(String::Handle(String::New(chars)))); |
| 2064 Isolate::Current()->long_jump_base()->Jump(1, error); | 2067 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2065 } | 2068 } |
| 2066 | 2069 |
| 2067 | 2070 |
| 2068 } // namespace dart | 2071 } // namespace dart |
| OLD | NEW |