OLD | NEW |
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 for (int i = 0; i < call_completed_callbacks_->length(); i++) { | 144 for (int i = 0; i < call_completed_callbacks_->length(); i++) { |
145 if (callback == call_completed_callbacks_->at(i)) { | 145 if (callback == call_completed_callbacks_->at(i)) { |
146 call_completed_callbacks_->Remove(i); | 146 call_completed_callbacks_->Remove(i); |
147 } | 147 } |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 void V8::FireCallCompletedCallback(Isolate* isolate) { | 152 void V8::FireCallCompletedCallback(Isolate* isolate) { |
153 bool has_call_completed_callbacks = call_completed_callbacks_ != NULL; | 153 bool has_call_completed_callbacks = call_completed_callbacks_ != NULL; |
154 bool observer_delivery_pending = | 154 bool microtasks_pending = isolate->microtasks_pending(); |
155 FLAG_harmony_observation && isolate->observer_delivery_pending(); | 155 if (!has_call_completed_callbacks && !microtasks_pending) return; |
156 if (!has_call_completed_callbacks && !observer_delivery_pending) return; | 156 |
157 HandleScopeImplementer* handle_scope_implementer = | 157 HandleScopeImplementer* handle_scope_implementer = |
158 isolate->handle_scope_implementer(); | 158 isolate->handle_scope_implementer(); |
159 if (!handle_scope_implementer->CallDepthIsZero()) return; | 159 if (!handle_scope_implementer->CallDepthIsZero()) return; |
160 // Fire callbacks. Increase call depth to prevent recursive callbacks. | 160 // Fire callbacks. Increase call depth to prevent recursive callbacks. |
161 handle_scope_implementer->IncrementCallDepth(); | 161 handle_scope_implementer->IncrementCallDepth(); |
162 if (observer_delivery_pending) { | 162 if (microtasks_pending) Execution::RunMicrotasks(isolate); |
163 JSObject::DeliverChangeRecords(isolate); | |
164 } | |
165 if (has_call_completed_callbacks) { | 163 if (has_call_completed_callbacks) { |
166 for (int i = 0; i < call_completed_callbacks_->length(); i++) { | 164 for (int i = 0; i < call_completed_callbacks_->length(); i++) { |
167 call_completed_callbacks_->at(i)(); | 165 call_completed_callbacks_->at(i)(); |
168 } | 166 } |
169 } | 167 } |
170 handle_scope_implementer->DecrementCallDepth(); | 168 handle_scope_implementer->DecrementCallDepth(); |
171 } | 169 } |
172 | 170 |
173 | 171 |
174 void V8::InitializeOncePerProcessImpl() { | 172 void V8::InitializeOncePerProcessImpl() { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 ExternalReference::SetUp(); | 218 ExternalReference::SetUp(); |
221 Bootstrapper::InitializeOncePerProcess(); | 219 Bootstrapper::InitializeOncePerProcess(); |
222 } | 220 } |
223 | 221 |
224 | 222 |
225 void V8::InitializeOncePerProcess() { | 223 void V8::InitializeOncePerProcess() { |
226 CallOnce(&init_once, &InitializeOncePerProcessImpl); | 224 CallOnce(&init_once, &InitializeOncePerProcessImpl); |
227 } | 225 } |
228 | 226 |
229 } } // namespace v8::internal | 227 } } // namespace v8::internal |
OLD | NEW |