| 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/assembler.h" |
| 6 #include "vm/intrinsifier.h" | 7 #include "vm/intrinsifier.h" |
| 7 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 8 #include "vm/object.h" | 9 #include "vm/object.h" |
| 9 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| 10 | 11 |
| 11 namespace dart { | 12 namespace dart { |
| 12 | 13 |
| 13 DEFINE_FLAG(bool, intrinsify, true, "Instrinsify when possible"); | 14 DEFINE_FLAG(bool, intrinsify, true, "Instrinsify when possible"); |
| 14 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 15 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| 15 | 16 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 const char* function_name = String::Handle(function.name()).ToCString(); | 148 const char* function_name = String::Handle(function.name()).ToCString(); |
| 148 const Class& function_class = Class::Handle(function.Owner()); | 149 const Class& function_class = Class::Handle(function.Owner()); |
| 149 const char* class_name = String::Handle(function_class.Name()).ToCString(); | 150 const char* class_name = String::Handle(function_class.Name()).ToCString(); |
| 150 const Library& lib = Library::Handle(function_class.library()); | 151 const Library& lib = Library::Handle(function_class.library()); |
| 151 | 152 |
| 152 #define FIND_INTRINSICS(test_class_name, test_function_name, destination, fp) \ | 153 #define FIND_INTRINSICS(test_class_name, test_function_name, destination, fp) \ |
| 153 if (TestFunction(lib, function, \ | 154 if (TestFunction(lib, function, \ |
| 154 class_name, function_name, \ | 155 class_name, function_name, \ |
| 155 #test_class_name, #test_function_name)) { \ | 156 #test_class_name, #test_function_name)) { \ |
| 156 ASSERT(function.CheckSourceFingerprint(fp)); \ | 157 ASSERT(function.CheckSourceFingerprint(fp)); \ |
| 157 return destination(assembler); \ | 158 assembler->Comment("Intrinsic"); \ |
| 159 destination(assembler); \ |
| 160 return; \ |
| 158 } \ | 161 } \ |
| 159 | 162 |
| 160 if (lib.raw() == Library::CoreLibrary()) { | 163 if (lib.raw() == Library::CoreLibrary()) { |
| 161 CORE_LIB_INTRINSIC_LIST(FIND_INTRINSICS); | 164 CORE_LIB_INTRINSIC_LIST(FIND_INTRINSICS); |
| 162 if (!FLAG_throw_on_javascript_int_overflow || (Smi::kBits < 32)) { | 165 if (!FLAG_throw_on_javascript_int_overflow || (Smi::kBits < 32)) { |
| 163 CORE_INTEGER_LIB_INTRINSIC_LIST(FIND_INTRINSICS); | 166 CORE_INTEGER_LIB_INTRINSIC_LIST(FIND_INTRINSICS); |
| 164 } | 167 } |
| 165 } else if (lib.raw() == Library::TypedDataLibrary()) { | 168 } else if (lib.raw() == Library::TypedDataLibrary()) { |
| 166 TYPED_DATA_LIB_INTRINSIC_LIST(FIND_INTRINSICS); | 169 TYPED_DATA_LIB_INTRINSIC_LIST(FIND_INTRINSICS); |
| 167 } else if (lib.raw() == Library::MathLibrary()) { | 170 } else if (lib.raw() == Library::MathLibrary()) { |
| 168 MATH_LIB_INTRINSIC_LIST(FIND_INTRINSICS); | 171 MATH_LIB_INTRINSIC_LIST(FIND_INTRINSICS); |
| 169 } | 172 } |
| 170 #undef FIND_INTRINSICS | 173 #undef FIND_INTRINSICS |
| 171 } | 174 } |
| 172 | 175 |
| 173 } // namespace dart | 176 } // namespace dart |
| OLD | NEW |