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

Side by Side Diff: src/v8.cc

Issue 181453002: Reset trunk to 3.24.35.4 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 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/v8.h ('k') | src/v8natives.js » ('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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() == 75 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() ==
76 i::Isolate::Current()); 76 i::Isolate::Current());
77 77
78 Isolate* isolate = Isolate::Current(); 78 Isolate* isolate = Isolate::Current();
79 if (isolate->IsDead()) return false; 79 if (isolate->IsDead()) return false;
80 if (isolate->IsInitialized()) return true; 80 if (isolate->IsInitialized()) return true;
81 81
82 #ifdef V8_USE_DEFAULT_PLATFORM 82 #ifdef V8_USE_DEFAULT_PLATFORM
83 DefaultPlatform* platform = static_cast<DefaultPlatform*>(platform_); 83 DefaultPlatform* platform = static_cast<DefaultPlatform*>(platform_);
84 platform->SetThreadPoolSize(isolate->max_available_threads()); 84 platform->SetThreadPoolSize(isolate->max_available_threads());
85 // We currently only start the threads early, if we know that we'll use them.
86 if (FLAG_job_based_sweeping) platform->EnsureInitialized();
87 #endif 85 #endif
88 86
89 return isolate->Init(des); 87 return isolate->Init(des);
90 } 88 }
91 89
92 90
93 void V8::TearDown() { 91 void V8::TearDown() {
94 Isolate* isolate = Isolate::Current(); 92 Isolate* isolate = Isolate::Current();
95 ASSERT(isolate->IsDefaultIsolate()); 93 ASSERT(isolate->IsDefaultIsolate());
96 if (!isolate->IsInitialized()) return; 94 if (!isolate->IsInitialized()) return;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 for (int i = 0; i < call_completed_callbacks_->length(); i++) { 141 for (int i = 0; i < call_completed_callbacks_->length(); i++) {
144 if (callback == call_completed_callbacks_->at(i)) { 142 if (callback == call_completed_callbacks_->at(i)) {
145 call_completed_callbacks_->Remove(i); 143 call_completed_callbacks_->Remove(i);
146 } 144 }
147 } 145 }
148 } 146 }
149 147
150 148
151 void V8::FireCallCompletedCallback(Isolate* isolate) { 149 void V8::FireCallCompletedCallback(Isolate* isolate) {
152 bool has_call_completed_callbacks = call_completed_callbacks_ != NULL; 150 bool has_call_completed_callbacks = call_completed_callbacks_ != NULL;
153 bool run_microtasks = isolate->autorun_microtasks() && 151 bool microtask_pending = isolate->microtask_pending();
154 isolate->microtask_pending(); 152 if (!has_call_completed_callbacks && !microtask_pending) return;
155 if (!has_call_completed_callbacks && !run_microtasks) return;
156 153
157 HandleScopeImplementer* handle_scope_implementer = 154 HandleScopeImplementer* handle_scope_implementer =
158 isolate->handle_scope_implementer(); 155 isolate->handle_scope_implementer();
159 if (!handle_scope_implementer->CallDepthIsZero()) return; 156 if (!handle_scope_implementer->CallDepthIsZero()) return;
160 // Fire callbacks. Increase call depth to prevent recursive callbacks. 157 // Fire callbacks. Increase call depth to prevent recursive callbacks.
161 handle_scope_implementer->IncrementCallDepth(); 158 handle_scope_implementer->IncrementCallDepth();
162 if (run_microtasks) Execution::RunMicrotasks(isolate); 159 if (microtask_pending) Execution::RunMicrotasks(isolate);
163 if (has_call_completed_callbacks) { 160 if (has_call_completed_callbacks) {
164 for (int i = 0; i < call_completed_callbacks_->length(); i++) { 161 for (int i = 0; i < call_completed_callbacks_->length(); i++) {
165 call_completed_callbacks_->at(i)(); 162 call_completed_callbacks_->at(i)();
166 } 163 }
167 } 164 }
168 handle_scope_implementer->DecrementCallDepth(); 165 handle_scope_implementer->DecrementCallDepth();
169 } 166 }
170 167
171 168
172 void V8::RunMicrotasks(Isolate* isolate) {
173 if (!isolate->microtask_pending())
174 return;
175
176 HandleScopeImplementer* handle_scope_implementer =
177 isolate->handle_scope_implementer();
178 ASSERT(handle_scope_implementer->CallDepthIsZero());
179
180 // Increase call depth to prevent recursive callbacks.
181 handle_scope_implementer->IncrementCallDepth();
182 Execution::RunMicrotasks(isolate);
183 handle_scope_implementer->DecrementCallDepth();
184 }
185
186
187 void V8::InitializeOncePerProcessImpl() { 169 void V8::InitializeOncePerProcessImpl() {
188 FlagList::EnforceFlagImplications(); 170 FlagList::EnforceFlagImplications();
189 171
190 if (FLAG_predictable) { 172 if (FLAG_predictable) {
191 if (FLAG_random_seed == 0) { 173 if (FLAG_random_seed == 0) {
192 // Avoid random seeds in predictable mode. 174 // Avoid random seeds in predictable mode.
193 FLAG_random_seed = 12347; 175 FLAG_random_seed = 12347;
194 } 176 }
195 FLAG_hash_seed = 0; 177 FLAG_hash_seed = 0;
196 } 178 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 platform_ = NULL; 214 platform_ = NULL;
233 } 215 }
234 216
235 217
236 v8::Platform* V8::GetCurrentPlatform() { 218 v8::Platform* V8::GetCurrentPlatform() {
237 ASSERT(platform_); 219 ASSERT(platform_);
238 return platform_; 220 return platform_;
239 } 221 }
240 222
241 } } // namespace v8::internal 223 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/v8.h ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698