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/code_descriptors.h" | 8 #include "vm/code_descriptors.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 const String& function_name = String::Handle(function.name()); | 1682 const String& function_name = String::Handle(function.name()); |
1683 const String& expected_function_name = String::Handle( | 1683 const String& expected_function_name = String::Handle( |
1684 String::Concat(expected_class_name, String::Handle(Symbols::Dot()))); | 1684 String::Concat(expected_class_name, String::Handle(Symbols::Dot()))); |
1685 return function_name.Equals(expected_function_name); | 1685 return function_name.Equals(expected_function_name); |
1686 } | 1686 } |
1687 | 1687 |
1688 | 1688 |
1689 static intptr_t GetResultCidOfConstructor(ConstructorCallNode* node) { | 1689 static intptr_t GetResultCidOfConstructor(ConstructorCallNode* node) { |
1690 const Function& function = node->constructor(); | 1690 const Function& function = node->constructor(); |
1691 const Class& function_class = Class::Handle(function.Owner()); | 1691 const Class& function_class = Class::Handle(function.Owner()); |
1692 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); | 1692 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
1693 | 1693 |
1694 if (function_class.library() != core_impl_lib.raw()) { | 1694 if (function_class.library() != core_lib.raw()) { |
1695 return kDynamicCid; | 1695 return kDynamicCid; |
1696 } | 1696 } |
1697 | 1697 |
1698 if (node->constructor().IsFactory()) { | 1698 if (node->constructor().IsFactory()) { |
1699 if ((function_class.Name() == Symbols::ListImplementation()) && | 1699 if ((function_class.Name() == Symbols::ListImplementation()) && |
1700 (function.name() == Symbols::ListFactory())) { | 1700 (function.name() == Symbols::ListFactory())) { |
1701 // If there are no arguments then the result is guaranteed to be a | 1701 // If there are no arguments then the result is guaranteed to be a |
1702 // GrowableObjectArray. However if there is an argument the result | 1702 // GrowableObjectArray. However if there is an argument the result |
1703 // is not guaranteed to be a fixed size array because the argument | 1703 // is not guaranteed to be a fixed size array because the argument |
1704 // can be null. | 1704 // can be null. |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2060 Value* call_pos = Bind( | 2060 Value* call_pos = Bind( |
2061 new ConstantInstr(Smi::ZoneHandle(Smi::New(node->token_pos())))); | 2061 new ConstantInstr(Smi::ZoneHandle(Smi::New(node->token_pos())))); |
2062 arguments->Add(PushArgument(call_pos)); | 2062 arguments->Add(PushArgument(call_pos)); |
2063 // Function name argument. | 2063 // Function name argument. |
2064 const String& method_name = String::ZoneHandle(Symbols::New(getter_name)); | 2064 const String& method_name = String::ZoneHandle(Symbols::New(getter_name)); |
2065 Value* method_name_value = Bind(new ConstantInstr(method_name)); | 2065 Value* method_name_value = Bind(new ConstantInstr(method_name)); |
2066 arguments->Add(PushArgument(method_name_value)); | 2066 arguments->Add(PushArgument(method_name_value)); |
2067 const String& cls_name = String::Handle(Symbols::NoSuchMethodError()); | 2067 const String& cls_name = String::Handle(Symbols::NoSuchMethodError()); |
2068 const String& func_name = String::Handle(Symbols::ThrowNew()); | 2068 const String& func_name = String::Handle(Symbols::ThrowNew()); |
2069 const Class& cls = Class::Handle( | 2069 const Class& cls = Class::Handle( |
2070 Library::Handle(Library::CoreImplLibrary()).LookupClass(cls_name)); | 2070 Library::Handle(Library::CoreLibrary()).LookupClass(cls_name)); |
2071 ASSERT(!cls.IsNull()); | 2071 ASSERT(!cls.IsNull()); |
2072 getter_function = Resolver::ResolveStatic(cls, | 2072 getter_function = Resolver::ResolveStatic(cls, |
2073 func_name, | 2073 func_name, |
2074 arguments->length(), | 2074 arguments->length(), |
2075 Array::ZoneHandle(), | 2075 Array::ZoneHandle(), |
2076 Resolver::kIsQualified); | 2076 Resolver::kIsQualified); |
2077 ASSERT(!getter_function.IsNull()); | 2077 ASSERT(!getter_function.IsNull()); |
2078 } | 2078 } |
2079 } | 2079 } |
2080 StaticCallInstr* call = new StaticCallInstr(node->token_pos(), | 2080 StaticCallInstr* call = new StaticCallInstr(node->token_pos(), |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2846 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 2846 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
2847 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2847 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
2848 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2848 OS::SNPrint(chars, len, kFormat, function_name, reason); |
2849 const Error& error = Error::Handle( | 2849 const Error& error = Error::Handle( |
2850 LanguageError::New(String::Handle(String::New(chars)))); | 2850 LanguageError::New(String::Handle(String::New(chars)))); |
2851 Isolate::Current()->long_jump_base()->Jump(1, error); | 2851 Isolate::Current()->long_jump_base()->Jump(1, error); |
2852 } | 2852 } |
2853 | 2853 |
2854 | 2854 |
2855 } // namespace dart | 2855 } // namespace dart |
OLD | NEW |