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

Side by Side Diff: src/v8.cc

Issue 6794050: Revert "[Arguments] Merge (7442,7496] from bleeding_edge." (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/arguments
Patch Set: Created 9 years, 8 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/v8.h ('k') | src/v8-counters.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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
11 // with the distribution. 11 // with the distribution.
(...skipping 22 matching lines...) Expand all
34 #include "heap-profiler.h" 34 #include "heap-profiler.h"
35 #include "hydrogen.h" 35 #include "hydrogen.h"
36 #include "lithium-allocator.h" 36 #include "lithium-allocator.h"
37 #include "log.h" 37 #include "log.h"
38 #include "runtime-profiler.h" 38 #include "runtime-profiler.h"
39 #include "serialize.h" 39 #include "serialize.h"
40 40
41 namespace v8 { 41 namespace v8 {
42 namespace internal { 42 namespace internal {
43 43
44 static Mutex* init_once_mutex = OS::CreateMutex();
45 static bool init_once_called = false;
46
47 bool V8::is_running_ = false; 44 bool V8::is_running_ = false;
48 bool V8::has_been_setup_ = false; 45 bool V8::has_been_setup_ = false;
49 bool V8::has_been_disposed_ = false; 46 bool V8::has_been_disposed_ = false;
50 bool V8::has_fatal_error_ = false; 47 bool V8::has_fatal_error_ = false;
51 bool V8::use_crankshaft_ = true; 48 bool V8::use_crankshaft_ = true;
52 49
53 50
54 bool V8::Initialize(Deserializer* des) { 51 bool V8::Initialize(Deserializer* des) {
55 InitializeOncePerProcess();
56
57 // The current thread may not yet had entered an isolate to run. 52 // The current thread may not yet had entered an isolate to run.
58 // Note the Isolate::Current() may be non-null because for various 53 // Note the Isolate::Current() may be non-null because for various
59 // initialization purposes an initializing thread may be assigned an isolate 54 // initialization purposes an initializing thread may be assigned an isolate
60 // but not actually enter it. 55 // but not actually enter it.
61 if (i::Isolate::CurrentPerIsolateThreadData() == NULL) { 56 if (i::Isolate::CurrentPerIsolateThreadData() == NULL) {
62 i::Isolate::EnterDefaultIsolate(); 57 i::Isolate::EnterDefaultIsolate();
63 } 58 }
64 59
65 ASSERT(i::Isolate::CurrentPerIsolateThreadData() != NULL); 60 ASSERT(i::Isolate::CurrentPerIsolateThreadData() != NULL);
66 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->thread_id() == 61 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->thread_id() ==
67 i::Thread::GetThreadLocalInt(i::Isolate::thread_id_key())); 62 i::Thread::GetThreadLocalInt(i::Isolate::thread_id_key()));
68 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() == 63 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() ==
69 i::Isolate::Current()); 64 i::Isolate::Current());
70 65
71 if (IsDead()) return false; 66 if (IsDead()) return false;
72 67
73 Isolate* isolate = Isolate::Current(); 68 Isolate* isolate = Isolate::Current();
74 if (isolate->IsInitialized()) return true; 69 if (isolate->IsInitialized()) return true;
75 70
71 #if defined(V8_TARGET_ARCH_ARM) && !defined(USE_ARM_EABI)
72 use_crankshaft_ = false;
73 #else
74 use_crankshaft_ = FLAG_crankshaft;
75 #endif
76
77 // Peephole optimization might interfere with deoptimization.
78 FLAG_peephole_optimization = !use_crankshaft_;
79
76 is_running_ = true; 80 is_running_ = true;
77 has_been_setup_ = true; 81 has_been_setup_ = true;
78 has_fatal_error_ = false; 82 has_fatal_error_ = false;
79 has_been_disposed_ = false; 83 has_been_disposed_ = false;
80 84
81 return isolate->Init(des); 85 return isolate->Init(des);
82 } 86 }
83 87
84 88
85 void V8::SetFatalError() { 89 void V8::SetFatalError() {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 164 }
161 165
162 166
163 // Use a union type to avoid type-aliasing optimizations in GCC. 167 // Use a union type to avoid type-aliasing optimizations in GCC.
164 typedef union { 168 typedef union {
165 double double_value; 169 double double_value;
166 uint64_t uint64_t_value; 170 uint64_t uint64_t_value;
167 } double_int_union; 171 } double_int_union;
168 172
169 173
170 Object* V8::FillHeapNumberWithRandom(Object* heap_number, Isolate* isolate) { 174 Object* V8::FillHeapNumberWithRandom(Object* heap_number) {
171 uint64_t random_bits = Random(isolate); 175 uint64_t random_bits = Random(Isolate::Current());
172 // Make a double* from address (heap_number + sizeof(double)). 176 // Make a double* from address (heap_number + sizeof(double)).
173 double_int_union* r = reinterpret_cast<double_int_union*>( 177 double_int_union* r = reinterpret_cast<double_int_union*>(
174 reinterpret_cast<char*>(heap_number) + 178 reinterpret_cast<char*>(heap_number) +
175 HeapNumber::kValueOffset - kHeapObjectTag); 179 HeapNumber::kValueOffset - kHeapObjectTag);
176 // Convert 32 random bits to 0.(32 random bits) in a double 180 // Convert 32 random bits to 0.(32 random bits) in a double
177 // by computing: 181 // by computing:
178 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). 182 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
179 const double binary_million = 1048576.0; 183 const double binary_million = 1048576.0;
180 r->double_value = binary_million; 184 r->double_value = binary_million;
181 r->uint64_t_value |= random_bits; 185 r->uint64_t_value |= random_bits;
182 r->double_value -= binary_million; 186 r->double_value -= binary_million;
183 187
184 return heap_number; 188 return heap_number;
185 } 189 }
186 190
187
188 void V8::InitializeOncePerProcess() {
189 ScopedLock lock(init_once_mutex);
190 if (init_once_called) return;
191 init_once_called = true;
192
193 // Setup the platform OS support.
194 OS::Setup();
195
196 #if defined(V8_TARGET_ARCH_ARM) && !defined(USE_ARM_EABI)
197 use_crankshaft_ = false;
198 #else
199 use_crankshaft_ = FLAG_crankshaft;
200 #endif
201
202 if (Serializer::enabled()) {
203 use_crankshaft_ = false;
204 }
205
206 CPU::Setup();
207 if (!CPU::SupportsCrankshaft()) {
208 use_crankshaft_ = false;
209 }
210
211 // Peephole optimization might interfere with deoptimization.
212 FLAG_peephole_optimization = !use_crankshaft_;
213 }
214
215 } } // namespace v8::internal 191 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/v8.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698