| 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 |
| 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 CORE_LIB_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, 25837296) \ | 20 V(_IntegerImplementation, +, Integer_add, 1768648592) \ |
| 21 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, 726019207)\ | 21 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, 726019207)\ |
| 22 V(_IntegerImplementation, -, Integer_sub, 1697139934) \ | 22 V(_IntegerImplementation, -, Integer_sub, 1292467582) \ |
| 23 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, 726019207)\ | 23 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, 726019207)\ |
| 24 V(_IntegerImplementation, *, Integer_mul, 110370751) \ | 24 V(_IntegerImplementation, *, Integer_mul, 1853182047) \ |
| 25 V(_IntegerImplementation, %, Integer_modulo, 108639519) \ | 25 V(_IntegerImplementation, %, Integer_modulo, 1211518976) \ |
| 26 V(_IntegerImplementation, ~/, Integer_truncDivide, 1187354250) \ | 26 V(_IntegerImplementation, ~/, Integer_truncDivide, 142750059) \ |
| 27 V(_IntegerImplementation, unary-, Integer_negate, 675709702) \ | 27 V(_IntegerImplementation, unary-, Integer_negate, 676633254) \ |
| 28 V(_IntegerImplementation, _bitAndFromInteger, \ | 28 V(_IntegerImplementation, _bitAndFromInteger, \ |
| 29 Integer_bitAndFromInteger, 726019207) \ | 29 Integer_bitAndFromInteger, 726019207) \ |
| 30 V(_IntegerImplementation, &, Integer_bitAnd, 759019505) \ | 30 V(_IntegerImplementation, &, Integer_bitAnd, 354347153) \ |
| 31 V(_IntegerImplementation, _bitOrFromInteger, \ | 31 V(_IntegerImplementation, _bitOrFromInteger, \ |
| 32 Integer_bitOrFromInteger, 726019207) \ | 32 Integer_bitOrFromInteger, 726019207) \ |
| 33 V(_IntegerImplementation, |, Integer_bitOr, 1280367298) \ | 33 V(_IntegerImplementation, |, Integer_bitOr, 875694946) \ |
| 34 V(_IntegerImplementation, _bitXorFromInteger, \ | 34 V(_IntegerImplementation, _bitXorFromInteger, \ |
| 35 Integer_bitXorFromInteger, 726019207) \ | 35 Integer_bitXorFromInteger, 726019207) \ |
| 36 V(_IntegerImplementation, ^, Integer_bitXor, 686827811) \ | 36 V(_IntegerImplementation, ^, Integer_bitXor, 282155459) \ |
| 37 V(_IntegerImplementation, \ | 37 V(_IntegerImplementation, \ |
| 38 _greaterThanFromInteger, \ | 38 _greaterThanFromInteger, \ |
| 39 Integer_greaterThanFromInt, 79222670) \ | 39 Integer_greaterThanFromInt, 79222670) \ |
| 40 V(_IntegerImplementation, >, Integer_greaterThan, 866987265) \ | 40 V(_IntegerImplementation, >, Integer_greaterThan, 462314913) \ |
| 41 V(_IntegerImplementation, ==, Integer_equal, 408178104) \ | 41 V(_IntegerImplementation, ==, Integer_equal, 1424765465) \ |
| 42 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, 79222670) \ | 42 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, 79222670) \ |
| 43 V(_IntegerImplementation, <, Integer_lessThan, 1423914919) \ | 43 V(_IntegerImplementation, <, Integer_lessThan, 1424838471) \ |
| 44 V(_IntegerImplementation, <=, Integer_lessEqualThan, 890963352) \ | 44 V(_IntegerImplementation, <=, Integer_lessEqualThan, 949016155) \ |
| 45 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 890993143) \ | 45 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 949045946) \ |
| 46 V(_IntegerImplementation, <<, Integer_shl, 1600590181) \ | 46 V(_IntegerImplementation, <<, Integer_shl, 1195917829) \ |
| 47 V(_IntegerImplementation, >>, Integer_sar, 237416447) \ | 47 V(_IntegerImplementation, >>, Integer_sar, 1980227743) \ |
| 48 V(_Smi, ~, Smi_bitNegate, 882629793) \ | 48 V(_Smi, ~, Smi_bitNegate, 882629793) \ |
| 49 V(_Double, >, Double_greaterThan, 498448864) \ | 49 V(_Double, >, Double_greaterThan, 301935359) \ |
| 50 V(_Double, >=, Double_greaterEqualThan, 1126476149) \ | 50 V(_Double, >=, Double_greaterEqualThan, 1184528952) \ |
| 51 V(_Double, <, Double_lessThan, 1595327781) \ | 51 V(_Double, <, Double_lessThan, 1596251333) \ |
| 52 V(_Double, <=, Double_lessEqualThan, 1126446358) \ | 52 V(_Double, <=, Double_lessEqualThan, 1184499161) \ |
| 53 V(_Double, ==, Double_equal, 48480576) \ | 53 V(_Double, ==, Double_equal, 1706047712) \ |
| 54 V(_Double, +, Double_add, 407090160) \ | 54 V(_Double, +, Double_add, 210576655) \ |
| 55 V(_Double, -, Double_sub, 1801868246) \ | 55 V(_Double, -, Double_sub, 1605354741) \ |
| 56 V(_Double, *, Double_mul, 984784342) \ | 56 V(_Double, *, Double_mul, 788270837) \ |
| 57 V(_Double, /, Double_div, 1399344917) \ | 57 V(_Double, /, Double_div, 1202831412) \ |
| 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, 353781714) \ | 60 V(_Double, _mulFromInteger, Double_mulFromInteger, 704314034) \ |
| 61 V(_Double, .fromInteger, Double_fromInteger, 842078193) \ | 61 V(_Double, .fromInteger, Double_fromInteger, 842078193) \ |
| 62 V(_Double, toInt, Double_toInt, 362666636) \ | 62 V(_Double, toInt, Double_toInt, 362666636) \ |
| 63 V(_ObjectArray, ., ObjectArray_Allocate, 97987288) \ | 63 V(_ObjectArray, ., ObjectArray_Allocate, 97987288) \ |
| 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, GrowableArray_Allocate, 816132033) \ | 67 V(_GrowableObjectArray, .withData, GrowableArray_Allocate, 816132033) \ |
| 68 V(_GrowableObjectArray, get:length, GrowableArray_getLength, 725548050) \ | 68 V(_GrowableObjectArray, get:length, GrowableArray_getLength, 725548050) \ |
| 69 V(_GrowableObjectArray, get:_capacity, GrowableArray_getCapacity, 725548050) \ | 69 V(_GrowableObjectArray, get:_capacity, GrowableArray_getCapacity, 725548050) \ |
| 70 V(_GrowableObjectArray, [], GrowableArray_getIndexed, 581838973) \ | 70 V(_GrowableObjectArray, [], GrowableArray_getIndexed, 581838973) \ |
| 71 V(_GrowableObjectArray, []=, GrowableArray_setIndexed, 1048007636) \ | 71 V(_GrowableObjectArray, []=, GrowableArray_setIndexed, 1048007636) \ |
| 72 V(_GrowableObjectArray, _setLength, GrowableArray_setLength, 796709584) \ | 72 V(_GrowableObjectArray, _setLength, GrowableArray_setLength, 796709584) \ |
| 73 V(_GrowableObjectArray, _setData, GrowableArray_setData, 629110947) \ | 73 V(_GrowableObjectArray, _setData, GrowableArray_setData, 629110947) \ |
| 74 V(_GrowableObjectArray, add, GrowableArray_add, 2139340847) \ | 74 V(_GrowableObjectArray, add, GrowableArray_add, 1904852879) \ |
| 75 V(_ImmutableArray, [], ImmutableArray_getIndexed, 486821199) \ | 75 V(_ImmutableArray, [], ImmutableArray_getIndexed, 486821199) \ |
| 76 V(_ImmutableArray, get:length, ImmutableArray_getLength, 433698233) \ | 76 V(_ImmutableArray, get:length, ImmutableArray_getLength, 433698233) \ |
| 77 V(Object, ==, Object_equal, 2126867222) \ | 77 V(Object, ==, Object_equal, 2126897013) \ |
| 78 V(_StringBase, get:hashCode, String_getHashCode, 320803993) \ | 78 V(_StringBase, get:hashCode, String_getHashCode, 320803993) \ |
| 79 V(_StringBase, get:isEmpty, String_getIsEmpty, 110632481) \ | 79 V(_StringBase, get:isEmpty, String_getIsEmpty, 1026765313) \ |
| 80 V(_StringBase, get:length, String_getLength, 320803993) \ | 80 V(_StringBase, get:length, String_getLength, 320803993) \ |
| 81 V(_StringBase, codeUnitAt, String_codeUnitAt, 984449525) \ | 81 V(_StringBase, codeUnitAt, String_codeUnitAt, 984449525) \ |
| 82 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 682660413) \ | 82 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 682660413) \ |
| 83 V(_OneByteString, _substringUncheckedNative, \ | 83 V(_OneByteString, _substringUncheckedNative, \ |
| 84 OneByteString_substringUnchecked, 713121438) \ | 84 OneByteString_substringUnchecked, 713121438) \ |
| 85 | 85 |
| 86 | 86 |
| 87 #define MATH_LIB_INTRINSIC_LIST(V) \ | 87 #define MATH_LIB_INTRINSIC_LIST(V) \ |
| 88 V(::, sqrt, Math_sqrt, 1662640002) \ | 88 V(::, sqrt, Math_sqrt, 1662640002) \ |
| 89 V(::, sin, Math_sin, 1273932041) \ | 89 V(::, sin, Math_sin, 1273932041) \ |
| 90 V(::, cos, Math_cos, 1749547468) \ | 90 V(::, cos, Math_cos, 1749547468) \ |
| 91 | 91 |
| 92 | 92 |
| 93 #define TYPEDDATA_LIB_INTRINSIC_LIST(V) \ | 93 #define TYPEDDATA_LIB_INTRINSIC_LIST(V) \ |
| 94 V(_TypedList, get:length, TypedData_getLength, 231908172) \ | 94 V(_TypedList, get:length, TypedData_getLength, 231908172) \ |
| 95 V(_Int8Array, _new, TypedData_Int8Array_new, 844274443) \ | 95 V(_Int8Array, _new, TypedData_Int8Array_new, 844274443) \ |
| 96 V(_Uint8Array, _new, TypedData_Uint8Array_new, 997951645) \ | 96 V(_Uint8Array, _new, TypedData_Uint8Array_new, 997951645) \ |
| 97 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 1025045044) \ | 97 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 1025045044) \ |
| 98 V(_Int16Array, _new, TypedData_Int16Array_new, 1064563368) \ | 98 V(_Int16Array, _new, TypedData_Int16Array_new, 1064563368) \ |
| 99 V(_Uint16Array, _new, TypedData_Uint16Array_new, 110927177) \ | 99 V(_Uint16Array, _new, TypedData_Uint16Array_new, 110927177) \ |
| 100 V(_Int32Array, _new, TypedData_Int32Array_new, 770802406) \ | 100 V(_Int32Array, _new, TypedData_Int32Array_new, 770802406) \ |
| 101 V(_Uint32Array, _new, TypedData_Uint32Array_new, 856841876) \ | 101 V(_Uint32Array, _new, TypedData_Uint32Array_new, 856841876) \ |
| 102 V(_Int64Array, _new, TypedData_Int64Array_new, 941769528) \ | 102 V(_Int64Array, _new, TypedData_Int64Array_new, 941769528) \ |
| 103 V(_Uint64Array, _new, TypedData_Uint64Array_new, 977566635) \ | 103 V(_Uint64Array, _new, TypedData_Uint64Array_new, 977566635) \ |
| 104 V(_Float32Array, _new, TypedData_Float32Array_new, 1053133615) \ | 104 V(_Float32Array, _new, TypedData_Float32Array_new, 1053133615) \ |
| 105 V(_Float64Array, _new, TypedData_Float64Array_new, 936673303) \ | 105 V(_Float64Array, _new, TypedData_Float64Array_new, 936673303) \ |
| 106 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 212088644) \ | 106 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 212088644) \ |
| 107 V(_Int8Array, ., TypedData_Int8Array_factory, 632939448) \ | 107 V(_Int8Array, ., TypedData_Int8Array_factory, 156009974) \ |
| 108 V(_Uint8Array, ., TypedData_Uint8Array_factory, 1942390430) \ | 108 V(_Uint8Array, ., TypedData_Uint8Array_factory, 1465460956) \ |
| 109 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 1447100174) \ | 109 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 970170700) \ |
| 110 V(_Int16Array, ., TypedData_Int16Array_factory, 1997238698) \ | 110 V(_Int16Array, ., TypedData_Int16Array_factory, 1520309224) \ |
| 111 V(_Uint16Array, ., TypedData_Uint16Array_factory, 672422545) \ | 111 V(_Uint16Array, ., TypedData_Uint16Array_factory, 195493071) \ |
| 112 V(_Int32Array, ., TypedData_Int32Array_factory, 504367176) \ | 112 V(_Int32Array, ., TypedData_Int32Array_factory, 27437702) \ |
| 113 V(_Uint32Array, ., TypedData_Uint32Array_factory, 31896861) \ | 113 V(_Uint32Array, ., TypedData_Uint32Array_factory, 1702451035) \ |
| 114 V(_Int64Array, ., TypedData_Int64Array_factory, 702290418) \ | 114 V(_Int64Array, ., TypedData_Int64Array_factory, 225360944) \ |
| 115 V(_Uint64Array, ., TypedData_Uint64Array_factory, 59820857) \ | 115 V(_Uint64Array, ., TypedData_Uint64Array_factory, 1730375031) \ |
| 116 V(_Float32Array, ., TypedData_Float32Array_factory, 1040427868) \ | 116 V(_Float32Array, ., TypedData_Float32Array_factory, 563498394) \ |
| 117 V(_Float64Array, ., TypedData_Float64Array_factory, 969149770) \ | 117 V(_Float64Array, ., TypedData_Float64Array_factory, 492220296) \ |
| 118 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 175242544) \ | 118 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 1845796718) \ |
| 119 | 119 |
| 120 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and | 120 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and |
| 121 // _FixedSizeArrayIterator, moveNext. | 121 // _FixedSizeArrayIterator, moveNext. |
| 122 | 122 |
| 123 // Forward declarations. | 123 // Forward declarations. |
| 124 class Assembler; | 124 class Assembler; |
| 125 class Function; | 125 class Function; |
| 126 | 126 |
| 127 class Intrinsifier : public AllStatic { | 127 class Intrinsifier : public AllStatic { |
| 128 public: | 128 public: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 140 CORE_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 140 CORE_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 141 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 141 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 142 TYPEDDATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 142 TYPEDDATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 143 | 143 |
| 144 #undef DECLARE_FUNCTION | 144 #undef DECLARE_FUNCTION |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 } // namespace dart | 147 } // namespace dart |
| 148 | 148 |
| 149 #endif // VM_INTRINSIFIER_H_ | 149 #endif // VM_INTRINSIFIER_H_ |
| OLD | NEW |