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

Side by Side Diff: src/heap.h

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 | « src/api.cc ('k') | src/heap.cc » ('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 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 } 1265 }
1266 } 1266 }
1267 1267
1268 PromotionQueue* promotion_queue() { return &promotion_queue_; } 1268 PromotionQueue* promotion_queue() { return &promotion_queue_; }
1269 1269
1270 #ifdef DEBUG 1270 #ifdef DEBUG
1271 // Utility used with flag gc-greedy. 1271 // Utility used with flag gc-greedy.
1272 void GarbageCollectionGreedyCheck(); 1272 void GarbageCollectionGreedyCheck();
1273 #endif 1273 #endif
1274 1274
1275 void AddGCPrologueCallback( 1275 void AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback,
1276 GCPrologueCallback callback, GCType gc_type_filter); 1276 GCType gc_type_filter,
1277 void RemoveGCPrologueCallback(GCPrologueCallback callback); 1277 bool pass_isolate = true);
1278 void RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback);
1278 1279
1279 void AddGCEpilogueCallback( 1280 void AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback,
1280 GCEpilogueCallback callback, GCType gc_type_filter); 1281 GCType gc_type_filter,
1281 void RemoveGCEpilogueCallback(GCEpilogueCallback callback); 1282 bool pass_isolate = true);
1282 1283 void RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback);
1283 void SetGlobalGCPrologueCallback(GCCallback callback) {
1284 ASSERT((callback == NULL) ^ (global_gc_prologue_callback_ == NULL));
1285 global_gc_prologue_callback_ = callback;
1286 }
1287 void SetGlobalGCEpilogueCallback(GCCallback callback) {
1288 ASSERT((callback == NULL) ^ (global_gc_epilogue_callback_ == NULL));
1289 global_gc_epilogue_callback_ = callback;
1290 }
1291 1284
1292 // Heap root getters. We have versions with and without type::cast() here. 1285 // Heap root getters. We have versions with and without type::cast() here.
1293 // You can't use type::cast during GC because the assert fails. 1286 // You can't use type::cast during GC because the assert fails.
1294 // TODO(1490): Try removing the unchecked accessors, now that GC marking does 1287 // TODO(1490): Try removing the unchecked accessors, now that GC marking does
1295 // not corrupt the map. 1288 // not corrupt the map.
1296 #define ROOT_ACCESSOR(type, name, camel_name) \ 1289 #define ROOT_ACCESSOR(type, name, camel_name) \
1297 type* name() { \ 1290 type* name() { \
1298 return type::cast(roots_[k##camel_name##RootIndex]); \ 1291 return type::cast(roots_[k##camel_name##RootIndex]); \
1299 } \ 1292 } \
1300 type* raw_unchecked_##name() { \ 1293 type* raw_unchecked_##name() { \
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 static const ConstantStringTable constant_string_table[]; 2018 static const ConstantStringTable constant_string_table[];
2026 static const StructTable struct_table[]; 2019 static const StructTable struct_table[];
2027 2020
2028 // The special hidden string which is an empty string, but does not match 2021 // The special hidden string which is an empty string, but does not match
2029 // any string when looked up in properties. 2022 // any string when looked up in properties.
2030 String* hidden_string_; 2023 String* hidden_string_;
2031 2024
2032 // GC callback function, called before and after mark-compact GC. 2025 // GC callback function, called before and after mark-compact GC.
2033 // Allocations in the callback function are disallowed. 2026 // Allocations in the callback function are disallowed.
2034 struct GCPrologueCallbackPair { 2027 struct GCPrologueCallbackPair {
2035 GCPrologueCallbackPair(GCPrologueCallback callback, GCType gc_type) 2028 GCPrologueCallbackPair(v8::Isolate::GCPrologueCallback callback,
2036 : callback(callback), gc_type(gc_type) { 2029 GCType gc_type,
2030 bool pass_isolate)
2031 : callback(callback), gc_type(gc_type), pass_isolate_(pass_isolate) {
2037 } 2032 }
2038 bool operator==(const GCPrologueCallbackPair& pair) const { 2033 bool operator==(const GCPrologueCallbackPair& pair) const {
2039 return pair.callback == callback; 2034 return pair.callback == callback;
2040 } 2035 }
2041 GCPrologueCallback callback; 2036 v8::Isolate::GCPrologueCallback callback;
2042 GCType gc_type; 2037 GCType gc_type;
2038 // TODO(dcarney): remove variable
2039 bool pass_isolate_;
2043 }; 2040 };
2044 List<GCPrologueCallbackPair> gc_prologue_callbacks_; 2041 List<GCPrologueCallbackPair> gc_prologue_callbacks_;
2045 2042
2046 struct GCEpilogueCallbackPair { 2043 struct GCEpilogueCallbackPair {
2047 GCEpilogueCallbackPair(GCEpilogueCallback callback, GCType gc_type) 2044 GCEpilogueCallbackPair(v8::Isolate::GCPrologueCallback callback,
2048 : callback(callback), gc_type(gc_type) { 2045 GCType gc_type,
2046 bool pass_isolate)
2047 : callback(callback), gc_type(gc_type), pass_isolate_(pass_isolate) {
2049 } 2048 }
2050 bool operator==(const GCEpilogueCallbackPair& pair) const { 2049 bool operator==(const GCEpilogueCallbackPair& pair) const {
2051 return pair.callback == callback; 2050 return pair.callback == callback;
2052 } 2051 }
2053 GCEpilogueCallback callback; 2052 v8::Isolate::GCPrologueCallback callback;
2054 GCType gc_type; 2053 GCType gc_type;
2054 // TODO(dcarney): remove variable
2055 bool pass_isolate_;
2055 }; 2056 };
2056 List<GCEpilogueCallbackPair> gc_epilogue_callbacks_; 2057 List<GCEpilogueCallbackPair> gc_epilogue_callbacks_;
2057 2058
2058 GCCallback global_gc_prologue_callback_;
2059 GCCallback global_gc_epilogue_callback_;
2060
2061 // Support for computing object sizes during GC. 2059 // Support for computing object sizes during GC.
2062 HeapObjectCallback gc_safe_size_of_old_object_; 2060 HeapObjectCallback gc_safe_size_of_old_object_;
2063 static int GcSafeSizeOfOldObject(HeapObject* object); 2061 static int GcSafeSizeOfOldObject(HeapObject* object);
2064 2062
2065 // Update the GC state. Called from the mark-compact collector. 2063 // Update the GC state. Called from the mark-compact collector.
2066 void MarkMapPointersAsEncoded(bool encoded) { 2064 void MarkMapPointersAsEncoded(bool encoded) {
2067 ASSERT(!encoded); 2065 ASSERT(!encoded);
2068 gc_safe_size_of_old_object_ = &GcSafeSizeOfOldObject; 2066 gc_safe_size_of_old_object_ = &GcSafeSizeOfOldObject;
2069 } 2067 }
2070 2068
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3038 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3041 3039
3042 private: 3040 private:
3043 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3041 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3044 }; 3042 };
3045 #endif // DEBUG 3043 #endif // DEBUG
3046 3044
3047 } } // namespace v8::internal 3045 } } // namespace v8::internal
3048 3046
3049 #endif // V8_HEAP_H_ 3047 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698