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" | |
49 #include "platform.h" | 48 #include "platform.h" |
50 #include "regexp-macro-assembler.h" | 49 #include "regexp-macro-assembler.h" |
51 #include "regexp-stack.h" | 50 #include "regexp-stack.h" |
52 #include "runtime.h" | 51 #include "runtime.h" |
53 #include "serialize.h" | 52 #include "serialize.h" |
54 #include "store-buffer-inl.h" | 53 #include "store-buffer-inl.h" |
55 #include "stub-cache.h" | 54 #include "stub-cache.h" |
56 #include "token.h" | 55 #include "token.h" |
57 | 56 |
58 #if V8_TARGET_ARCH_IA32 | 57 #if V8_TARGET_ARCH_IA32 |
(...skipping 19 matching lines...) Expand all Loading... |
78 #elif V8_TARGET_ARCH_MIPS | 77 #elif V8_TARGET_ARCH_MIPS |
79 #include "mips/regexp-macro-assembler-mips.h" | 78 #include "mips/regexp-macro-assembler-mips.h" |
80 #else // Unknown architecture. | 79 #else // Unknown architecture. |
81 #error "Unknown architecture." | 80 #error "Unknown architecture." |
82 #endif // Target architecture. | 81 #endif // Target architecture. |
83 #endif // V8_INTERPRETED_REGEXP | 82 #endif // V8_INTERPRETED_REGEXP |
84 | 83 |
85 namespace v8 { | 84 namespace v8 { |
86 namespace internal { | 85 namespace internal { |
87 | 86 |
88 // ----------------------------------------------------------------------------- | |
89 // Common double constants. | |
90 | 87 |
91 struct DoubleConstant BASE_EMBEDDED { | 88 const double DoubleConstant::min_int = kMinInt; |
92 double min_int; | 89 const double DoubleConstant::one_half = 0.5; |
93 double one_half; | 90 const double DoubleConstant::minus_zero = -0.0; |
94 double minus_zero; | 91 const double DoubleConstant::uint8_max_value = 255; |
95 double zero; | 92 const double DoubleConstant::zero = 0.0; |
96 double uint8_max_value; | 93 const double DoubleConstant::canonical_non_hole_nan = OS::nan_value(); |
97 double negative_infinity; | 94 const double DoubleConstant::the_hole_nan = BitCast<double>(kHoleNanInt64); |
98 double canonical_non_hole_nan; | 95 const double DoubleConstant::negative_infinity = -V8_INFINITY; |
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 | |
118 const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING"; | 96 const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING"; |
119 | 97 |
120 // ----------------------------------------------------------------------------- | 98 // ----------------------------------------------------------------------------- |
121 // Implementation of AssemblerBase | 99 // Implementation of AssemblerBase |
122 | 100 |
123 AssemblerBase::AssemblerBase(Isolate* isolate) | 101 AssemblerBase::AssemblerBase(Isolate* isolate) |
124 : isolate_(isolate), | 102 : isolate_(isolate), |
125 jit_cookie_(0) { | 103 jit_cookie_(0) { |
126 if (FLAG_mask_constants_with_cookie && isolate != NULL) { | 104 if (FLAG_mask_constants_with_cookie && isolate != NULL) { |
127 jit_cookie_ = V8::RandomPrivate(isolate); | 105 jit_cookie_ = V8::RandomPrivate(isolate); |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 | 930 |
953 | 931 |
954 ExternalReference ExternalReference::scheduled_exception_address( | 932 ExternalReference ExternalReference::scheduled_exception_address( |
955 Isolate* isolate) { | 933 Isolate* isolate) { |
956 return ExternalReference(isolate->scheduled_exception_address()); | 934 return ExternalReference(isolate->scheduled_exception_address()); |
957 } | 935 } |
958 | 936 |
959 | 937 |
960 ExternalReference ExternalReference::address_of_min_int() { | 938 ExternalReference ExternalReference::address_of_min_int() { |
961 return ExternalReference(reinterpret_cast<void*>( | 939 return ExternalReference(reinterpret_cast<void*>( |
962 &double_constants.Pointer()->min_int)); | 940 const_cast<double*>(&DoubleConstant::min_int))); |
963 } | 941 } |
964 | 942 |
965 | 943 |
966 ExternalReference ExternalReference::address_of_one_half() { | 944 ExternalReference ExternalReference::address_of_one_half() { |
967 return ExternalReference(reinterpret_cast<void*>( | 945 return ExternalReference(reinterpret_cast<void*>( |
968 &double_constants.Pointer()->one_half)); | 946 const_cast<double*>(&DoubleConstant::one_half))); |
969 } | 947 } |
970 | 948 |
971 | 949 |
972 ExternalReference ExternalReference::address_of_minus_zero() { | 950 ExternalReference ExternalReference::address_of_minus_zero() { |
973 return ExternalReference(reinterpret_cast<void*>( | 951 return ExternalReference(reinterpret_cast<void*>( |
974 &double_constants.Pointer()->minus_zero)); | 952 const_cast<double*>(&DoubleConstant::minus_zero))); |
975 } | 953 } |
976 | 954 |
977 | 955 |
978 ExternalReference ExternalReference::address_of_zero() { | 956 ExternalReference ExternalReference::address_of_zero() { |
979 return ExternalReference(reinterpret_cast<void*>( | 957 return ExternalReference(reinterpret_cast<void*>( |
980 &double_constants.Pointer()->zero)); | 958 const_cast<double*>(&DoubleConstant::zero))); |
981 } | 959 } |
982 | 960 |
983 | 961 |
984 ExternalReference ExternalReference::address_of_uint8_max_value() { | 962 ExternalReference ExternalReference::address_of_uint8_max_value() { |
985 return ExternalReference(reinterpret_cast<void*>( | 963 return ExternalReference(reinterpret_cast<void*>( |
986 &double_constants.Pointer()->uint8_max_value)); | 964 const_cast<double*>(&DoubleConstant::uint8_max_value))); |
987 } | 965 } |
988 | 966 |
989 | 967 |
990 ExternalReference ExternalReference::address_of_negative_infinity() { | 968 ExternalReference ExternalReference::address_of_negative_infinity() { |
991 return ExternalReference(reinterpret_cast<void*>( | 969 return ExternalReference(reinterpret_cast<void*>( |
992 &double_constants.Pointer()->negative_infinity)); | 970 const_cast<double*>(&DoubleConstant::negative_infinity))); |
993 } | 971 } |
994 | 972 |
995 | 973 |
996 ExternalReference ExternalReference::address_of_canonical_non_hole_nan() { | 974 ExternalReference ExternalReference::address_of_canonical_non_hole_nan() { |
997 return ExternalReference(reinterpret_cast<void*>( | 975 return ExternalReference(reinterpret_cast<void*>( |
998 &double_constants.Pointer()->canonical_non_hole_nan)); | 976 const_cast<double*>(&DoubleConstant::canonical_non_hole_nan))); |
999 } | 977 } |
1000 | 978 |
1001 | 979 |
1002 ExternalReference ExternalReference::address_of_the_hole_nan() { | 980 ExternalReference ExternalReference::address_of_the_hole_nan() { |
1003 return ExternalReference(reinterpret_cast<void*>( | 981 return ExternalReference(reinterpret_cast<void*>( |
1004 &double_constants.Pointer()->the_hole_nan)); | 982 const_cast<double*>(&DoubleConstant::the_hole_nan))); |
1005 } | 983 } |
1006 | 984 |
1007 | 985 |
1008 #ifndef V8_INTERPRETED_REGEXP | 986 #ifndef V8_INTERPRETED_REGEXP |
1009 | 987 |
1010 ExternalReference ExternalReference::re_check_stack_guard_state( | 988 ExternalReference ExternalReference::re_check_stack_guard_state( |
1011 Isolate* isolate) { | 989 Isolate* isolate) { |
1012 Address function; | 990 Address function; |
1013 #ifdef V8_TARGET_ARCH_X64 | 991 #ifdef V8_TARGET_ARCH_X64 |
1014 function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState); | 992 function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1276 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
1299 state_.written_position = state_.current_position; | 1277 state_.written_position = state_.current_position; |
1300 written = true; | 1278 written = true; |
1301 } | 1279 } |
1302 | 1280 |
1303 // Return whether something was written. | 1281 // Return whether something was written. |
1304 return written; | 1282 return written; |
1305 } | 1283 } |
1306 | 1284 |
1307 } } // namespace v8::internal | 1285 } } // namespace v8::internal |
OLD | NEW |