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

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: Rebased against newest per-isolate patch 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
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 has_active_object_observers = isolate->has_active_object_observers();
222 if (!has_call_completed_callbacks && !has_active_object_observers) return;
220 HandleScopeImplementer* handle_scope_implementer = 223 HandleScopeImplementer* handle_scope_implementer =
221 isolate->handle_scope_implementer(); 224 isolate->handle_scope_implementer();
222 if (!handle_scope_implementer->CallDepthIsZero()) return; 225 if (!handle_scope_implementer->CallDepthIsZero()) return;
223 // Fire callbacks. Increase call depth to prevent recursive callbacks. 226 // Fire callbacks. Increase call depth to prevent recursive callbacks.
224 handle_scope_implementer->IncrementCallDepth(); 227 handle_scope_implementer->IncrementCallDepth();
225 for (int i = 0; i < call_completed_callbacks_->length(); i++) { 228 if (has_active_object_observers) {
rossberg 2012/11/06 16:45:57 FLAG_harmony_observation && ...
adamk 2012/11/06 17:00:09 Done.
226 call_completed_callbacks_->at(i)(); 229 JSObject::DeliverChangeRecords(isolate);
230 }
231 if (has_call_completed_callbacks) {
232 for (int i = 0; i < call_completed_callbacks_->length(); i++) {
233 call_completed_callbacks_->at(i)();
234 }
227 } 235 }
228 handle_scope_implementer->DecrementCallDepth(); 236 handle_scope_implementer->DecrementCallDepth();
229 } 237 }
230 238
231 239
232 // Use a union type to avoid type-aliasing optimizations in GCC. 240 // Use a union type to avoid type-aliasing optimizations in GCC.
233 typedef union { 241 typedef union {
234 double double_value; 242 double double_value;
235 uint64_t uint64_t_value; 243 uint64_t uint64_t_value;
236 } double_int_union; 244 } double_int_union;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 SetUpJSCallerSavedCodeData(); 290 SetUpJSCallerSavedCodeData();
283 SamplerRegistry::SetUp(); 291 SamplerRegistry::SetUp();
284 ExternalReference::SetUp(); 292 ExternalReference::SetUp();
285 } 293 }
286 294
287 void V8::InitializeOncePerProcess() { 295 void V8::InitializeOncePerProcess() {
288 CallOnce(&init_once, &InitializeOncePerProcessImpl); 296 CallOnce(&init_once, &InitializeOncePerProcessImpl);
289 } 297 }
290 298
291 } } // namespace v8::internal 299 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698