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

Side by Side Diff: src/v8.cc

Issue 11266011: Delivery logic for Object.observe (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Renamed and added comment Created 8 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/runtime.cc ('k') | test/cctest/test-object-observe.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 20 matching lines...) Expand all
31 #include "isolate.h" 31 #include "isolate.h"
32 #include "elements.h" 32 #include "elements.h"
33 #include "bootstrapper.h" 33 #include "bootstrapper.h"
34 #include "debug.h" 34 #include "debug.h"
35 #include "deoptimizer.h" 35 #include "deoptimizer.h"
36 #include "frames.h" 36 #include "frames.h"
37 #include "heap-profiler.h" 37 #include "heap-profiler.h"
38 #include "hydrogen.h" 38 #include "hydrogen.h"
39 #include "lithium-allocator.h" 39 #include "lithium-allocator.h"
40 #include "log.h" 40 #include "log.h"
41 #include "objects.h"
41 #include "once.h" 42 #include "once.h"
42 #include "platform.h" 43 #include "platform.h"
43 #include "runtime-profiler.h" 44 #include "runtime-profiler.h"
44 #include "serialize.h" 45 #include "serialize.h"
45 #include "store-buffer.h" 46 #include "store-buffer.h"
46 47
47 namespace v8 { 48 namespace v8 {
48 namespace internal { 49 namespace internal {
49 50
50 V8_DECLARE_ONCE(init_once); 51 V8_DECLARE_ONCE(init_once);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 if (call_completed_callbacks_ == NULL) return; 210 if (call_completed_callbacks_ == NULL) return;
210 for (int i = 0; i < call_completed_callbacks_->length(); i++) { 211 for (int i = 0; i < call_completed_callbacks_->length(); i++) {
211 if (callback == call_completed_callbacks_->at(i)) { 212 if (callback == call_completed_callbacks_->at(i)) {
212 call_completed_callbacks_->Remove(i); 213 call_completed_callbacks_->Remove(i);
213 } 214 }
214 } 215 }
215 } 216 }
216 217
217 218
218 void V8::FireCallCompletedCallback(Isolate* isolate) { 219 void V8::FireCallCompletedCallback(Isolate* isolate) {
219 if (call_completed_callbacks_ == NULL) return; 220 bool has_call_completed_callbacks = call_completed_callbacks_ != NULL;
221 bool observer_delivery_pending =
222 FLAG_harmony_observation && isolate->observer_delivery_pending();
223 if (!has_call_completed_callbacks && !observer_delivery_pending) return;
220 HandleScopeImplementer* handle_scope_implementer = 224 HandleScopeImplementer* handle_scope_implementer =
221 isolate->handle_scope_implementer(); 225 isolate->handle_scope_implementer();
222 if (!handle_scope_implementer->CallDepthIsZero()) return; 226 if (!handle_scope_implementer->CallDepthIsZero()) return;
223 // Fire callbacks. Increase call depth to prevent recursive callbacks. 227 // Fire callbacks. Increase call depth to prevent recursive callbacks.
224 handle_scope_implementer->IncrementCallDepth(); 228 handle_scope_implementer->IncrementCallDepth();
225 for (int i = 0; i < call_completed_callbacks_->length(); i++) { 229 if (observer_delivery_pending) {
226 call_completed_callbacks_->at(i)(); 230 JSObject::DeliverChangeRecords(isolate);
231 }
232 if (has_call_completed_callbacks) {
233 for (int i = 0; i < call_completed_callbacks_->length(); i++) {
234 call_completed_callbacks_->at(i)();
235 }
227 } 236 }
228 handle_scope_implementer->DecrementCallDepth(); 237 handle_scope_implementer->DecrementCallDepth();
229 } 238 }
230 239
231 240
232 // Use a union type to avoid type-aliasing optimizations in GCC. 241 // Use a union type to avoid type-aliasing optimizations in GCC.
233 typedef union { 242 typedef union {
234 double double_value; 243 double double_value;
235 uint64_t uint64_t_value; 244 uint64_t uint64_t_value;
236 } double_int_union; 245 } double_int_union;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 SetUpJSCallerSavedCodeData(); 291 SetUpJSCallerSavedCodeData();
283 SamplerRegistry::SetUp(); 292 SamplerRegistry::SetUp();
284 ExternalReference::SetUp(); 293 ExternalReference::SetUp();
285 } 294 }
286 295
287 void V8::InitializeOncePerProcess() { 296 void V8::InitializeOncePerProcess() {
288 CallOnce(&init_once, &InitializeOncePerProcessImpl); 297 CallOnce(&init_once, &InitializeOncePerProcessImpl);
289 } 298 }
290 299
291 } } // namespace v8::internal 300 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-object-observe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698