Chromium Code Reviews| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 return CompareNames(test_class_name, function_class_name) && | 48 return CompareNames(test_class_name, function_class_name) && |
| 49 CompareNames(test_function_name, function_name); | 49 CompareNames(test_function_name, function_name); |
| 50 } | 50 } |
| 51 | 51 |
| 52 | 52 |
| 53 bool Intrinsifier::Intrinsify(const Function& function, Assembler* assembler) { | 53 bool Intrinsifier::Intrinsify(const Function& function, Assembler* assembler) { |
| 54 if (!FLAG_intrinsify) return false; | 54 if (!FLAG_intrinsify) return false; |
| 55 const char* function_name = String::Handle(function.name()).ToCString(); | 55 const char* function_name = String::Handle(function.name()).ToCString(); |
| 56 const Class& function_class = Class::Handle(function.Owner()); | 56 const Class& function_class = Class::Handle(function.Owner()); |
| 57 const char* class_name = String::Handle(function_class.Name()).ToCString(); | 57 const char* class_name = String::Handle(function_class.Name()).ToCString(); |
| 58 // Only core library methods can be intrinsified. | 58 // Only core library methods can be intrinsified. |
|
siva
2012/08/23 01:08:37
Ditto.
srdjan
2012/08/23 01:10:46
Done.
| |
| 59 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 59 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 60 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); | 60 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); |
| 61 const Library& math_lib = Library::Handle(Library::MathLibrary()); | |
| 61 if ((function_class.library() != core_lib.raw()) && | 62 if ((function_class.library() != core_lib.raw()) && |
| 62 (function_class.library() != core_impl_lib.raw())) { | 63 (function_class.library() != core_impl_lib.raw()) && |
| 64 (function_class.library() != math_lib.raw())) { | |
| 63 return false; | 65 return false; |
| 64 } | 66 } |
| 65 #define FIND_INTRINSICS(test_class_name, test_function_name, destination) \ | 67 #define FIND_INTRINSICS(test_class_name, test_function_name, destination) \ |
| 66 if (TestFunction(function, \ | 68 if (TestFunction(function, \ |
| 67 class_name, function_name, \ | 69 class_name, function_name, \ |
| 68 #test_class_name, #test_function_name)) { \ | 70 #test_class_name, #test_function_name)) { \ |
| 69 return destination(assembler); \ | 71 return destination(assembler); \ |
| 70 } \ | 72 } \ |
| 71 | 73 |
| 72 INTRINSIC_LIST(FIND_INTRINSICS); | 74 INTRINSIC_LIST(FIND_INTRINSICS); |
| 73 #undef FIND_INTRINSICS | 75 #undef FIND_INTRINSICS |
| 74 return false; | 76 return false; |
| 75 } | 77 } |
| 76 | 78 |
| 77 } // namespace dart | 79 } // namespace dart |
| OLD | NEW |