Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: runtime/vm/intrinsifier.h

Issue 468793004: VM: Improve performance of method recognizer and unify the it with the intrinsifier. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intrinsifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11
11 namespace dart { 12 namespace dart {
12 13
13 // List of intrinsics:
14 // (class-name, function-name, intrinsification method, fingerprint).
15 //
16 // When adding a new function for intrinsification add a 0 as fingerprint,
17 // build and run to get the correct fingerprint from the mismatch error.
18 #define CORE_LIB_INTRINSIC_LIST(V) \
19 V(_Smi, ~, Smi_bitNegate, 105519892) \
20 V(_Smi, get:bitLength, Smi_bitLength, 869956497) \
21 V(_Double, >, Double_greaterThan, 381325711) \
22 V(_Double, >=, Double_greaterEqualThan, 1409267140) \
23 V(_Double, <, Double_lessThan, 2080387973) \
24 V(_Double, <=, Double_lessEqualThan, 106225572) \
25 V(_Double, ==, Double_equal, 2093918133) \
26 V(_Double, +, Double_add, 1646350451) \
27 V(_Double, -, Double_sub, 1477459276) \
28 V(_Double, *, Double_mul, 1334580777) \
29 V(_Double, /, Double_div, 1938037155) \
30 V(_Double, get:isNaN, Double_getIsNaN, 843050033) \
31 V(_Double, get:isNegative, Double_getIsNegative, 1637875580) \
32 V(_Double, _mulFromInteger, Double_mulFromInteger, 1594796483) \
33 V(_Double, .fromInteger, Double_fromInteger, 999771940) \
34 V(_List, get:length, Array_getLength, 1181352729) \
35 V(_List, [], Array_getIndexed, 795612476) \
36 V(_List, []=, Array_setIndexed, 1288827575) \
37 V(_GrowableList, .withData, GrowableList_Allocate, 732923072) \
38 V(_GrowableList, get:length, GrowableList_getLength, 778505107) \
39 V(_GrowableList, get:_capacity, GrowableList_getCapacity, 555140075) \
40 V(_GrowableList, [], GrowableList_getIndexed, 919108233) \
41 V(_GrowableList, []=, GrowableList_setIndexed, 1218649853) \
42 V(_GrowableList, _setLength, GrowableList_setLength, 89389299) \
43 V(_GrowableList, _setData, GrowableList_setData, 2126927509) \
44 V(_GrowableList, add, GrowableList_add, 1899133961) \
45 V(_ImmutableList, [], ImmutableList_getIndexed, 1990177341) \
46 V(_ImmutableList, get:length, ImmutableList_getLength, 274917727) \
47 V(Object, ==, Object_equal, 1068471689) \
48 V(_StringBase, get:hashCode, String_getHashCode, 2102906241) \
49 V(_StringBase, get:isEmpty, String_getIsEmpty, 49873871) \
50 V(_StringBase, get:length, String_getLength, 784399628) \
51 V(_StringBase, codeUnitAt, String_codeUnitAt, 397735324) \
52 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 1111837929) \
53 V(_OneByteString, _substringUncheckedNative, \
54 OneByteString_substringUnchecked, 1527498975) \
55 V(_OneByteString, _setAt, OneByteString_setAt, 468605749) \
56 V(_OneByteString, _allocate, OneByteString_allocate, 2035417022) \
57 V(_OneByteString, ==, OneByteString_equality, 1727047023) \
58 V(_TwoByteString, ==, TwoByteString_equality, 951149689) \
59
60
61 #define CORE_INTEGER_LIB_INTRINSIC_LIST(V) \
62 V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, \
63 438687793) \
64 V(_IntegerImplementation, +, Integer_add, 837070328) \
65 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, \
66 562800077) \
67 V(_IntegerImplementation, -, Integer_sub, 1904782019) \
68 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, \
69 67891834) \
70 V(_IntegerImplementation, *, Integer_mul, 1012952097) \
71 V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger, \
72 93478264) \
73 V(_IntegerImplementation, ~/, Integer_truncDivide, 724644222) \
74 V(_IntegerImplementation, unary-, Integer_negate, 2095203689) \
75 V(_IntegerImplementation, _bitAndFromInteger, \
76 Integer_bitAndFromInteger, 504496713) \
77 V(_IntegerImplementation, &, Integer_bitAnd, 347192674) \
78 V(_IntegerImplementation, _bitOrFromInteger, \
79 Integer_bitOrFromInteger, 1763728073) \
80 V(_IntegerImplementation, |, Integer_bitOr, 1293445202) \
81 V(_IntegerImplementation, _bitXorFromInteger, \
82 Integer_bitXorFromInteger, 281425907) \
83 V(_IntegerImplementation, ^, Integer_bitXor, 2139935734) \
84 V(_IntegerImplementation, \
85 _greaterThanFromInteger, \
86 Integer_greaterThanFromInt, 787426822) \
87 V(_IntegerImplementation, >, Integer_greaterThan, 123961041) \
88 V(_IntegerImplementation, ==, Integer_equal, 1423724294) \
89 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, \
90 1790821042) \
91 V(_IntegerImplementation, <, Integer_lessThan, 425560117) \
92 V(_IntegerImplementation, <=, Integer_lessEqualThan, 1512735828) \
93 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 668293748) \
94 V(_IntegerImplementation, <<, Integer_shl, 34265041) \
95 V(_IntegerImplementation, >>, Integer_sar, 1797129864) \
96 V(_Double, toInt, Double_toInt, 1547535151)
97
98
99 #define MATH_LIB_INTRINSIC_LIST(V) \
100 V(::, sqrt, Math_sqrt, 101545548) \
101 V(_Random, _nextState, Random_nextState, 55890711) \
102
103
104 #define TYPED_DATA_LIB_INTRINSIC_LIST(V) \
105 V(_TypedList, get:length, TypedData_getLength, 522565357) \
106 V(_Int8Array, _new, TypedData_Int8Array_new, 1150131819) \
107 V(_Uint8Array, _new, TypedData_Uint8Array_new, 2019665760) \
108 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 726412668) \
109 V(_Int16Array, _new, TypedData_Int16Array_new, 1879541015) \
110 V(_Uint16Array, _new, TypedData_Uint16Array_new, 189496401) \
111 V(_Int32Array, _new, TypedData_Int32Array_new, 1725327048) \
112 V(_Uint32Array, _new, TypedData_Uint32Array_new, 10306485) \
113 V(_Int64Array, _new, TypedData_Int64Array_new, 1299501918) \
114 V(_Uint64Array, _new, TypedData_Uint64Array_new, 1635318703) \
115 V(_Float32Array, _new, TypedData_Float32Array_new, 577737480) \
116 V(_Float64Array, _new, TypedData_Float64Array_new, 645355686) \
117 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 596639418) \
118 V(_Int32x4Array, _new, TypedData_Int32x4Array_new, 496358233) \
119 V(_Float64x2Array, _new, TypedData_Float64x2Array_new, 1506975080) \
120 V(_Int8Array, ., TypedData_Int8Array_factory, 1499010120) \
121 V(_Uint8Array, ., TypedData_Uint8Array_factory, 354210806) \
122 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 231626935) \
123 V(_Int16Array, ., TypedData_Int16Array_factory, 1044203454) \
124 V(_Uint16Array, ., TypedData_Uint16Array_factory, 616427808) \
125 V(_Int32Array, ., TypedData_Int32Array_factory, 26656923) \
126 V(_Uint32Array, ., TypedData_Uint32Array_factory, 297463966) \
127 V(_Int64Array, ., TypedData_Int64Array_factory, 105050331) \
128 V(_Uint64Array, ., TypedData_Uint64Array_factory, 1469861670) \
129 V(_Float32Array, ., TypedData_Float32Array_factory, 105860920) \
130 V(_Float64Array, ., TypedData_Float64Array_factory, 342242776) \
131 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 1217848993) \
132 V(_Int32x4Array, ., TypedData_Int32x4Array_factory, 100825417) \
133 V(_Float64x2Array, ., TypedData_Float64x2Array_factory, 611308575) \
134 V(_Uint8Array, [], Uint8Array_getIndexed, 16125140) \
135 V(_ExternalUint8Array, [], ExternalUint8Array_getIndexed, 1678777951) \
136 V(_Float64Array, [], Float64Array_getIndexed, 1779054297) \
137 V(_Float64Array, []=, Float64Array_setIndexed, 243929230) \
138
139
140 #define PROFILER_LIB_INTRINSIC_LIST(V) \
141 V(_UserTag, makeCurrent, UserTag_makeCurrent, 370414636) \
142 V(::, _getDefaultTag, UserTag_defaultTag, 1159885970) \
143 V(::, _getCurrentTag, Profiler_getCurrentTag, 1182126114) \
144
145 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and
146 // _FixedSizeArrayIterator, moveNext.
147
148 // Forward declarations. 14 // Forward declarations.
149 class Assembler; 15 class Assembler;
150 class Function; 16 class Function;
151 17
152 class Intrinsifier : public AllStatic { 18 class Intrinsifier : public AllStatic {
153 public: 19 public:
154 // Try to intrinsify 'function'. Returns true if the function intrinsified 20 // Try to intrinsify 'function'. Returns true if the function intrinsified
155 // completely and the code does not need to be generated (i.e., no slow 21 // completely and the code does not need to be generated (i.e., no slow
156 // path possible). 22 // path possible).
157 static void Intrinsify(const Function& function, Assembler* assembler); 23 static void Intrinsify(const Function& function, Assembler* assembler);
158 static bool CanIntrinsify(const Function& function);
159 static void InitializeState(); 24 static void InitializeState();
160 25
161 private: 26 private:
27 static bool CanIntrinsify(const Function& function);
28
162 #define DECLARE_FUNCTION(test_class_name, test_function_name, destination, fp) \ 29 #define DECLARE_FUNCTION(test_class_name, test_function_name, destination, fp) \
163 static void destination(Assembler* assembler); 30 static void destination(Assembler* assembler);
164 31
165 CORE_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) 32 ALL_INTRINSICS_LIST(DECLARE_FUNCTION)
166 CORE_INTEGER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
167 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
168 TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
169 PROFILER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
170 33
171 #undef DECLARE_FUNCTION 34 #undef DECLARE_FUNCTION
172 }; 35 };
173 36
174 } // namespace dart 37 } // namespace dart
175 38
176 #endif // VM_INTRINSIFIER_H_ 39 #endif // VM_INTRINSIFIER_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intrinsifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698