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 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 V(_OneByteString, _substringUncheckedNative, \ | 84 V(_OneByteString, _substringUncheckedNative, \ |
85 OneByteString_substringUnchecked, 713121438) \ | 85 OneByteString_substringUnchecked, 713121438) \ |
86 | 86 |
87 | 87 |
88 #define MATH_LIB_INTRINSIC_LIST(V) \ | 88 #define MATH_LIB_INTRINSIC_LIST(V) \ |
89 V(::, sqrt, Math_sqrt, 1662640002) \ | 89 V(::, sqrt, Math_sqrt, 1662640002) \ |
90 V(::, sin, Math_sin, 1273932041) \ | 90 V(::, sin, Math_sin, 1273932041) \ |
91 V(::, cos, Math_cos, 1749547468) \ | 91 V(::, cos, Math_cos, 1749547468) \ |
92 | 92 |
93 | 93 |
94 #define TYPEDDATA_LIB_INTRINSIC_LIST(V) \ | 94 #define TYPED_DATA_LIB_INTRINSIC_LIST(V) \ |
95 V(_TypedList, get:length, TypedData_getLength, 231908172) \ | 95 V(_TypedList, get:length, TypedData_getLength, 1004567191) \ |
96 V(_Int8Array, _new, TypedData_Int8Array_new, 844274443) \ | 96 V(_Int8Array, _new, TypedData_Int8Array_new, 48970297) \ |
97 V(_Uint8Array, _new, TypedData_Uint8Array_new, 997951645) \ | 97 V(_Uint8Array, _new, TypedData_Uint8Array_new, 389788863) \ |
98 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 1025045044) \ | 98 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 59021935) \ |
99 V(_Int16Array, _new, TypedData_Int16Array_new, 1064563368) \ | 99 V(_Int16Array, _new, TypedData_Int16Array_new, 465688649) \ |
100 V(_Uint16Array, _new, TypedData_Uint16Array_new, 110927177) \ | 100 V(_Uint16Array, _new, TypedData_Uint16Array_new, 169304657) \ |
101 V(_Int32Array, _new, TypedData_Int32Array_new, 770802406) \ | 101 V(_Int32Array, _new, TypedData_Int32Array_new, 947562951) \ |
102 V(_Uint32Array, _new, TypedData_Uint32Array_new, 856841876) \ | 102 V(_Uint32Array, _new, TypedData_Uint32Array_new, 85066537) \ |
103 V(_Int64Array, _new, TypedData_Int64Array_new, 941769528) \ | 103 V(_Int64Array, _new, TypedData_Int64Array_new, 775415132) \ |
104 V(_Uint64Array, _new, TypedData_Uint64Array_new, 977566635) \ | 104 V(_Uint64Array, _new, TypedData_Uint64Array_new, 536384146) \ |
105 V(_Float32Array, _new, TypedData_Float32Array_new, 1053133615) \ | 105 V(_Float32Array, _new, TypedData_Float32Array_new, 723829075) \ |
106 V(_Float64Array, _new, TypedData_Float64Array_new, 936673303) \ | 106 V(_Float64Array, _new, TypedData_Float64Array_new, 111654177) \ |
107 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 212088644) \ | 107 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 984763738) \ |
108 V(_Int8Array, ., TypedData_Int8Array_factory, 156009974) \ | 108 V(_Int8Array, ., TypedData_Int8Array_factory, 974805301) \ |
109 V(_Uint8Array, ., TypedData_Uint8Array_factory, 1465460956) \ | 109 V(_Uint8Array, ., TypedData_Uint8Array_factory, 839639001) \ |
110 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 970170700) \ | 110 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 1947193032) \ |
111 V(_Int16Array, ., TypedData_Int16Array_factory, 1520309224) \ | 111 V(_Int16Array, ., TypedData_Int16Array_factory, 1492289327) \ |
112 V(_Uint16Array, ., TypedData_Uint16Array_factory, 195493071) \ | 112 V(_Uint16Array, ., TypedData_Uint16Array_factory, 358109132) \ |
113 V(_Int32Array, ., TypedData_Int32Array_factory, 27437702) \ | 113 V(_Int32Array, ., TypedData_Int32Array_factory, 1238390459) \ |
114 V(_Uint32Array, ., TypedData_Uint32Array_factory, 1702451035) \ | 114 V(_Uint32Array, ., TypedData_Uint32Array_factory, 1091191177) \ |
115 V(_Int64Array, ., TypedData_Int64Array_factory, 225360944) \ | 115 V(_Int64Array, ., TypedData_Int64Array_factory, 569474614) \ |
116 V(_Uint64Array, ., TypedData_Uint64Array_factory, 1730375031) \ | 116 V(_Uint64Array, ., TypedData_Uint64Array_factory, 1778132384) \ |
117 V(_Float32Array, ., TypedData_Float32Array_factory, 563498394) \ | 117 V(_Float32Array, ., TypedData_Float32Array_factory, 630024167) \ |
118 V(_Float64Array, ., TypedData_Float64Array_factory, 492220296) \ | 118 V(_Float64Array, ., TypedData_Float64Array_factory, 740945295) \ |
119 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 1845796718) \ | 119 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 1881134784) \ |
120 | 120 |
121 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and | 121 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and |
122 // _FixedSizeArrayIterator, moveNext. | 122 // _FixedSizeArrayIterator, moveNext. |
123 | 123 |
124 // Forward declarations. | 124 // Forward declarations. |
125 class Assembler; | 125 class Assembler; |
126 class Function; | 126 class Function; |
127 | 127 |
128 class Intrinsifier : public AllStatic { | 128 class Intrinsifier : public AllStatic { |
129 public: | 129 public: |
130 // Try to intrinsify 'function'. Returns true if the function intrinsified | 130 // Try to intrinsify 'function'. Returns true if the function intrinsified |
131 // completely and the code does not need to be generated (i.e., no slow | 131 // completely and the code does not need to be generated (i.e., no slow |
132 // path possible). | 132 // path possible). |
133 static bool Intrinsify(const Function& function, Assembler* assembler); | 133 static bool Intrinsify(const Function& function, Assembler* assembler); |
134 static bool CanIntrinsify(const Function& function); | 134 static bool CanIntrinsify(const Function& function); |
135 static void InitializeState(); | 135 static void InitializeState(); |
136 | 136 |
137 private: | 137 private: |
138 #define DECLARE_FUNCTION(test_class_name, test_function_name, destination, fp) \ | 138 #define DECLARE_FUNCTION(test_class_name, test_function_name, destination, fp) \ |
139 static bool destination(Assembler* assembler); | 139 static bool destination(Assembler* assembler); |
140 | 140 |
141 CORE_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 141 CORE_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
142 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 142 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
143 TYPEDDATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 143 TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
144 | 144 |
145 #undef DECLARE_FUNCTION | 145 #undef DECLARE_FUNCTION |
146 }; | 146 }; |
147 | 147 |
148 } // namespace dart | 148 } // namespace dart |
149 | 149 |
150 #endif // VM_INTRINSIFIER_H_ | 150 #endif // VM_INTRINSIFIER_H_ |
OLD | NEW |