| 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 #ifndef VM_INTRINSIFIER_H_ | 6 #ifndef VM_INTRINSIFIER_H_ |
| 7 #define VM_INTRINSIFIER_H_ | 7 #define VM_INTRINSIFIER_H_ |
| 8 | 8 |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/method_recognizer.h" | 10 #include "vm/method_recognizer.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 // Forward declarations. | 14 // Forward declarations. |
| 15 class Assembler; | 15 class Assembler; |
| 16 class FlowGraphCompiler; |
| 16 class Function; | 17 class Function; |
| 18 class TargetEntryInstr; |
| 19 class ParsedFunction; |
| 20 class FlowGraph; |
| 17 | 21 |
| 18 class Intrinsifier : public AllStatic { | 22 class Intrinsifier : public AllStatic { |
| 19 public: | 23 public: |
| 20 // Try to intrinsify 'function'. Returns true if the function intrinsified | 24 // Try to intrinsify 'function'. Returns true if the function intrinsified |
| 21 // completely and the code does not need to be generated (i.e., no slow | 25 // completely and the code does not need to be generated (i.e., no slow |
| 22 // path possible). | 26 // path possible). |
| 23 static void Intrinsify(const Function& function, Assembler* assembler); | 27 static void Intrinsify(const ParsedFunction& parsed_function, |
| 28 FlowGraphCompiler* compiler); |
| 24 static void InitializeState(); | 29 static void InitializeState(); |
| 25 | 30 |
| 31 static bool GraphIntrinsify(const ParsedFunction& parsed_function, |
| 32 FlowGraphCompiler* compiler); |
| 33 |
| 34 static intptr_t ParameterSlotFromSp(); |
| 35 |
| 26 private: | 36 private: |
| 27 static bool CanIntrinsify(const Function& function); | 37 static bool CanIntrinsify(const Function& function); |
| 28 | 38 |
| 29 #define DECLARE_FUNCTION(test_class_name, test_function_name, destination, fp) \ | 39 |
| 30 static void destination(Assembler* assembler); | 40 #define DECLARE_FUNCTION(test_class_name, test_function_name, enum_name, fp) \ |
| 41 static void enum_name(Assembler* assembler); |
| 31 | 42 |
| 32 ALL_INTRINSICS_LIST(DECLARE_FUNCTION) | 43 ALL_INTRINSICS_LIST(DECLARE_FUNCTION) |
| 33 | 44 |
| 34 #undef DECLARE_FUNCTION | 45 #undef DECLARE_FUNCTION |
| 46 |
| 47 #define DECLARE_FUNCTION(test_class_name, test_function_name, enum_name, fp) \ |
| 48 static bool Build_##enum_name(FlowGraph* flow_graph); |
| 49 |
| 50 GRAPH_INTRINSICS_LIST(DECLARE_FUNCTION) |
| 51 |
| 52 #undef DECLARE_FUNCTION |
| 35 }; | 53 }; |
| 36 | 54 |
| 37 } // namespace dart | 55 } // namespace dart |
| 38 | 56 |
| 39 #endif // VM_INTRINSIFIER_H_ | 57 #endif // VM_INTRINSIFIER_H_ |
| OLD | NEW |