| 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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 ConstructorCallNode* node, | 1011 ConstructorCallNode* node, |
| 1011 intptr_t start_index, | 1012 intptr_t start_index, |
| 1012 ZoneGrowableArray<Value*>* args) { | 1013 ZoneGrowableArray<Value*>* args) { |
| 1013 const Class& cls = Class::ZoneHandle(node->constructor().owner()); | 1014 const Class& cls = Class::ZoneHandle(node->constructor().owner()); |
| 1014 ASSERT(cls.HasTypeArguments() && !node->constructor().IsFactory()); | 1015 ASSERT(cls.HasTypeArguments() && !node->constructor().IsFactory()); |
| 1015 if (node->type_arguments().IsNull() || | 1016 if (node->type_arguments().IsNull() || |
| 1016 node->type_arguments().IsInstantiated()) { | 1017 node->type_arguments().IsInstantiated()) { |
| 1017 AddInstruction( | 1018 AddInstruction( |
| 1018 new BindInstr(start_index, new ConstantVal(node->type_arguments()))); | 1019 new BindInstr(start_index, new ConstantVal(node->type_arguments()))); |
| 1019 args->Add(new TempVal(start_index)); | 1020 args->Add(new TempVal(start_index)); |
| 1020 // Null instantiator. | 1021 // No instantiator required. |
| 1022 const Smi& no_instantiator = |
| 1023 Smi::ZoneHandle(Smi::New(StubCode::kNoInstantiator)); |
| 1021 AddInstruction(new BindInstr( | 1024 AddInstruction(new BindInstr( |
| 1022 start_index + 1, new ConstantVal(Object::ZoneHandle()))); | 1025 start_index + 1, new ConstantVal(no_instantiator))); |
| 1023 args->Add(new TempVal(start_index + 1)); | 1026 args->Add(new TempVal(start_index + 1)); |
| 1024 return; | 1027 return; |
| 1025 } | 1028 } |
| 1026 // The type arguments are uninstantiated. | 1029 // The type arguments are uninstantiated. |
| 1027 // Place holder to hold uninstantiated constructor type arguments. | 1030 // Place holder to hold uninstantiated constructor type arguments. |
| 1028 AddInstruction(new BindInstr(start_index, | 1031 AddInstruction(new BindInstr(start_index, |
| 1029 new ConstantVal(Object::ZoneHandle()))); | 1032 new ConstantVal(Object::ZoneHandle()))); |
| 1030 Value* instantiator_value = | 1033 Value* instantiator_value = |
| 1031 BuildInstantiatorTypeArguments(node->token_index(), start_index + 1); | 1034 BuildInstantiatorTypeArguments(node->token_index(), start_index + 1); |
| 1032 AddInstruction(new PickTempInstr(start_index + 2, start_index + 1)); | 1035 AddInstruction(new PickTempInstr(start_index + 2, start_index + 1)); |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1960 char* chars = reinterpret_cast<char*>( | 1963 char* chars = reinterpret_cast<char*>( |
| 1961 Isolate::Current()->current_zone()->Allocate(len)); | 1964 Isolate::Current()->current_zone()->Allocate(len)); |
| 1962 OS::SNPrint(chars, len, kFormat, function_name, reason); | 1965 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 1963 const Error& error = Error::Handle( | 1966 const Error& error = Error::Handle( |
| 1964 LanguageError::New(String::Handle(String::New(chars)))); | 1967 LanguageError::New(String::Handle(String::New(chars)))); |
| 1965 Isolate::Current()->long_jump_base()->Jump(1, error); | 1968 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 1966 } | 1969 } |
| 1967 | 1970 |
| 1968 | 1971 |
| 1969 } // namespace dart | 1972 } // namespace dart |
| OLD | NEW |