| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 for (int i = 0; i < call_completed_callbacks_->length(); i++) { | 135 for (int i = 0; i < call_completed_callbacks_->length(); i++) { |
| 136 if (callback == call_completed_callbacks_->at(i)) { | 136 if (callback == call_completed_callbacks_->at(i)) { |
| 137 call_completed_callbacks_->Remove(i); | 137 call_completed_callbacks_->Remove(i); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 void V8::FireCallCompletedCallback(Isolate* isolate) { | 143 void V8::FireCallCompletedCallback(Isolate* isolate) { |
| 144 bool has_call_completed_callbacks = call_completed_callbacks_ != NULL; | 144 bool has_call_completed_callbacks = call_completed_callbacks_ != NULL; |
| 145 bool observer_delivery_pending = | 145 bool microtask_pending = isolate->microtask_pending(); |
| 146 FLAG_harmony_observation && isolate->observer_delivery_pending(); | 146 if (!has_call_completed_callbacks && !microtask_pending) return; |
| 147 if (!has_call_completed_callbacks && !observer_delivery_pending) return; | 147 |
| 148 HandleScopeImplementer* handle_scope_implementer = | 148 HandleScopeImplementer* handle_scope_implementer = |
| 149 isolate->handle_scope_implementer(); | 149 isolate->handle_scope_implementer(); |
| 150 if (!handle_scope_implementer->CallDepthIsZero()) return; | 150 if (!handle_scope_implementer->CallDepthIsZero()) return; |
| 151 // Fire callbacks. Increase call depth to prevent recursive callbacks. | 151 // Fire callbacks. Increase call depth to prevent recursive callbacks. |
| 152 handle_scope_implementer->IncrementCallDepth(); | 152 handle_scope_implementer->IncrementCallDepth(); |
| 153 if (observer_delivery_pending) { | 153 if (microtask_pending) Execution::RunMicrotasks(isolate); |
| 154 JSObject::DeliverChangeRecords(isolate); | |
| 155 } | |
| 156 if (has_call_completed_callbacks) { | 154 if (has_call_completed_callbacks) { |
| 157 for (int i = 0; i < call_completed_callbacks_->length(); i++) { | 155 for (int i = 0; i < call_completed_callbacks_->length(); i++) { |
| 158 call_completed_callbacks_->at(i)(); | 156 call_completed_callbacks_->at(i)(); |
| 159 } | 157 } |
| 160 } | 158 } |
| 161 handle_scope_implementer->DecrementCallDepth(); | 159 handle_scope_implementer->DecrementCallDepth(); |
| 162 } | 160 } |
| 163 | 161 |
| 164 | 162 |
| 165 void V8::InitializeOncePerProcessImpl() { | 163 void V8::InitializeOncePerProcessImpl() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 platform_ = NULL; | 199 platform_ = NULL; |
| 202 } | 200 } |
| 203 | 201 |
| 204 | 202 |
| 205 v8::Platform* V8::GetCurrentPlatform() { | 203 v8::Platform* V8::GetCurrentPlatform() { |
| 206 ASSERT(platform_); | 204 ASSERT(platform_); |
| 207 return platform_; | 205 return platform_; |
| 208 } | 206 } |
| 209 | 207 |
| 210 } } // namespace v8::internal | 208 } } // namespace v8::internal |
| OLD | NEW |