Commit 81302d3b authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Elide write barriers and remove some heap_object->GetHeap() calls on

Smi write barriers.
Review URL: http://codereview.chromium.org/8822008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10175 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 066822a2
...@@ -125,7 +125,8 @@ MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str, ...@@ -125,7 +125,8 @@ MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str,
if (!maybe_result->ToObject(&result)) return maybe_result; if (!maybe_result->ToObject(&result)) return maybe_result;
} }
reinterpret_cast<HeapObject*>(result)->set_map(map); // String maps are all immortal immovable objects.
reinterpret_cast<HeapObject*>(result)->set_map_unsafe(map);
// Set length and hash fields of the allocated string. // Set length and hash fields of the allocated string.
String* answer = String::cast(result); String* answer = String::cast(result);
answer->set_length(str.length()); answer->set_length(str.length());
......
...@@ -5392,7 +5392,9 @@ MaybeObject* FixedArray::CopySize(int new_length) { ...@@ -5392,7 +5392,9 @@ MaybeObject* FixedArray::CopySize(int new_length) {
AssertNoAllocation no_gc; AssertNoAllocation no_gc;
int len = length(); int len = length();
if (new_length < len) len = new_length; if (new_length < len) len = new_length;
result->set_map(map()); // We are taking the map from the old fixed array so the map is sure to
// be an immortal immutable object.
result->set_map_unsafe(map());
WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
result->set(i, get(i), mode); result->set(i, get(i), mode);
...@@ -8112,9 +8114,20 @@ void Code::Disassemble(const char* name, FILE* out) { ...@@ -8112,9 +8114,20 @@ void Code::Disassemble(const char* name, FILE* out) {
static void CopyFastElementsToFast(FixedArray* source, static void CopyFastElementsToFast(FixedArray* source,
FixedArray* destination, FixedArray* destination,
WriteBarrierMode mode) { WriteBarrierMode mode) {
uint32_t count = static_cast<uint32_t>(source->length()); int count = source->length();
for (uint32_t i = 0; i < count; ++i) { if (mode == SKIP_WRITE_BARRIER ||
destination->set(i, source->get(i), mode); !Page::FromAddress(destination->address())->IsFlagSet(
MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING)) {
ASSERT(count <= destination->length());
Address to = destination->address() + FixedArray::kHeaderSize;
Address from = source->address() + FixedArray::kHeaderSize;
memcpy(reinterpret_cast<void*>(to),
reinterpret_cast<void*>(from),
kPointerSize * count);
} else {
for (int i = 0; i < count; ++i) {
destination->set(i, source->get(i), mode);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment