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

Side by Side Diff: src/assembler.cc

Issue 9666052: Landing for pliard@chromium.org: Remove static initializers in v8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 9 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 | « src/assembler.h ('k') | src/builtins.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) 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
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
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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 952
931 953
932 ExternalReference ExternalReference::scheduled_exception_address( 954 ExternalReference ExternalReference::scheduled_exception_address(
933 Isolate* isolate) { 955 Isolate* isolate) {
934 return ExternalReference(isolate->scheduled_exception_address()); 956 return ExternalReference(isolate->scheduled_exception_address());
935 } 957 }
936 958
937 959
938 ExternalReference ExternalReference::address_of_min_int() { 960 ExternalReference ExternalReference::address_of_min_int() {
939 return ExternalReference(reinterpret_cast<void*>( 961 return ExternalReference(reinterpret_cast<void*>(
940 const_cast<double*>(&DoubleConstant::min_int))); 962 &double_constants.Pointer()->min_int));
941 } 963 }
942 964
943 965
944 ExternalReference ExternalReference::address_of_one_half() { 966 ExternalReference ExternalReference::address_of_one_half() {
945 return ExternalReference(reinterpret_cast<void*>( 967 return ExternalReference(reinterpret_cast<void*>(
946 const_cast<double*>(&DoubleConstant::one_half))); 968 &double_constants.Pointer()->one_half));
947 } 969 }
948 970
949 971
950 ExternalReference ExternalReference::address_of_minus_zero() { 972 ExternalReference ExternalReference::address_of_minus_zero() {
951 return ExternalReference(reinterpret_cast<void*>( 973 return ExternalReference(reinterpret_cast<void*>(
952 const_cast<double*>(&DoubleConstant::minus_zero))); 974 &double_constants.Pointer()->minus_zero));
953 } 975 }
954 976
955 977
956 ExternalReference ExternalReference::address_of_zero() { 978 ExternalReference ExternalReference::address_of_zero() {
957 return ExternalReference(reinterpret_cast<void*>( 979 return ExternalReference(reinterpret_cast<void*>(
958 const_cast<double*>(&DoubleConstant::zero))); 980 &double_constants.Pointer()->zero));
959 } 981 }
960 982
961 983
962 ExternalReference ExternalReference::address_of_uint8_max_value() { 984 ExternalReference ExternalReference::address_of_uint8_max_value() {
963 return ExternalReference(reinterpret_cast<void*>( 985 return ExternalReference(reinterpret_cast<void*>(
964 const_cast<double*>(&DoubleConstant::uint8_max_value))); 986 &double_constants.Pointer()->uint8_max_value));
965 } 987 }
966 988
967 989
968 ExternalReference ExternalReference::address_of_negative_infinity() { 990 ExternalReference ExternalReference::address_of_negative_infinity() {
969 return ExternalReference(reinterpret_cast<void*>( 991 return ExternalReference(reinterpret_cast<void*>(
970 const_cast<double*>(&DoubleConstant::negative_infinity))); 992 &double_constants.Pointer()->negative_infinity));
971 } 993 }
972 994
973 995
974 ExternalReference ExternalReference::address_of_canonical_non_hole_nan() { 996 ExternalReference ExternalReference::address_of_canonical_non_hole_nan() {
975 return ExternalReference(reinterpret_cast<void*>( 997 return ExternalReference(reinterpret_cast<void*>(
976 const_cast<double*>(&DoubleConstant::canonical_non_hole_nan))); 998 &double_constants.Pointer()->canonical_non_hole_nan));
977 } 999 }
978 1000
979 1001
980 ExternalReference ExternalReference::address_of_the_hole_nan() { 1002 ExternalReference ExternalReference::address_of_the_hole_nan() {
981 return ExternalReference(reinterpret_cast<void*>( 1003 return ExternalReference(reinterpret_cast<void*>(
982 const_cast<double*>(&DoubleConstant::the_hole_nan))); 1004 &double_constants.Pointer()->the_hole_nan));
983 } 1005 }
984 1006
985 1007
986 #ifndef V8_INTERPRETED_REGEXP 1008 #ifndef V8_INTERPRETED_REGEXP
987 1009
988 ExternalReference ExternalReference::re_check_stack_guard_state( 1010 ExternalReference ExternalReference::re_check_stack_guard_state(
989 Isolate* isolate) { 1011 Isolate* isolate) {
990 Address function; 1012 Address function;
991 #ifdef V8_TARGET_ARCH_X64 1013 #ifdef V8_TARGET_ARCH_X64
992 function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState); 1014 function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1298 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1277 state_.written_position = state_.current_position; 1299 state_.written_position = state_.current_position;
1278 written = true; 1300 written = true;
1279 } 1301 }
1280 1302
1281 // Return whether something was written. 1303 // Return whether something was written.
1282 return written; 1304 return written;
1283 } 1305 }
1284 1306
1285 } } // namespace v8::internal 1307 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698