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

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: 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 6972 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(GCPrologueCallback callback,
6991 GCType gc_type) { 6991 GCType gc_type) {
6992 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6992 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6993 isolate->heap()->AddGCPrologueCallback(callback, gc_type); 6993 GCCallback new_callback = reinterpret_cast<GCCallback>(callback);
6994 isolate->heap()->AddGCPrologueCallback(new_callback, gc_type);
6994 } 6995 }
6995 6996
6996 6997
6997 void Isolate::RemoveGCPrologueCallback(GCPrologueCallback callback) { 6998 void Isolate::RemoveGCPrologueCallback(GCPrologueCallback callback) {
6998 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6999 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6999 isolate->heap()->RemoveGCPrologueCallback(callback); 7000 isolate->heap()->RemoveGCPrologueCallback(callback);
7000 } 7001 }
7001 7002
7002 7003
7003 void Isolate::AddGCEpilogueCallback(GCEpilogueCallback callback, 7004 void Isolate::AddGCEpilogueCallback(GCEpilogueCallback callback,
7004 GCType gc_type) { 7005 GCType gc_type) {
7005 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7006 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7006 isolate->heap()->AddGCEpilogueCallback(callback, gc_type); 7007 GCCallback new_callback = reinterpret_cast<GCCallback>(callback);
7008 isolate->heap()->AddGCEpilogueCallback(new_callback, gc_type);
7007 } 7009 }
7008 7010
7009 7011
7010 void Isolate::RemoveGCEpilogueCallback(GCEpilogueCallback callback) { 7012 void Isolate::RemoveGCEpilogueCallback(GCEpilogueCallback callback) {
7011 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7013 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7012 isolate->heap()->RemoveGCEpilogueCallback(callback); 7014 isolate->heap()->RemoveGCEpilogueCallback(callback);
7013 } 7015 }
7014 7016
7015 7017
7016 void V8::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) { 7018 void V8::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) {
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
8414 Address callback_address = 8416 Address callback_address =
8415 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8417 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8416 VMState<EXTERNAL> state(isolate); 8418 VMState<EXTERNAL> state(isolate);
8417 ExternalCallbackScope call_scope(isolate, callback_address); 8419 ExternalCallbackScope call_scope(isolate, callback_address);
8418 callback(info); 8420 callback(info);
8419 } 8421 }
8420 8422
8421 8423
8422 } // namespace internal 8424 } // namespace internal
8423 } // namespace v8 8425 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698