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

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: 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
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 table->set(EntryToValueIndex(entry), *value, SKIP_WRITE_BARRIER);
Michael Starzinger 2014/05/14 08:38:30 nit: Can we add a TODO here that skipping the WB i
ulan 2014/05/14 08:54:04 Done.
16172 return table; 16172 return table;
16173 } 16173 }
16174 16174
16175 // Check whether the hash table should be extended. 16175 // Check whether the hash table should be extended.
16176 table = EnsureCapacity(table, 1, key, TENURED); 16176 table = EnsureCapacity(table, 1, key, TENURED);
16177 16177
16178 table->AddEntry(table->FindInsertionEntry(table->Hash(key)), key, value); 16178 table->AddEntry(table->FindInsertionEntry(table->Hash(key)), key, value);
16179 return table; 16179 return table;
16180 } 16180 }
16181 16181
16182 16182
16183 void WeakHashTable::AddEntry(int entry, 16183 void WeakHashTable::AddEntry(int entry,
16184 Handle<Object> key, 16184 Handle<Object> key,
16185 Handle<Object> value) { 16185 Handle<Object> value) {
16186 DisallowHeapAllocation no_allocation; 16186 DisallowHeapAllocation no_allocation;
16187 set(EntryToIndex(entry), *key); 16187 set(EntryToIndex(entry), *key, SKIP_WRITE_BARRIER);
Michael Starzinger 2014/05/14 08:38:30 nit: Likewise.
ulan 2014/05/14 08:54:04 Done.
16188 set(EntryToValueIndex(entry), *value); 16188 set(EntryToValueIndex(entry), *value, SKIP_WRITE_BARRIER);
16189 ElementAdded(); 16189 ElementAdded();
16190 } 16190 }
16191 16191
16192 16192
16193 template<class Derived, class Iterator, int entrysize> 16193 template<class Derived, class Iterator, int entrysize>
16194 Handle<Derived> OrderedHashTable<Derived, Iterator, entrysize>::Allocate( 16194 Handle<Derived> OrderedHashTable<Derived, Iterator, entrysize>::Allocate(
16195 Isolate* isolate, int capacity, PretenureFlag pretenure) { 16195 Isolate* isolate, int capacity, PretenureFlag pretenure) {
16196 // Capacity must be a power of two, since we depend on being able 16196 // Capacity must be a power of two, since we depend on being able
16197 // to divide and multiple by 2 (kLoadFactor) to derive capacity 16197 // to divide and multiple by 2 (kLoadFactor) to derive capacity
16198 // from number of buckets. If we decide to change kLoadFactor 16198 // 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, 17274 #define ERROR_MESSAGES_TEXTS(C, T) T,
17275 static const char* error_messages_[] = { 17275 static const char* error_messages_[] = {
17276 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17276 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17277 }; 17277 };
17278 #undef ERROR_MESSAGES_TEXTS 17278 #undef ERROR_MESSAGES_TEXTS
17279 return error_messages_[reason]; 17279 return error_messages_[reason];
17280 } 17280 }
17281 17281
17282 17282
17283 } } // namespace v8::internal 17283 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | test/cctest/test-heap.cc » ('j') | test/cctest/test-heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698