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

Unified Diff: src/objects.cc

Issue 1034163002: Use atomic operation to read the length of a fixed array. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compile error Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-regexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 2755eaecfec8e3457ba10000499b779d4e1fbf99..56a5a47d075ae1cb55ddf41e17d828dad5bce4fb 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1030,7 +1030,8 @@ bool String::MakeExternal(v8::String::ExternalStringResource* resource) {
self->set_resource(resource);
if (is_internalized) self->Hash(); // Force regeneration of the hash value.
- heap->AdjustLiveBytes(this->address(), new_size - size, Heap::FROM_MUTATOR);
+ heap->AdjustLiveBytes(this->address(), new_size - size,
+ Heap::CONCURRENT_TO_SWEEPER);
return true;
}
@@ -1090,7 +1091,8 @@ bool String::MakeExternal(v8::String::ExternalOneByteStringResource* resource) {
self->set_resource(resource);
if (is_internalized) self->Hash(); // Force regeneration of the hash value.
- heap->AdjustLiveBytes(this->address(), new_size - size, Heap::FROM_MUTATOR);
+ heap->AdjustLiveBytes(this->address(), new_size - size,
+ Heap::CONCURRENT_TO_SWEEPER);
return true;
}
@@ -2113,7 +2115,7 @@ void JSObject::MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
// If there are properties in the new backing store, trim it to the correct
// size and install the backing store into the object.
if (external > 0) {
- heap->RightTrimFixedArray<Heap::FROM_MUTATOR>(*array, inobject);
+ heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, inobject);
object->set_properties(*array);
}
@@ -2126,7 +2128,8 @@ void JSObject::MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
Address address = object->address();
heap->CreateFillerObjectAt(
address + new_instance_size, instance_size_delta);
- heap->AdjustLiveBytes(address, -instance_size_delta, Heap::FROM_MUTATOR);
+ heap->AdjustLiveBytes(address, -instance_size_delta,
+ Heap::CONCURRENT_TO_SWEEPER);
}
// We are storing the new map using release store after creating a filler for
@@ -4638,7 +4641,7 @@ void JSObject::MigrateFastToSlow(Handle<JSObject> object,
heap->CreateFillerObjectAt(object->address() + new_instance_size,
instance_size_delta);
heap->AdjustLiveBytes(object->address(), -instance_size_delta,
- Heap::FROM_MUTATOR);
+ Heap::CONCURRENT_TO_SWEEPER);
}
// We are storing the new map using release store after creating a filler for
@@ -8105,7 +8108,7 @@ Handle<PolymorphicCodeCacheHashTable> PolymorphicCodeCacheHashTable::Put(
void FixedArray::Shrink(int new_length) {
DCHECK(0 <= new_length && new_length <= length());
if (new_length < length()) {
- GetHeap()->RightTrimFixedArray<Heap::FROM_MUTATOR>(
+ GetHeap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(
this, length() - new_length);
}
}
@@ -9468,7 +9471,7 @@ Handle<String> SeqString::Truncate(Handle<SeqString> string, int new_length) {
// that are a multiple of pointer size.
heap->CreateFillerObjectAt(start_of_string + new_size, delta);
}
- heap->AdjustLiveBytes(start_of_string, -delta, Heap::FROM_MUTATOR);
+ heap->AdjustLiveBytes(start_of_string, -delta, Heap::CONCURRENT_TO_SWEEPER);
// We are storing the new length using release store after creating a filler
// for the left-over space to avoid races with the sweeper thread.
@@ -9888,7 +9891,8 @@ void SharedFunctionInfo::EvictFromOptimizedCodeMap(Code* optimized_code,
}
if (dst != length) {
// Always trim even when array is cleared because of heap verifier.
- GetHeap()->RightTrimFixedArray<Heap::FROM_MUTATOR>(code_map, length - dst);
+ GetHeap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(code_map,
+ length - dst);
if (code_map->length() == kEntriesStart) ClearOptimizedCodeMap();
}
}
@@ -9899,7 +9903,8 @@ void SharedFunctionInfo::TrimOptimizedCodeMap(int shrink_by) {
DCHECK(shrink_by % kEntryLength == 0);
DCHECK(shrink_by <= code_map->length() - kEntriesStart);
// Always trim even when array is cleared because of heap verifier.
- GetHeap()->RightTrimFixedArray<Heap::FROM_GC>(code_map, shrink_by);
+ GetHeap()->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(code_map,
+ shrink_by);
if (code_map->length() == kEntriesStart) {
ClearOptimizedCodeMap();
}
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698