OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "api.h" | 38 #include "api.h" |
39 #include "builtins.h" | 39 #include "builtins.h" |
40 #include "counters.h" | 40 #include "counters.h" |
41 #include "cpu.h" | 41 #include "cpu.h" |
42 #include "debug.h" | 42 #include "debug.h" |
43 #include "deoptimizer.h" | 43 #include "deoptimizer.h" |
44 #include "execution.h" | 44 #include "execution.h" |
45 #include "ic.h" | 45 #include "ic.h" |
46 #include "isolate.h" | 46 #include "isolate.h" |
47 #include "jsregexp.h" | 47 #include "jsregexp.h" |
| 48 #include "lazy-instance.h" |
48 #include "platform.h" | 49 #include "platform.h" |
49 #include "regexp-macro-assembler.h" | 50 #include "regexp-macro-assembler.h" |
50 #include "regexp-stack.h" | 51 #include "regexp-stack.h" |
51 #include "runtime.h" | 52 #include "runtime.h" |
52 #include "serialize.h" | 53 #include "serialize.h" |
53 #include "store-buffer-inl.h" | 54 #include "store-buffer-inl.h" |
54 #include "stub-cache.h" | 55 #include "stub-cache.h" |
55 #include "token.h" | 56 #include "token.h" |
56 | 57 |
57 #if V8_TARGET_ARCH_IA32 | 58 #if V8_TARGET_ARCH_IA32 |
(...skipping 19 matching lines...) Expand all Loading... |
77 #elif V8_TARGET_ARCH_MIPS | 78 #elif V8_TARGET_ARCH_MIPS |
78 #include "mips/regexp-macro-assembler-mips.h" | 79 #include "mips/regexp-macro-assembler-mips.h" |
79 #else // Unknown architecture. | 80 #else // Unknown architecture. |
80 #error "Unknown architecture." | 81 #error "Unknown architecture." |
81 #endif // Target architecture. | 82 #endif // Target architecture. |
82 #endif // V8_INTERPRETED_REGEXP | 83 #endif // V8_INTERPRETED_REGEXP |
83 | 84 |
84 namespace v8 { | 85 namespace v8 { |
85 namespace internal { | 86 namespace internal { |
86 | 87 |
| 88 // ----------------------------------------------------------------------------- |
| 89 // Common double constants. |
87 | 90 |
88 const double DoubleConstant::min_int = kMinInt; | 91 struct DoubleConstant BASE_EMBEDDED { |
89 const double DoubleConstant::one_half = 0.5; | 92 double min_int; |
90 const double DoubleConstant::minus_zero = -0.0; | 93 double one_half; |
91 const double DoubleConstant::uint8_max_value = 255; | 94 double minus_zero; |
92 const double DoubleConstant::zero = 0.0; | 95 double zero; |
93 const double DoubleConstant::canonical_non_hole_nan = OS::nan_value(); | 96 double uint8_max_value; |
94 const double DoubleConstant::the_hole_nan = BitCast<double>(kHoleNanInt64); | 97 double negative_infinity; |
95 const double DoubleConstant::negative_infinity = -V8_INFINITY; | 98 double canonical_non_hole_nan; |
| 99 double the_hole_nan; |
| 100 }; |
| 101 |
| 102 struct InitializeDoubleConstants { |
| 103 static void Construct(DoubleConstant* double_constants) { |
| 104 double_constants->min_int = kMinInt; |
| 105 double_constants->one_half = 0.5; |
| 106 double_constants->minus_zero = -0.0; |
| 107 double_constants->uint8_max_value = 255; |
| 108 double_constants->zero = 0.0; |
| 109 double_constants->canonical_non_hole_nan = OS::nan_value(); |
| 110 double_constants->the_hole_nan = BitCast<double>(kHoleNanInt64); |
| 111 double_constants->negative_infinity = -V8_INFINITY; |
| 112 } |
| 113 }; |
| 114 |
| 115 static LazyInstance<DoubleConstant, InitializeDoubleConstants>::type |
| 116 double_constants = LAZY_INSTANCE_INITIALIZER; |
| 117 |
96 const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING"; | 118 const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING"; |
97 | 119 |
98 // ----------------------------------------------------------------------------- | 120 // ----------------------------------------------------------------------------- |
99 // Implementation of AssemblerBase | 121 // Implementation of AssemblerBase |
100 | 122 |
101 AssemblerBase::AssemblerBase(Isolate* isolate) | 123 AssemblerBase::AssemblerBase(Isolate* isolate) |
102 : isolate_(isolate), | 124 : isolate_(isolate), |
103 jit_cookie_(0) { | 125 jit_cookie_(0) { |
104 if (FLAG_mask_constants_with_cookie && isolate != NULL) { | 126 if (FLAG_mask_constants_with_cookie && isolate != NULL) { |
105 jit_cookie_ = V8::RandomPrivate(isolate); | 127 jit_cookie_ = V8::RandomPrivate(isolate); |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 941 |
920 | 942 |
921 ExternalReference ExternalReference::scheduled_exception_address( | 943 ExternalReference ExternalReference::scheduled_exception_address( |
922 Isolate* isolate) { | 944 Isolate* isolate) { |
923 return ExternalReference(isolate->scheduled_exception_address()); | 945 return ExternalReference(isolate->scheduled_exception_address()); |
924 } | 946 } |
925 | 947 |
926 | 948 |
927 ExternalReference ExternalReference::address_of_min_int() { | 949 ExternalReference ExternalReference::address_of_min_int() { |
928 return ExternalReference(reinterpret_cast<void*>( | 950 return ExternalReference(reinterpret_cast<void*>( |
929 const_cast<double*>(&DoubleConstant::min_int))); | 951 &double_constants.Pointer()->min_int)); |
930 } | 952 } |
931 | 953 |
932 | 954 |
933 ExternalReference ExternalReference::address_of_one_half() { | 955 ExternalReference ExternalReference::address_of_one_half() { |
934 return ExternalReference(reinterpret_cast<void*>( | 956 return ExternalReference(reinterpret_cast<void*>( |
935 const_cast<double*>(&DoubleConstant::one_half))); | 957 &double_constants.Pointer()->one_half)); |
936 } | 958 } |
937 | 959 |
938 | 960 |
939 ExternalReference ExternalReference::address_of_minus_zero() { | 961 ExternalReference ExternalReference::address_of_minus_zero() { |
940 return ExternalReference(reinterpret_cast<void*>( | 962 return ExternalReference(reinterpret_cast<void*>( |
941 const_cast<double*>(&DoubleConstant::minus_zero))); | 963 &double_constants.Pointer()->minus_zero)); |
942 } | 964 } |
943 | 965 |
944 | 966 |
945 ExternalReference ExternalReference::address_of_zero() { | 967 ExternalReference ExternalReference::address_of_zero() { |
946 return ExternalReference(reinterpret_cast<void*>( | 968 return ExternalReference(reinterpret_cast<void*>( |
947 const_cast<double*>(&DoubleConstant::zero))); | 969 &double_constants.Pointer()->zero)); |
948 } | 970 } |
949 | 971 |
950 | 972 |
951 ExternalReference ExternalReference::address_of_uint8_max_value() { | 973 ExternalReference ExternalReference::address_of_uint8_max_value() { |
952 return ExternalReference(reinterpret_cast<void*>( | 974 return ExternalReference(reinterpret_cast<void*>( |
953 const_cast<double*>(&DoubleConstant::uint8_max_value))); | 975 &double_constants.Pointer()->uint8_max_value)); |
954 } | 976 } |
955 | 977 |
956 | 978 |
957 ExternalReference ExternalReference::address_of_negative_infinity() { | 979 ExternalReference ExternalReference::address_of_negative_infinity() { |
958 return ExternalReference(reinterpret_cast<void*>( | 980 return ExternalReference(reinterpret_cast<void*>( |
959 const_cast<double*>(&DoubleConstant::negative_infinity))); | 981 &double_constants.Pointer()->negative_infinity)); |
960 } | 982 } |
961 | 983 |
962 | 984 |
963 ExternalReference ExternalReference::address_of_canonical_non_hole_nan() { | 985 ExternalReference ExternalReference::address_of_canonical_non_hole_nan() { |
964 return ExternalReference(reinterpret_cast<void*>( | 986 return ExternalReference(reinterpret_cast<void*>( |
965 const_cast<double*>(&DoubleConstant::canonical_non_hole_nan))); | 987 &double_constants.Pointer()->canonical_non_hole_nan)); |
966 } | 988 } |
967 | 989 |
968 | 990 |
969 ExternalReference ExternalReference::address_of_the_hole_nan() { | 991 ExternalReference ExternalReference::address_of_the_hole_nan() { |
970 return ExternalReference(reinterpret_cast<void*>( | 992 return ExternalReference(reinterpret_cast<void*>( |
971 const_cast<double*>(&DoubleConstant::the_hole_nan))); | 993 &double_constants.Pointer()->the_hole_nan)); |
972 } | 994 } |
973 | 995 |
974 | 996 |
975 #ifndef V8_INTERPRETED_REGEXP | 997 #ifndef V8_INTERPRETED_REGEXP |
976 | 998 |
977 ExternalReference ExternalReference::re_check_stack_guard_state( | 999 ExternalReference ExternalReference::re_check_stack_guard_state( |
978 Isolate* isolate) { | 1000 Isolate* isolate) { |
979 Address function; | 1001 Address function; |
980 #ifdef V8_TARGET_ARCH_X64 | 1002 #ifdef V8_TARGET_ARCH_X64 |
981 function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState); | 1003 function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1287 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
1266 state_.written_position = state_.current_position; | 1288 state_.written_position = state_.current_position; |
1267 written = true; | 1289 written = true; |
1268 } | 1290 } |
1269 | 1291 |
1270 // Return whether something was written. | 1292 // Return whether something was written. |
1271 return written; | 1293 return written; |
1272 } | 1294 } |
1273 | 1295 |
1274 } } // namespace v8::internal | 1296 } } // namespace v8::internal |
OLD | NEW |