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

Side by Side Diff: src/api.cc

Issue 753553002: Phantom references support internal fields (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Queue up phantom callbacks during GC to dispatch later Created 6 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 356
357 i::Object** V8::CopyPersistent(i::Object** obj) { 357 i::Object** V8::CopyPersistent(i::Object** obj) {
358 i::Handle<i::Object> result = i::GlobalHandles::CopyGlobal(obj); 358 i::Handle<i::Object> result = i::GlobalHandles::CopyGlobal(obj);
359 #ifdef DEBUG 359 #ifdef DEBUG
360 (*obj)->ObjectVerify(); 360 (*obj)->ObjectVerify();
361 #endif // DEBUG 361 #endif // DEBUG
362 return result.location(); 362 return result.location();
363 } 363 }
364 364
365 365
366 void V8::MakeWeak(i::Object** object, void* parameters, 366 void V8::MakeWeak(i::Object** object, void* parameter,
367 WeakCallback weak_callback, V8::WeakHandleType weak_type) { 367 WeakCallback weak_callback) {
368 i::GlobalHandles::PhantomState phantom; 368 i::GlobalHandles::MakeWeak(object, parameter, weak_callback);
369 phantom = weak_type == V8::PhantomHandle ? i::GlobalHandles::Phantom
370 : i::GlobalHandles::Nonphantom;
371 i::GlobalHandles::MakeWeak(object, parameters, weak_callback, phantom);
372 } 369 }
373 370
374 371
372 void V8::MakePhantom(i::Object** object, void* parameter,
373 PhantomCallback weak_callback, int internal_field_index1,
374 int internal_field_index2) {
375 i::GlobalHandles::MakePhantom(object, parameter, weak_callback,
376 internal_field_index1, internal_field_index2);
377 }
378
379
375 void* V8::ClearWeak(i::Object** obj) { 380 void* V8::ClearWeak(i::Object** obj) {
376 return i::GlobalHandles::ClearWeakness(obj); 381 return i::GlobalHandles::ClearWeakness(obj);
377 } 382 }
378 383
379 384
380 void V8::DisposeGlobal(i::Object** obj) { 385 void V8::DisposeGlobal(i::Object** obj) {
381 i::GlobalHandles::Destroy(obj); 386 i::GlobalHandles::Destroy(obj);
382 } 387 }
383 388
384 389
(...skipping 7273 matching lines...) Expand 10 before | Expand all | Expand 10 after
7658 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7663 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7659 Address callback_address = 7664 Address callback_address =
7660 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7665 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7661 VMState<EXTERNAL> state(isolate); 7666 VMState<EXTERNAL> state(isolate);
7662 ExternalCallbackScope call_scope(isolate, callback_address); 7667 ExternalCallbackScope call_scope(isolate, callback_address);
7663 callback(info); 7668 callback(info);
7664 } 7669 }
7665 7670
7666 7671
7667 } } // namespace v8::internal 7672 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698