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

Side by Side Diff: src/api.cc

Issue 1815153002: Introduce EmbedderHeapTracer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporated wonderful Hannes' comments Created 4 years, 8 months 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 i::Object** V8::CopyPersistent(i::Object** obj) { 670 i::Object** V8::CopyPersistent(i::Object** obj) {
671 i::Handle<i::Object> result = i::GlobalHandles::CopyGlobal(obj); 671 i::Handle<i::Object> result = i::GlobalHandles::CopyGlobal(obj);
672 #ifdef VERIFY_HEAP 672 #ifdef VERIFY_HEAP
673 if (i::FLAG_verify_heap) { 673 if (i::FLAG_verify_heap) {
674 (*obj)->ObjectVerify(); 674 (*obj)->ObjectVerify();
675 } 675 }
676 #endif // VERIFY_HEAP 676 #endif // VERIFY_HEAP
677 return result.location(); 677 return result.location();
678 } 678 }
679 679
680 void V8::RegisterExternallyReferencedObject(i::Object** object,
681 i::Isolate* isolate) {
682 isolate->heap()->RegisterExternallyReferencedObject(object);
683 }
680 684
681 void V8::MakeWeak(i::Object** object, void* parameter, 685 void V8::MakeWeak(i::Object** object, void* parameter,
682 WeakCallback weak_callback) { 686 WeakCallback weak_callback) {
683 i::GlobalHandles::MakeWeak(object, parameter, weak_callback); 687 i::GlobalHandles::MakeWeak(object, parameter, weak_callback);
684 } 688 }
685 689
686 690
687 void V8::MakeWeak(i::Object** object, void* parameter, 691 void V8::MakeWeak(i::Object** object, void* parameter,
688 int internal_field_index1, int internal_field_index2, 692 int internal_field_index1, int internal_field_index2,
689 WeakCallbackInfo<void>::Callback weak_callback) { 693 WeakCallbackInfo<void>::Callback weak_callback) {
(...skipping 6477 matching lines...) Expand 10 before | Expand all | Expand 10 after
7167 reinterpret_cast<v8::Isolate::GCCallback>(callback), gc_type, false); 7171 reinterpret_cast<v8::Isolate::GCCallback>(callback), gc_type, false);
7168 } 7172 }
7169 7173
7170 7174
7171 void V8::AddGCEpilogueCallback(GCCallback callback, GCType gc_type) { 7175 void V8::AddGCEpilogueCallback(GCCallback callback, GCType gc_type) {
7172 i::Isolate* isolate = i::Isolate::Current(); 7176 i::Isolate* isolate = i::Isolate::Current();
7173 isolate->heap()->AddGCEpilogueCallback( 7177 isolate->heap()->AddGCEpilogueCallback(
7174 reinterpret_cast<v8::Isolate::GCCallback>(callback), gc_type, false); 7178 reinterpret_cast<v8::Isolate::GCCallback>(callback), gc_type, false);
7175 } 7179 }
7176 7180
7181 void Isolate::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) {
7182 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7183 isolate->heap()->SetEmbedderHeapTracer(tracer);
7184 }
7177 7185
7178 void Isolate::AddMemoryAllocationCallback(MemoryAllocationCallback callback, 7186 void Isolate::AddMemoryAllocationCallback(MemoryAllocationCallback callback,
7179 ObjectSpace space, 7187 ObjectSpace space,
7180 AllocationAction action) { 7188 AllocationAction action) {
7181 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7189 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7182 isolate->memory_allocator()->AddMemoryAllocationCallback( 7190 isolate->memory_allocator()->AddMemoryAllocationCallback(
7183 callback, space, action); 7191 callback, space, action);
7184 } 7192 }
7185 7193
7186 7194
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after
8761 Address callback_address = 8769 Address callback_address =
8762 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8770 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8763 VMState<EXTERNAL> state(isolate); 8771 VMState<EXTERNAL> state(isolate);
8764 ExternalCallbackScope call_scope(isolate, callback_address); 8772 ExternalCallbackScope call_scope(isolate, callback_address);
8765 callback(info); 8773 callback(info);
8766 } 8774 }
8767 8775
8768 8776
8769 } // namespace internal 8777 } // namespace internal
8770 } // namespace v8 8778 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698