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

Side by Side Diff: src/v8.cc

Issue 65143007: Removed dead function V8::FillHeapNumberWithRandom. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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/v8.h ('k') | test/cctest/test-random.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 if (has_call_completed_callbacks) { 165 if (has_call_completed_callbacks) {
166 for (int i = 0; i < call_completed_callbacks_->length(); i++) { 166 for (int i = 0; i < call_completed_callbacks_->length(); i++) {
167 call_completed_callbacks_->at(i)(); 167 call_completed_callbacks_->at(i)();
168 } 168 }
169 } 169 }
170 handle_scope_implementer->DecrementCallDepth(); 170 handle_scope_implementer->DecrementCallDepth();
171 } 171 }
172 172
173 173
174 // Use a union type to avoid type-aliasing optimizations in GCC.
175 typedef union {
176 double double_value;
177 uint64_t uint64_t_value;
178 } double_int_union;
179
180
181 Object* V8::FillHeapNumberWithRandom(Object* heap_number,
182 Context* context) {
183 double_int_union r;
184 uint64_t random_bits = Random(context);
185 // Convert 32 random bits to 0.(32 random bits) in a double
186 // by computing:
187 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
188 static const double binary_million = 1048576.0;
189 r.double_value = binary_million;
190 r.uint64_t_value |= random_bits;
191 r.double_value -= binary_million;
192
193 HeapNumber::cast(heap_number)->set_value(r.double_value);
194 return heap_number;
195 }
196
197
198 void V8::InitializeOncePerProcessImpl() { 174 void V8::InitializeOncePerProcessImpl() {
199 FlagList::EnforceFlagImplications(); 175 FlagList::EnforceFlagImplications();
200 if (FLAG_stress_compaction) { 176 if (FLAG_stress_compaction) {
201 FLAG_force_marking_deque_overflows = true; 177 FLAG_force_marking_deque_overflows = true;
202 FLAG_gc_global = true; 178 FLAG_gc_global = true;
203 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; 179 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2;
204 } 180 }
205 181
206 if (FLAG_concurrent_recompilation && 182 if (FLAG_concurrent_recompilation &&
207 (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs)) { 183 (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs)) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 ExternalReference::SetUp(); 220 ExternalReference::SetUp();
245 Bootstrapper::InitializeOncePerProcess(); 221 Bootstrapper::InitializeOncePerProcess();
246 } 222 }
247 223
248 224
249 void V8::InitializeOncePerProcess() { 225 void V8::InitializeOncePerProcess() {
250 CallOnce(&init_once, &InitializeOncePerProcessImpl); 226 CallOnce(&init_once, &InitializeOncePerProcessImpl);
251 } 227 }
252 228
253 } } // namespace v8::internal 229 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/v8.h ('k') | test/cctest/test-random.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698