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

Side by Side Diff: src/api.cc

Issue 24065005: new gc callbacks with isolate parameters (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6667 matching lines...) Expand 10 before | Expand all | Expand 10 after
6678 void Isolate::SetReference(const Persistent<Object>& parent, 6678 void Isolate::SetReference(const Persistent<Object>& parent,
6679 const Persistent<Value>& child) { 6679 const Persistent<Value>& child) {
6680 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); 6680 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6681 i::Object** parent_location = Utils::OpenPersistent(parent).location(); 6681 i::Object** parent_location = Utils::OpenPersistent(parent).location();
6682 internal_isolate->global_handles()->SetReference( 6682 internal_isolate->global_handles()->SetReference(
6683 reinterpret_cast<i::HeapObject**>(parent_location), 6683 reinterpret_cast<i::HeapObject**>(parent_location),
6684 Utils::OpenPersistent(child).location()); 6684 Utils::OpenPersistent(child).location());
6685 } 6685 }
6686 6686
6687 6687
6688 void V8::SetGlobalGCPrologueCallback(GCCallback callback) { 6688 void Isolate::AddGCPrologueCallback(GCPrologueCallback callback,
6689 i::Isolate* isolate = i::Isolate::Current(); 6689 GCType gc_type) {
6690 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return; 6690 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6691 isolate->heap()->SetGlobalGCPrologueCallback(callback); 6691 isolate->heap()->AddGCPrologueCallback(callback, gc_type);
6692 } 6692 }
6693 6693
6694 6694
6695 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) { 6695 void Isolate::RemoveGCPrologueCallback(GCPrologueCallback callback) {
6696 i::Isolate* isolate = i::Isolate::Current(); 6696 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6697 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCEpilogueCallback()")) return; 6697 isolate->heap()->RemoveGCPrologueCallback(callback);
6698 isolate->heap()->SetGlobalGCEpilogueCallback(callback); 6698 }
6699
6700
6701 void Isolate::AddGCEpilogueCallback(GCEpilogueCallback callback,
6702 GCType gc_type) {
6703 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6704 isolate->heap()->AddGCEpilogueCallback(callback, gc_type);
6705 }
6706
6707
6708 void Isolate::RemoveGCEpilogueCallback(GCEpilogueCallback callback) {
6709 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6710 isolate->heap()->RemoveGCEpilogueCallback(callback);
6699 } 6711 }
6700 6712
6701 6713
6702 void V8::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) { 6714 void V8::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) {
6703 i::Isolate* isolate = i::Isolate::Current(); 6715 i::Isolate* isolate = i::Isolate::Current();
6704 if (IsDeadCheck(isolate, "v8::V8::AddGCPrologueCallback()")) return; 6716 if (IsDeadCheck(isolate, "v8::V8::AddGCPrologueCallback()")) return;
6705 isolate->heap()->AddGCPrologueCallback(callback, gc_type); 6717 isolate->heap()->AddGCPrologueCallback(
6718 reinterpret_cast<v8::Isolate::GCPrologueCallback>(callback),
6719 gc_type,
6720 false);
6706 } 6721 }
6707 6722
6708 6723
6709 void V8::RemoveGCPrologueCallback(GCPrologueCallback callback) { 6724 void V8::RemoveGCPrologueCallback(GCPrologueCallback callback) {
6710 i::Isolate* isolate = i::Isolate::Current(); 6725 i::Isolate* isolate = i::Isolate::Current();
6711 if (IsDeadCheck(isolate, "v8::V8::RemoveGCPrologueCallback()")) return; 6726 if (IsDeadCheck(isolate, "v8::V8::RemoveGCPrologueCallback()")) return;
6712 isolate->heap()->RemoveGCPrologueCallback(callback); 6727 isolate->heap()->RemoveGCPrologueCallback(
6728 reinterpret_cast<v8::Isolate::GCPrologueCallback>(callback));
6713 } 6729 }
6714 6730
6715 6731
6716 void V8::AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type) { 6732 void V8::AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type) {
6717 i::Isolate* isolate = i::Isolate::Current(); 6733 i::Isolate* isolate = i::Isolate::Current();
6718 if (IsDeadCheck(isolate, "v8::V8::AddGCEpilogueCallback()")) return; 6734 if (IsDeadCheck(isolate, "v8::V8::AddGCEpilogueCallback()")) return;
6719 isolate->heap()->AddGCEpilogueCallback(callback, gc_type); 6735 isolate->heap()->AddGCEpilogueCallback(
6736 reinterpret_cast<v8::Isolate::GCEpilogueCallback>(callback),
6737 gc_type,
6738 false);
6720 } 6739 }
6721 6740
6722 6741
6723 void V8::RemoveGCEpilogueCallback(GCEpilogueCallback callback) { 6742 void V8::RemoveGCEpilogueCallback(GCEpilogueCallback callback) {
6724 i::Isolate* isolate = i::Isolate::Current(); 6743 i::Isolate* isolate = i::Isolate::Current();
6725 if (IsDeadCheck(isolate, "v8::V8::RemoveGCEpilogueCallback()")) return; 6744 if (IsDeadCheck(isolate, "v8::V8::RemoveGCEpilogueCallback()")) return;
6726 isolate->heap()->RemoveGCEpilogueCallback(callback); 6745 isolate->heap()->RemoveGCEpilogueCallback(
6746 reinterpret_cast<v8::Isolate::GCEpilogueCallback>(callback));
6727 } 6747 }
6728 6748
6729 6749
6730 void V8::AddMemoryAllocationCallback(MemoryAllocationCallback callback, 6750 void V8::AddMemoryAllocationCallback(MemoryAllocationCallback callback,
6731 ObjectSpace space, 6751 ObjectSpace space,
6732 AllocationAction action) { 6752 AllocationAction action) {
6733 i::Isolate* isolate = i::Isolate::Current(); 6753 i::Isolate* isolate = i::Isolate::Current();
6734 if (IsDeadCheck(isolate, "v8::V8::AddMemoryAllocationCallback()")) return; 6754 if (IsDeadCheck(isolate, "v8::V8::AddMemoryAllocationCallback()")) return;
6735 isolate->memory_allocator()->AddMemoryAllocationCallback( 6755 isolate->memory_allocator()->AddMemoryAllocationCallback(
6736 callback, space, action); 6756 callback, space, action);
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
7864 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7884 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7865 Address callback_address = 7885 Address callback_address =
7866 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7886 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7867 VMState<EXTERNAL> state(isolate); 7887 VMState<EXTERNAL> state(isolate);
7868 ExternalCallbackScope call_scope(isolate, callback_address); 7888 ExternalCallbackScope call_scope(isolate, callback_address);
7869 callback(info); 7889 callback(info);
7870 } 7890 }
7871 7891
7872 7892
7873 } } // namespace v8::internal 7893 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698