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

Side by Side Diff: src/objects.cc

Issue 284773004: Skip write barriers when updating the weak hash table. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 6 years, 7 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.cc ('k') | test/cctest/test-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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "allocation-site-scopes.h" 8 #include "allocation-site-scopes.h"
9 #include "api.h" 9 #include "api.h"
10 #include "arguments.h" 10 #include "arguments.h"
(...skipping 16150 matching lines...) Expand 10 before | Expand all | Expand 10 after
16161 } 16161 }
16162 16162
16163 16163
16164 Handle<WeakHashTable> WeakHashTable::Put(Handle<WeakHashTable> table, 16164 Handle<WeakHashTable> WeakHashTable::Put(Handle<WeakHashTable> table,
16165 Handle<Object> key, 16165 Handle<Object> key,
16166 Handle<Object> value) { 16166 Handle<Object> value) {
16167 ASSERT(table->IsKey(*key)); 16167 ASSERT(table->IsKey(*key));
16168 int entry = table->FindEntry(key); 16168 int entry = table->FindEntry(key);
16169 // Key is already in table, just overwrite value. 16169 // Key is already in table, just overwrite value.
16170 if (entry != kNotFound) { 16170 if (entry != kNotFound) {
16171 table->set(EntryToValueIndex(entry), *value); 16171 // TODO(ulan): Skipping write barrier is a temporary solution to avoid
16172 // memory leaks. Remove this once we have special visitor for weak fixed
16173 // arrays.
16174 table->set(EntryToValueIndex(entry), *value, SKIP_WRITE_BARRIER);
16172 return table; 16175 return table;
16173 } 16176 }
16174 16177
16175 // Check whether the hash table should be extended. 16178 // Check whether the hash table should be extended.
16176 table = EnsureCapacity(table, 1, key, TENURED); 16179 table = EnsureCapacity(table, 1, key, TENURED);
16177 16180
16178 table->AddEntry(table->FindInsertionEntry(table->Hash(key)), key, value); 16181 table->AddEntry(table->FindInsertionEntry(table->Hash(key)), key, value);
16179 return table; 16182 return table;
16180 } 16183 }
16181 16184
16182 16185
16183 void WeakHashTable::AddEntry(int entry, 16186 void WeakHashTable::AddEntry(int entry,
16184 Handle<Object> key, 16187 Handle<Object> key,
16185 Handle<Object> value) { 16188 Handle<Object> value) {
16186 DisallowHeapAllocation no_allocation; 16189 DisallowHeapAllocation no_allocation;
16187 set(EntryToIndex(entry), *key); 16190 // TODO(ulan): Skipping write barrier is a temporary solution to avoid
16188 set(EntryToValueIndex(entry), *value); 16191 // memory leaks. Remove this once we have special visitor for weak fixed
16192 // arrays.
16193 set(EntryToIndex(entry), *key, SKIP_WRITE_BARRIER);
16194 set(EntryToValueIndex(entry), *value, SKIP_WRITE_BARRIER);
16189 ElementAdded(); 16195 ElementAdded();
16190 } 16196 }
16191 16197
16192 16198
16193 template<class Derived, class Iterator, int entrysize> 16199 template<class Derived, class Iterator, int entrysize>
16194 Handle<Derived> OrderedHashTable<Derived, Iterator, entrysize>::Allocate( 16200 Handle<Derived> OrderedHashTable<Derived, Iterator, entrysize>::Allocate(
16195 Isolate* isolate, int capacity, PretenureFlag pretenure) { 16201 Isolate* isolate, int capacity, PretenureFlag pretenure) {
16196 // Capacity must be a power of two, since we depend on being able 16202 // Capacity must be a power of two, since we depend on being able
16197 // to divide and multiple by 2 (kLoadFactor) to derive capacity 16203 // to divide and multiple by 2 (kLoadFactor) to derive capacity
16198 // from number of buckets. If we decide to change kLoadFactor 16204 // from number of buckets. If we decide to change kLoadFactor
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
17274 #define ERROR_MESSAGES_TEXTS(C, T) T, 17280 #define ERROR_MESSAGES_TEXTS(C, T) T,
17275 static const char* error_messages_[] = { 17281 static const char* error_messages_[] = {
17276 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17282 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17277 }; 17283 };
17278 #undef ERROR_MESSAGES_TEXTS 17284 #undef ERROR_MESSAGES_TEXTS
17279 return error_messages_[reason]; 17285 return error_messages_[reason];
17280 } 17286 }
17281 17287
17282 17288
17283 } } // namespace v8::internal 17289 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698