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 // Class for intrinsifying functions. | 4 // Class for intrinsifying functions. |
5 | 5 |
6 #include "vm/intrinsifier.h" | 6 #include "vm/intrinsifier.h" |
7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
8 #include "vm/object.h" | 8 #include "vm/object.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 | 47 |
48 // Returns true if the function matches function_name and class_name, with | 48 // Returns true if the function matches function_name and class_name, with |
49 // special recognition of corelib private classes. | 49 // special recognition of corelib private classes. |
50 static bool TestFunction(const Function& function, | 50 static bool TestFunction(const Function& function, |
51 const char* function_class_name, | 51 const char* function_class_name, |
52 const char* function_name, | 52 const char* function_name, |
53 const char* test_class_name, | 53 const char* test_class_name, |
54 const char* test_function_name) { | 54 const char* test_function_name) { |
| 55 // If test_function_name starts with a '.' we use that to indicate |
| 56 // that it is a named constructor in the class. Therefore, if |
| 57 // the class matches and the rest of the method name starting with |
| 58 // the dot matches, we have found a match. |
| 59 if (test_function_name[0] == '.') { |
| 60 function_name = strstr(function_name, "."); |
| 61 if (function_name == NULL) { |
| 62 return false; |
| 63 } |
| 64 } |
55 return CompareNames(test_class_name, function_class_name) && | 65 return CompareNames(test_class_name, function_class_name) && |
56 CompareNames(test_function_name, function_name); | 66 CompareNames(test_function_name, function_name); |
57 } | 67 } |
58 | 68 |
59 | 69 |
60 bool Intrinsifier::CanIntrinsify(const Function& function) { | 70 bool Intrinsifier::CanIntrinsify(const Function& function) { |
61 if (!FLAG_intrinsify) return false; | 71 if (!FLAG_intrinsify) return false; |
62 // Closure functions may have different arguments. | 72 // Closure functions may have different arguments. |
63 if (function.IsClosureFunction()) return false; | 73 if (function.IsClosureFunction()) return false; |
64 const char* function_name = String::Handle(function.name()).ToCString(); | 74 const char* function_name = String::Handle(function.name()).ToCString(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 #test_class_name, #test_function_name)) { \ | 108 #test_class_name, #test_function_name)) { \ |
99 return destination(assembler); \ | 109 return destination(assembler); \ |
100 } \ | 110 } \ |
101 | 111 |
102 INTRINSIC_LIST(FIND_INTRINSICS); | 112 INTRINSIC_LIST(FIND_INTRINSICS); |
103 #undef FIND_INTRINSICS | 113 #undef FIND_INTRINSICS |
104 return false; | 114 return false; |
105 } | 115 } |
106 | 116 |
107 } // namespace dart | 117 } // namespace dart |
OLD | NEW |