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

Side by Side Diff: src/incremental-marking.cc

Issue 185233008: Consolidate RecordWriteFromCode and RecordWriteForEvacuationFromCode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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/incremental-marking.h ('k') | src/mips/code-stubs-mips.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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 } 77 }
78 } 78 }
79 79
80 80
81 void IncrementalMarking::RecordWriteFromCode(HeapObject* obj, 81 void IncrementalMarking::RecordWriteFromCode(HeapObject* obj,
82 Object** slot, 82 Object** slot,
83 Isolate* isolate) { 83 Isolate* isolate) {
84 ASSERT(obj->IsHeapObject()); 84 ASSERT(obj->IsHeapObject());
85 IncrementalMarking* marking = isolate->heap()->incremental_marking(); 85 IncrementalMarking* marking = isolate->heap()->incremental_marking();
86 ASSERT(!marking->is_compacting_);
87 86
88 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); 87 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
89 int counter = chunk->write_barrier_counter(); 88 int counter = chunk->write_barrier_counter();
90 if (counter < (MemoryChunk::kWriteBarrierCounterGranularity / 2)) {
91 marking->write_barriers_invoked_since_last_step_ +=
92 MemoryChunk::kWriteBarrierCounterGranularity -
93 chunk->write_barrier_counter();
94 chunk->set_write_barrier_counter(
95 MemoryChunk::kWriteBarrierCounterGranularity);
96 }
97
98 marking->RecordWrite(obj, slot, *slot);
99 }
100
101
102 void IncrementalMarking::RecordWriteForEvacuationFromCode(HeapObject* obj,
103 Object** slot,
104 Isolate* isolate) {
105 ASSERT(obj->IsHeapObject());
106 IncrementalMarking* marking = isolate->heap()->incremental_marking();
107 ASSERT(marking->is_compacting_);
108
109 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
110 int counter = chunk->write_barrier_counter();
111 if (counter < (MemoryChunk::kWriteBarrierCounterGranularity / 2)) { 89 if (counter < (MemoryChunk::kWriteBarrierCounterGranularity / 2)) {
112 marking->write_barriers_invoked_since_last_step_ += 90 marking->write_barriers_invoked_since_last_step_ +=
113 MemoryChunk::kWriteBarrierCounterGranularity - 91 MemoryChunk::kWriteBarrierCounterGranularity -
114 chunk->write_barrier_counter(); 92 chunk->write_barrier_counter();
115 chunk->set_write_barrier_counter( 93 chunk->set_write_barrier_counter(
116 MemoryChunk::kWriteBarrierCounterGranularity); 94 MemoryChunk::kWriteBarrierCounterGranularity);
117 } 95 }
118 96
119 marking->RecordWrite(obj, slot, *slot); 97 marking->RecordWrite(obj, slot, *slot);
120 } 98 }
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 bytes_scanned_ = 0; 1011 bytes_scanned_ = 0;
1034 write_barriers_invoked_since_last_step_ = 0; 1012 write_barriers_invoked_since_last_step_ = 0;
1035 } 1013 }
1036 1014
1037 1015
1038 int64_t IncrementalMarking::SpaceLeftInOldSpace() { 1016 int64_t IncrementalMarking::SpaceLeftInOldSpace() {
1039 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); 1017 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects();
1040 } 1018 }
1041 1019
1042 } } // namespace v8::internal 1020 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/incremental-marking.h ('k') | src/mips/code-stubs-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698