OLD | NEW |
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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 | 881 |
882 #ifdef VERIFY_HEAP | 882 #ifdef VERIFY_HEAP |
883 if (FLAG_verify_heap) { | 883 if (FLAG_verify_heap) { |
884 VerifySymbolTable(); | 884 VerifySymbolTable(); |
885 } | 885 } |
886 #endif | 886 #endif |
887 | 887 |
888 if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) { | 888 if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) { |
889 ASSERT(!allocation_allowed_); | 889 ASSERT(!allocation_allowed_); |
890 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); | 890 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
| 891 VMState state(isolate_, EXTERNAL); |
891 global_gc_prologue_callback_(); | 892 global_gc_prologue_callback_(); |
892 } | 893 } |
893 | 894 |
894 GCType gc_type = | 895 GCType gc_type = |
895 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; | 896 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; |
896 | 897 |
897 { | 898 { |
898 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); | 899 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
| 900 VMState state(isolate_, EXTERNAL); |
899 for (int i = 0; i < gc_prologue_callbacks_.length(); ++i) { | 901 for (int i = 0; i < gc_prologue_callbacks_.length(); ++i) { |
900 if (gc_type & gc_prologue_callbacks_[i].gc_type) { | 902 if (gc_type & gc_prologue_callbacks_[i].gc_type) { |
901 gc_prologue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags); | 903 gc_prologue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags); |
902 } | 904 } |
903 } | 905 } |
904 } | 906 } |
905 | 907 |
906 EnsureFromSpaceIsCommitted(); | 908 EnsureFromSpaceIsCommitted(); |
907 | 909 |
908 int start_new_space_size = Heap::new_space()->SizeAsInt(); | 910 int start_new_space_size = Heap::new_space()->SizeAsInt(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 Relocatable::PostGarbageCollectionProcessing(); | 1004 Relocatable::PostGarbageCollectionProcessing(); |
1003 | 1005 |
1004 if (collector == MARK_COMPACTOR) { | 1006 if (collector == MARK_COMPACTOR) { |
1005 // Register the amount of external allocated memory. | 1007 // Register the amount of external allocated memory. |
1006 amount_of_external_allocated_memory_at_last_global_gc_ = | 1008 amount_of_external_allocated_memory_at_last_global_gc_ = |
1007 amount_of_external_allocated_memory_; | 1009 amount_of_external_allocated_memory_; |
1008 } | 1010 } |
1009 | 1011 |
1010 { | 1012 { |
1011 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); | 1013 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
| 1014 VMState state(isolate_, EXTERNAL); |
1012 GCCallbackFlags callback_flags = kNoGCCallbackFlags; | 1015 GCCallbackFlags callback_flags = kNoGCCallbackFlags; |
1013 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { | 1016 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { |
1014 if (gc_type & gc_epilogue_callbacks_[i].gc_type) { | 1017 if (gc_type & gc_epilogue_callbacks_[i].gc_type) { |
1015 gc_epilogue_callbacks_[i].callback(gc_type, callback_flags); | 1018 gc_epilogue_callbacks_[i].callback(gc_type, callback_flags); |
1016 } | 1019 } |
1017 } | 1020 } |
1018 } | 1021 } |
1019 | 1022 |
1020 if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) { | 1023 if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) { |
1021 ASSERT(!allocation_allowed_); | 1024 ASSERT(!allocation_allowed_); |
1022 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); | 1025 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
| 1026 VMState state(isolate_, EXTERNAL); |
1023 global_gc_epilogue_callback_(); | 1027 global_gc_epilogue_callback_(); |
1024 } | 1028 } |
1025 | 1029 |
1026 #ifdef VERIFY_HEAP | 1030 #ifdef VERIFY_HEAP |
1027 if (FLAG_verify_heap) { | 1031 if (FLAG_verify_heap) { |
1028 VerifySymbolTable(); | 1032 VerifySymbolTable(); |
1029 } | 1033 } |
1030 #endif | 1034 #endif |
1031 | 1035 |
1032 return next_gc_likely_to_collect_more; | 1036 return next_gc_likely_to_collect_more; |
(...skipping 6477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7510 static_cast<int>(object_sizes_last_time_[index])); | 7514 static_cast<int>(object_sizes_last_time_[index])); |
7511 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7515 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7512 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7516 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7513 | 7517 |
7514 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7518 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7515 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7519 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7516 ClearObjectStats(); | 7520 ClearObjectStats(); |
7517 } | 7521 } |
7518 | 7522 |
7519 } } // namespace v8::internal | 7523 } } // namespace v8::internal |
OLD | NEW |