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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
11 #include "vm/locations.h" | 11 #include "vm/locations.h" |
12 #include "vm/object.h" | 12 #include "vm/object.h" |
13 #include "vm/os.h" | 13 #include "vm/os.h" |
14 #include "vm/scopes.h" | 14 #include "vm/scopes.h" |
15 #include "vm/stub_code.h" | 15 #include "vm/stub_code.h" |
| 16 #include "vm/symbols.h" |
16 | 17 |
17 namespace dart { | 18 namespace dart { |
18 | 19 |
19 MethodRecognizer::Kind MethodRecognizer::RecognizeKind( | 20 MethodRecognizer::Kind MethodRecognizer::RecognizeKind( |
20 const Function& function) { | 21 const Function& function) { |
21 // Only core library methods can be recognized. | 22 // Only core library methods can be recognized. |
22 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 23 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
23 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); | 24 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); |
24 const Class& function_class = Class::Handle(function.owner()); | 25 const Class& function_class = Class::Handle(function.owner()); |
25 if ((function_class.library() != core_lib.raw()) && | 26 if ((function_class.library() != core_lib.raw()) && |
26 (function_class.library() != core_impl_lib.raw())) { | 27 (function_class.library() != core_impl_lib.raw())) { |
27 return kUnknown; | 28 return kUnknown; |
28 } | 29 } |
29 const String& recognize_name = String::Handle(function.name()); | 30 const String& recognize_name = String::Handle(function.name()); |
30 const String& recognize_class = String::Handle(function_class.Name()); | 31 const String& recognize_class = String::Handle(function_class.Name()); |
31 String& test_function_name = String::Handle(); | 32 String& test_function_name = String::Handle(); |
32 String& test_class_name = String::Handle(); | 33 String& test_class_name = String::Handle(); |
33 #define RECOGNIZE_FUNCTION(class_name, function_name, enum_name) \ | 34 #define RECOGNIZE_FUNCTION(class_name, function_name, enum_name) \ |
34 test_function_name = String::NewSymbol(#function_name); \ | 35 test_function_name = Symbols::New(#function_name); \ |
35 test_class_name = String::NewSymbol(#class_name); \ | 36 test_class_name = Symbols::New(#class_name); \ |
36 if (recognize_name.Equals(test_function_name) && \ | 37 if (recognize_name.Equals(test_function_name) && \ |
37 recognize_class.Equals(test_class_name)) { \ | 38 recognize_class.Equals(test_class_name)) { \ |
38 return k##enum_name; \ | 39 return k##enum_name; \ |
39 } | 40 } |
40 RECOGNIZED_LIST(RECOGNIZE_FUNCTION) | 41 RECOGNIZED_LIST(RECOGNIZE_FUNCTION) |
41 #undef RECOGNIZE_FUNCTION | 42 #undef RECOGNIZE_FUNCTION |
42 return kUnknown; | 43 return kUnknown; |
43 } | 44 } |
44 | 45 |
45 | 46 |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 1313 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
1313 compiler->GenerateCall(token_pos(), try_index(), &label, | 1314 compiler->GenerateCall(token_pos(), try_index(), &label, |
1314 PcDescriptors::kOther); | 1315 PcDescriptors::kOther); |
1315 __ Drop(2); // Discard type arguments and receiver. | 1316 __ Drop(2); // Discard type arguments and receiver. |
1316 } | 1317 } |
1317 | 1318 |
1318 | 1319 |
1319 #undef __ | 1320 #undef __ |
1320 | 1321 |
1321 } // namespace dart | 1322 } // namespace dart |
OLD | NEW |