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

Side by Side Diff: vm/intrinsifier.h

Issue 12096105: Instead of setting up the can intrinsify state lazily setup eagerly (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 years, 10 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 | « no previous file | 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 10
11 namespace dart { 11 namespace dart {
12 12
13 // List of intrinsics: 13 // List of intrinsics:
14 // (class-name, function-name, intrinsification method, fingerprint). 14 // (class-name, function-name, intrinsification method, fingerprint).
15 // 15 //
16 // When adding a new function for intrinsification add a 0 as fingerprint, 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. 17 // build and run to get the correct fingerprint from the mismatch error.
18 #define INTRINSIC_LIST(V) \ 18 #define CORE_LIB_INTRINSIC_LIST(V) \
19 V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, 726019207)\ 19 V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, 726019207)\
20 V(_IntegerImplementation, +, Integer_add, 959303888) \ 20 V(_IntegerImplementation, +, Integer_add, 959303888) \
21 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, 726019207)\ 21 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, 726019207)\
22 V(_IntegerImplementation, -, Integer_sub, 483122878) \ 22 V(_IntegerImplementation, -, Integer_sub, 483122878) \
23 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, 726019207)\ 23 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, 726019207)\
24 V(_IntegerImplementation, *, Integer_mul, 1043837343) \ 24 V(_IntegerImplementation, *, Integer_mul, 1043837343) \
25 V(_IntegerImplementation, %, Integer_modulo, 2027609817) \ 25 V(_IntegerImplementation, %, Integer_modulo, 2027609817) \
26 V(_IntegerImplementation, ~/, Integer_truncDivide, 958840900) \ 26 V(_IntegerImplementation, ~/, Integer_truncDivide, 958840900) \
27 V(_IntegerImplementation, unary-, Integer_negate, 678480358) \ 27 V(_IntegerImplementation, unary-, Integer_negate, 678480358) \
28 V(_IntegerImplementation, _bitAndFromInteger, \ 28 V(_IntegerImplementation, _bitAndFromInteger, \
(...skipping 22 matching lines...) Expand all
51 V(_Double, <, Double_lessThan, 1598098437) \ 51 V(_Double, <, Double_lessThan, 1598098437) \
52 V(_Double, <=, Double_lessEqualThan, 1300604767) \ 52 V(_Double, <=, Double_lessEqualThan, 1300604767) \
53 V(_Double, ==, Double_equal, 1206706717) \ 53 V(_Double, ==, Double_equal, 1206706717) \
54 V(_Double, +, Double_add, 1965033293) \ 54 V(_Double, +, Double_add, 1965033293) \
55 V(_Double, -, Double_sub, 1212327731) \ 55 V(_Double, -, Double_sub, 1212327731) \
56 V(_Double, *, Double_mul, 395243827) \ 56 V(_Double, *, Double_mul, 395243827) \
57 V(_Double, /, Double_div, 809804402) \ 57 V(_Double, /, Double_div, 809804402) \
58 V(_Double, get:isNaN, Double_getIsNaN, 54462366) \ 58 V(_Double, get:isNaN, Double_getIsNaN, 54462366) \
59 V(_Double, get:isNegative, Double_getIsNegative, 54462366) \ 59 V(_Double, get:isNegative, Double_getIsNegative, 54462366) \
60 V(_Double, _mulFromInteger, Double_mulFromInteger, 815838159) \ 60 V(_Double, _mulFromInteger, Double_mulFromInteger, 815838159) \
61 V(_Double, .fromInteger, Double_fromInteger, 842078193) \ 61 V(_Double, _Double.fromInteger, Double_fromInteger, 842078193) \
62 V(_Double, toInt, Double_toInt, 362666636) \ 62 V(_Double, toInt, Double_toInt, 362666636) \
63 V(_ObjectArray, ., ObjectArray_Allocate, 577949617) \ 63 V(_ObjectArray, _ObjectArray., ObjectArray_Allocate, 577949617) \
64 V(_ObjectArray, get:length, Array_getLength, 405297088) \ 64 V(_ObjectArray, get:length, Array_getLength, 405297088) \
65 V(_ObjectArray, [], Array_getIndexed, 71937385) \ 65 V(_ObjectArray, [], Array_getIndexed, 71937385) \
66 V(_ObjectArray, []=, Array_setIndexed, 255863719) \ 66 V(_ObjectArray, []=, Array_setIndexed, 255863719) \
67 V(_GrowableObjectArray, .withData, GArray_Allocate, 989879928) \ 67 V(_GrowableObjectArray, _GrowableObjectArray.withData, \
68 GArray_Allocate, 989879928) \
68 V(_GrowableObjectArray, get:length, GrowableArray_getLength, 725548050) \ 69 V(_GrowableObjectArray, get:length, GrowableArray_getLength, 725548050) \
69 V(_GrowableObjectArray, get:_capacity, GrowableArray_getCapacity, 725548050) \ 70 V(_GrowableObjectArray, get:_capacity, GrowableArray_getCapacity, 725548050) \
70 V(_GrowableObjectArray, [], GrowableArray_getIndexed, 581838973) \ 71 V(_GrowableObjectArray, [], GrowableArray_getIndexed, 581838973) \
71 V(_GrowableObjectArray, []=, GrowableArray_setIndexed, 1048007636) \ 72 V(_GrowableObjectArray, []=, GrowableArray_setIndexed, 1048007636) \
72 V(_GrowableObjectArray, _setLength, GrowableArray_setLength, 796709584) \ 73 V(_GrowableObjectArray, _setLength, GrowableArray_setLength, 796709584) \
73 V(_GrowableObjectArray, _setData, GrowableArray_setData, 477312179) \ 74 V(_GrowableObjectArray, _setData, GrowableArray_setData, 477312179) \
74 V(_GrowableObjectArray, add, GrowableArray_add, 1367698386) \ 75 V(_GrowableObjectArray, add, GrowableArray_add, 1367698386) \
75 V(_ImmutableArray, [], ImmutableArray_getIndexed, 486821199) \ 76 V(_ImmutableArray, [], ImmutableArray_getIndexed, 486821199) \
76 V(_ImmutableArray, get:length, ImmutableArray_getLength, 433698233) \ 77 V(_ImmutableArray, get:length, ImmutableArray_getLength, 433698233) \
77 V(::, sqrt, Math_sqrt, 1662640002) \
78 V(::, sin, Math_sin, 1273932041) \
79 V(::, cos, Math_cos, 1749547468) \
80 V(Object, ==, Object_equal, 2126956595) \ 78 V(Object, ==, Object_equal, 2126956595) \
81 V(_StringBase, get:hashCode, String_getHashCode, 320803993) \ 79 V(_StringBase, get:hashCode, String_getHashCode, 320803993) \
82 V(_StringBase, get:isEmpty, String_getIsEmpty, 711547329) \ 80 V(_StringBase, get:isEmpty, String_getIsEmpty, 711547329) \
83 V(_StringBase, get:length, String_getLength, 320803993) \ 81 V(_StringBase, get:length, String_getLength, 320803993) \
84 V(_StringBase, charCodeAt, String_charCodeAt, 984449525) \ 82 V(_StringBase, charCodeAt, String_charCodeAt, 984449525) \
83
84
85 #define MATH_LIB_INTRINSIC_LIST(V) \
86 V(::, sqrt, Math_sqrt, 1662640002) \
87 V(::, sin, Math_sin, 1273932041) \
88 V(::, cos, Math_cos, 1749547468) \
89
90
91 #define SCALARLIST_LIB_INTRINSIC_LIST(V) \
85 V(_ByteArrayBase, get:length, ByteArrayBase_getLength, 1098081765) \ 92 V(_ByteArrayBase, get:length, ByteArrayBase_getLength, 1098081765) \
86 V(_Int8Array, [], Int8Array_getIndexed, 1295306322) \ 93 V(_Int8Array, [], Int8Array_getIndexed, 1295306322) \
87 V(_Int8Array, []=, Int8Array_setIndexed, 1709956322) \ 94 V(_Int8Array, []=, Int8Array_setIndexed, 1709956322) \
88 V(_Int8Array, _new, Int8Array_new, 535958453) \ 95 V(_Int8Array, _new, Int8Array_new, 535958453) \
89 V(_Uint8Array, [], Uint8Array_getIndexed, 578331916) \ 96 V(_Uint8Array, [], Uint8Array_getIndexed, 578331916) \
90 V(_Uint8Array, []=, Uint8Array_setIndexed, 121509844) \ 97 V(_Uint8Array, []=, Uint8Array_setIndexed, 121509844) \
91 V(_Uint8Array, _new, Uint8Array_new, 604355565) \ 98 V(_Uint8Array, _new, Uint8Array_new, 604355565) \
92 V(_Uint8ClampedArray, [], UintClamped8Array_getIndexed, 327062422) \ 99 V(_Uint8ClampedArray, [], UintClamped8Array_getIndexed, 327062422) \
93 V(_Uint8ClampedArray, []=, Uint8ClampedArray_setIndexed, 2054663547) \ 100 V(_Uint8ClampedArray, []=, Uint8ClampedArray_setIndexed, 2054663547) \
94 V(_Uint8ClampedArray, _new, Uint8ClampedArray_new, 1070949952) \ 101 V(_Uint8ClampedArray, _new, Uint8ClampedArray_new, 1070949952) \
(...skipping 15 matching lines...) Expand all
110 V(_Float32Array, _new, Float32Array_new, 109944959) \ 117 V(_Float32Array, _new, Float32Array_new, 109944959) \
111 V(_Float64Array, [], Float64Array_getIndexed, 638830526) \ 118 V(_Float64Array, [], Float64Array_getIndexed, 638830526) \
112 V(_Float64Array, []=, Float64Array_setIndexed, 1948811847) \ 119 V(_Float64Array, []=, Float64Array_setIndexed, 1948811847) \
113 V(_Float64Array, _new, Float64Array_new, 147668392) \ 120 V(_Float64Array, _new, Float64Array_new, 147668392) \
114 V(_ExternalUint8Array, [], ExternalUint8Array_getIndexed, 753790851) \ 121 V(_ExternalUint8Array, [], ExternalUint8Array_getIndexed, 753790851) \
115 V(_ExternalUint8ClampedArray, [], ExternalUint8ClampedArray_getIndexed, \ 122 V(_ExternalUint8ClampedArray, [], ExternalUint8ClampedArray_getIndexed, \
116 823759763) \ 123 823759763) \
117 V(_ExternalUint8ClampedArray, []=, ExternalUint8ClampedArray_setIndexed, \ 124 V(_ExternalUint8ClampedArray, []=, ExternalUint8ClampedArray_setIndexed, \
118 654373808) \ 125 654373808) \
119 126
127
120 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and 128 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and
121 // _FixedSizeArrayIterator, moveNext. 129 // _FixedSizeArrayIterator, moveNext.
122 130
123 // Forward declarations. 131 // Forward declarations.
124 class Assembler; 132 class Assembler;
125 class Function; 133 class Function;
126 134
127 class Intrinsifier : public AllStatic { 135 class Intrinsifier : public AllStatic {
128 public: 136 public:
129 // Try to intrinsify 'function'. Returns true if the function intrinsified 137 // Try to intrinsify 'function'. Returns true if the function intrinsified
130 // completely and the code does not need to be generated (i.e., no slow 138 // completely and the code does not need to be generated (i.e., no slow
131 // path possible). 139 // path possible).
132 static bool Intrinsify(const Function& function, Assembler* assembler); 140 static bool Intrinsify(const Function& function, Assembler* assembler);
133 static bool CanIntrinsify(const Function& function); 141 static bool CanIntrinsify(const Function& function);
142 static void InitializeState();
134 143
135 private: 144 private:
136 #define DECLARE_FUNCTION(test_class_name, test_function_name, destination, fp) \ 145 #define DECLARE_FUNCTION(test_class_name, test_function_name, destination, fp) \
137 static bool destination(Assembler* assembler); 146 static bool destination(Assembler* assembler);
138 147
139 INTRINSIC_LIST(DECLARE_FUNCTION) 148 CORE_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
149 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
150 SCALARLIST_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
151
140 #undef DECLARE_FUNCTION 152 #undef DECLARE_FUNCTION
141 }; 153 };
142 154
143 } // namespace dart 155 } // namespace dart
144 156
145 #endif // VM_INTRINSIFIER_H_ 157 #endif // VM_INTRINSIFIER_H_
OLDNEW
« no previous file with comments | « no previous file | vm/intrinsifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698