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

Side by Side Diff: src/api.cc

Issue 1298113003: [api,heap] Fix external GC callbacks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Got rid of too many V8::Type vs Isolate::Type casts Created 5 years, 4 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 6969 matching lines...) Expand 10 before | Expand all | Expand 10 after
6980 internal::Object** child) { 6980 internal::Object** child) {
6981 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); 6981 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6982 i::Object** parent_location = 6982 i::Object** parent_location =
6983 v8::internal::Handle<v8::internal::Object>(parent).location(); 6983 v8::internal::Handle<v8::internal::Object>(parent).location();
6984 internal_isolate->global_handles()->SetReference( 6984 internal_isolate->global_handles()->SetReference(
6985 reinterpret_cast<i::HeapObject**>(parent_location), 6985 reinterpret_cast<i::HeapObject**>(parent_location),
6986 v8::internal::Handle<v8::internal::Object>(child).location()); 6986 v8::internal::Handle<v8::internal::Object>(child).location());
6987 } 6987 }
6988 6988
6989 6989
6990 void Isolate::AddGCPrologueCallback(GCPrologueCallback callback, 6990 void Isolate::AddGCPrologueCallback(GCCallback callback, GCType gc_type) {
6991 GCType gc_type) {
6992 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6991 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6993 isolate->heap()->AddGCPrologueCallback(callback, gc_type); 6992 isolate->heap()->AddGCPrologueCallback(callback, gc_type);
6994 } 6993 }
6995 6994
6996 6995
6997 void Isolate::RemoveGCPrologueCallback(GCPrologueCallback callback) { 6996 void Isolate::RemoveGCPrologueCallback(GCCallback callback) {
6998 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6997 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6999 isolate->heap()->RemoveGCPrologueCallback(callback); 6998 isolate->heap()->RemoveGCPrologueCallback(callback);
7000 } 6999 }
7001 7000
7002 7001
7003 void Isolate::AddGCEpilogueCallback(GCEpilogueCallback callback, 7002 void Isolate::AddGCEpilogueCallback(GCCallback callback, GCType gc_type) {
7004 GCType gc_type) {
7005 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7003 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7006 isolate->heap()->AddGCEpilogueCallback(callback, gc_type); 7004 isolate->heap()->AddGCEpilogueCallback(callback, gc_type);
7007 } 7005 }
7008 7006
7009 7007
7010 void Isolate::RemoveGCEpilogueCallback(GCEpilogueCallback callback) { 7008 void Isolate::RemoveGCEpilogueCallback(GCCallback callback) {
7011 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7009 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7012 isolate->heap()->RemoveGCEpilogueCallback(callback); 7010 isolate->heap()->RemoveGCEpilogueCallback(callback);
7013 } 7011 }
7014 7012
7015 7013
7016 void V8::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) { 7014 void V8::AddGCPrologueCallback(GCCallback callback, GCType gc_type) {
7017 i::Isolate* isolate = i::Isolate::Current(); 7015 i::Isolate* isolate = i::Isolate::Current();
7018 isolate->heap()->AddGCPrologueCallback( 7016 isolate->heap()->AddGCPrologueCallback(
7019 reinterpret_cast<v8::Isolate::GCPrologueCallback>(callback), 7017 reinterpret_cast<v8::Isolate::GCCallback>(callback), gc_type, false);
7020 gc_type,
7021 false);
7022 } 7018 }
7023 7019
7024 7020
7025 void V8::AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type) { 7021 void V8::AddGCEpilogueCallback(GCCallback callback, GCType gc_type) {
7026 i::Isolate* isolate = i::Isolate::Current(); 7022 i::Isolate* isolate = i::Isolate::Current();
7027 isolate->heap()->AddGCEpilogueCallback( 7023 isolate->heap()->AddGCEpilogueCallback(
7028 reinterpret_cast<v8::Isolate::GCEpilogueCallback>(callback), 7024 reinterpret_cast<v8::Isolate::GCCallback>(callback), gc_type, false);
7029 gc_type,
7030 false);
7031 } 7025 }
7032 7026
7033 7027
7034 void Isolate::AddMemoryAllocationCallback(MemoryAllocationCallback callback, 7028 void Isolate::AddMemoryAllocationCallback(MemoryAllocationCallback callback,
7035 ObjectSpace space, 7029 ObjectSpace space,
7036 AllocationAction action) { 7030 AllocationAction action) {
7037 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7031 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7038 isolate->memory_allocator()->AddMemoryAllocationCallback( 7032 isolate->memory_allocator()->AddMemoryAllocationCallback(
7039 callback, space, action); 7033 callback, space, action);
7040 } 7034 }
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
8414 Address callback_address = 8408 Address callback_address =
8415 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8409 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8416 VMState<EXTERNAL> state(isolate); 8410 VMState<EXTERNAL> state(isolate);
8417 ExternalCallbackScope call_scope(isolate, callback_address); 8411 ExternalCallbackScope call_scope(isolate, callback_address);
8418 callback(info); 8412 callback(info);
8419 } 8413 }
8420 8414
8421 8415
8422 } // namespace internal 8416 } // namespace internal
8423 } // namespace v8 8417 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/global-handles.cc » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698