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

Side by Side Diff: src/mark-compact.cc

Issue 6756021: Pass in isolate when reporting deletion of objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 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/mark-compact.h ('k') | src/spaces.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 1683
1684 MapWord encoding = 1684 MapWord encoding =
1685 MapWord::EncodeAddress(old_object->map()->address(), *offset); 1685 MapWord::EncodeAddress(old_object->map()->address(), *offset);
1686 old_object->set_map_word(encoding); 1686 old_object->set_map_word(encoding);
1687 *offset += object_size; 1687 *offset += object_size;
1688 ASSERT(*offset <= Page::kObjectAreaSize); 1688 ASSERT(*offset <= Page::kObjectAreaSize);
1689 } 1689 }
1690 1690
1691 1691
1692 // Most non-live objects are ignored. 1692 // Most non-live objects are ignored.
1693 inline void IgnoreNonLiveObject(HeapObject* object) {} 1693 inline void IgnoreNonLiveObject(HeapObject* object, Isolate* isolate) {}
1694 1694
1695 1695
1696 // Function template that, given a range of addresses (eg, a semispace or a 1696 // Function template that, given a range of addresses (eg, a semispace or a
1697 // paged space page), iterates through the objects in the range to clear 1697 // paged space page), iterates through the objects in the range to clear
1698 // mark bits and compute and encode forwarding addresses. As a side effect, 1698 // mark bits and compute and encode forwarding addresses. As a side effect,
1699 // maximal free chunks are marked so that they can be skipped on subsequent 1699 // maximal free chunks are marked so that they can be skipped on subsequent
1700 // sweeps. 1700 // sweeps.
1701 // 1701 //
1702 // The template parameters are an allocation function, a forwarding address 1702 // The template parameters are an allocation function, a forwarding address
1703 // encoding function, and a function to process non-live objects. 1703 // encoding function, and a function to process non-live objects.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 PrintF("forward %p -> %p.\n", object->address(), 1737 PrintF("forward %p -> %p.\n", object->address(),
1738 HeapObject::cast(forwarded)->address()); 1738 HeapObject::cast(forwarded)->address());
1739 } 1739 }
1740 #endif 1740 #endif
1741 if (!is_prev_alive) { // Transition from non-live to live. 1741 if (!is_prev_alive) { // Transition from non-live to live.
1742 EncodeFreeRegion(free_start, static_cast<int>(current - free_start)); 1742 EncodeFreeRegion(free_start, static_cast<int>(current - free_start));
1743 is_prev_alive = true; 1743 is_prev_alive = true;
1744 } 1744 }
1745 } else { // Non-live object. 1745 } else { // Non-live object.
1746 object_size = object->Size(); 1746 object_size = object->Size();
1747 ProcessNonLive(object); 1747 ProcessNonLive(object, collector->heap()->isolate());
1748 if (is_prev_alive) { // Transition from live to non-live. 1748 if (is_prev_alive) { // Transition from live to non-live.
1749 free_start = current; 1749 free_start = current;
1750 is_prev_alive = false; 1750 is_prev_alive = false;
1751 } 1751 }
1752 LiveObjectList::ProcessNonLive(object); 1752 LiveObjectList::ProcessNonLive(object);
1753 } 1753 }
1754 } 1754 }
1755 1755
1756 // If we ended on a free region, mark it. 1756 // If we ended on a free region, mark it.
1757 if (!is_prev_alive) { 1757 if (!is_prev_alive) {
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 object->ClearMark(); 2082 object->ClearMark();
2083 heap->mark_compact_collector()->tracer()->decrement_marked_count(); 2083 heap->mark_compact_collector()->tracer()->decrement_marked_count();
2084 2084
2085 if (!is_previous_alive) { // Transition from free to live. 2085 if (!is_previous_alive) { // Transition from free to live.
2086 space->DeallocateBlock(free_start, 2086 space->DeallocateBlock(free_start,
2087 static_cast<int>(current - free_start), 2087 static_cast<int>(current - free_start),
2088 true); 2088 true);
2089 is_previous_alive = true; 2089 is_previous_alive = true;
2090 } 2090 }
2091 } else { 2091 } else {
2092 heap->mark_compact_collector()->ReportDeleteIfNeeded(object); 2092 heap->mark_compact_collector()->ReportDeleteIfNeeded(
2093 object, heap->isolate());
2093 if (is_previous_alive) { // Transition from live to free. 2094 if (is_previous_alive) { // Transition from live to free.
2094 free_start = current; 2095 free_start = current;
2095 is_previous_alive = false; 2096 is_previous_alive = false;
2096 } 2097 }
2097 LiveObjectList::ProcessNonLive(object); 2098 LiveObjectList::ProcessNonLive(object);
2098 } 2099 }
2099 // The object is now unmarked for the call to Size() at the top of the 2100 // The object is now unmarked for the call to Size() at the top of the
2100 // loop. 2101 // loop.
2101 } 2102 }
2102 2103
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 if (code_flusher_ != NULL) return; 3040 if (code_flusher_ != NULL) return;
3040 code_flusher_ = new CodeFlusher(heap_->isolate()); 3041 code_flusher_ = new CodeFlusher(heap_->isolate());
3041 } else { 3042 } else {
3042 if (code_flusher_ == NULL) return; 3043 if (code_flusher_ == NULL) return;
3043 delete code_flusher_; 3044 delete code_flusher_;
3044 code_flusher_ = NULL; 3045 code_flusher_ = NULL;
3045 } 3046 }
3046 } 3047 }
3047 3048
3048 3049
3049 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) { 3050 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj,
3051 Isolate* isolate) {
3050 #ifdef ENABLE_GDB_JIT_INTERFACE 3052 #ifdef ENABLE_GDB_JIT_INTERFACE
3051 if (obj->IsCode()) { 3053 if (obj->IsCode()) {
3052 GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj)); 3054 GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj));
3053 } 3055 }
3054 #endif 3056 #endif
3055 #ifdef ENABLE_LOGGING_AND_PROFILING 3057 #ifdef ENABLE_LOGGING_AND_PROFILING
3056 if (obj->IsCode()) { 3058 if (obj->IsCode()) {
3057 PROFILE(ISOLATE, CodeDeleteEvent(obj->address())); 3059 PROFILE(isolate, CodeDeleteEvent(obj->address()));
3058 } 3060 }
3059 #endif 3061 #endif
3060 } 3062 }
3061 3063
3062 3064
3063 int MarkCompactCollector::SizeOfMarkedObject(HeapObject* obj) { 3065 int MarkCompactCollector::SizeOfMarkedObject(HeapObject* obj) {
3064 MapWord map_word = obj->map_word(); 3066 MapWord map_word = obj->map_word();
3065 map_word.ClearMark(); 3067 map_word.ClearMark();
3066 return obj->SizeFromMap(map_word.ToMap()); 3068 return obj->SizeFromMap(map_word.ToMap());
3067 } 3069 }
3068 3070
3069 3071
3070 void MarkCompactCollector::Initialize() { 3072 void MarkCompactCollector::Initialize() {
3071 StaticPointersToNewGenUpdatingVisitor::Initialize(); 3073 StaticPointersToNewGenUpdatingVisitor::Initialize();
3072 StaticMarkingVisitor::Initialize(); 3074 StaticMarkingVisitor::Initialize();
3073 } 3075 }
3074 3076
3075 3077
3076 } } // namespace v8::internal 3078 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698