| 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 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
| 10 | 10 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 MATH_LIB_INTRINSIC_LIST(SETUP_FUNCTION); | 134 MATH_LIB_INTRINSIC_LIST(SETUP_FUNCTION); |
| 135 | 135 |
| 136 // Set up all dart:typed_data lib functions that can be intrisified. | 136 // Set up all dart:typed_data lib functions that can be intrisified. |
| 137 lib = Library::TypedDataLibrary(); | 137 lib = Library::TypedDataLibrary(); |
| 138 TYPED_DATA_LIB_INTRINSIC_LIST(SETUP_FUNCTION); | 138 TYPED_DATA_LIB_INTRINSIC_LIST(SETUP_FUNCTION); |
| 139 | 139 |
| 140 #undef SETUP_FUNCTION | 140 #undef SETUP_FUNCTION |
| 141 } | 141 } |
| 142 | 142 |
| 143 | 143 |
| 144 bool Intrinsifier::Intrinsify(const Function& function, Assembler* assembler) { | 144 void Intrinsifier::Intrinsify(const Function& function, Assembler* assembler) { |
| 145 if (!CanIntrinsify(function)) return false; | 145 if (!CanIntrinsify(function)) return; |
| 146 | 146 |
| 147 const char* function_name = String::Handle(function.name()).ToCString(); | 147 const char* function_name = String::Handle(function.name()).ToCString(); |
| 148 const Class& function_class = Class::Handle(function.Owner()); | 148 const Class& function_class = Class::Handle(function.Owner()); |
| 149 const char* class_name = String::Handle(function_class.Name()).ToCString(); | 149 const char* class_name = String::Handle(function_class.Name()).ToCString(); |
| 150 const Library& lib = Library::Handle(function_class.library()); | 150 const Library& lib = Library::Handle(function_class.library()); |
| 151 | 151 |
| 152 #define FIND_INTRINSICS(test_class_name, test_function_name, destination, fp) \ | 152 #define FIND_INTRINSICS(test_class_name, test_function_name, destination, fp) \ |
| 153 if (TestFunction(lib, function, \ | 153 if (TestFunction(lib, function, \ |
| 154 class_name, function_name, \ | 154 class_name, function_name, \ |
| 155 #test_class_name, #test_function_name)) { \ | 155 #test_class_name, #test_function_name)) { \ |
| 156 ASSERT(function.CheckSourceFingerprint(fp)); \ | 156 ASSERT(function.CheckSourceFingerprint(fp)); \ |
| 157 return destination(assembler); \ | 157 return destination(assembler); \ |
| 158 } \ | 158 } \ |
| 159 | 159 |
| 160 if (lib.raw() == Library::CoreLibrary()) { | 160 if (lib.raw() == Library::CoreLibrary()) { |
| 161 CORE_LIB_INTRINSIC_LIST(FIND_INTRINSICS); | 161 CORE_LIB_INTRINSIC_LIST(FIND_INTRINSICS); |
| 162 if (!FLAG_throw_on_javascript_int_overflow || (Smi::kBits < 32)) { | 162 if (!FLAG_throw_on_javascript_int_overflow || (Smi::kBits < 32)) { |
| 163 CORE_INTEGER_LIB_INTRINSIC_LIST(FIND_INTRINSICS); | 163 CORE_INTEGER_LIB_INTRINSIC_LIST(FIND_INTRINSICS); |
| 164 } | 164 } |
| 165 } else if (lib.raw() == Library::TypedDataLibrary()) { | 165 } else if (lib.raw() == Library::TypedDataLibrary()) { |
| 166 TYPED_DATA_LIB_INTRINSIC_LIST(FIND_INTRINSICS); | 166 TYPED_DATA_LIB_INTRINSIC_LIST(FIND_INTRINSICS); |
| 167 } else if (lib.raw() == Library::MathLibrary()) { | 167 } else if (lib.raw() == Library::MathLibrary()) { |
| 168 MATH_LIB_INTRINSIC_LIST(FIND_INTRINSICS); | 168 MATH_LIB_INTRINSIC_LIST(FIND_INTRINSICS); |
| 169 } | 169 } |
| 170 return false; | |
| 171 | |
| 172 #undef FIND_INTRINSICS | 170 #undef FIND_INTRINSICS |
| 173 } | 171 } |
| 174 | 172 |
| 175 } // namespace dart | 173 } // namespace dart |
| OLD | NEW |