Commit 86337d3d authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Get the speed back in new context creation after it was tanked

in 9744.
Review URL: http://codereview.chromium.org/8380035

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9763 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 69c44d64
...@@ -759,6 +759,10 @@ void Deserializer::ReadChunk(Object** current, ...@@ -759,6 +759,10 @@ void Deserializer::ReadChunk(Object** current,
int source_space, int source_space,
Address current_object_address) { Address current_object_address) {
Isolate* const isolate = isolate_; Isolate* const isolate = isolate_;
bool write_barrier_needed = (current_object_address != NULL &&
source_space != NEW_SPACE &&
source_space != CELL_SPACE &&
source_space == OLD_DATA_SPACE);
while (current < limit) { while (current < limit) {
int data = source_->Get(); int data = source_->Get();
switch (data) { switch (data) {
...@@ -778,28 +782,18 @@ void Deserializer::ReadChunk(Object** current, ...@@ -778,28 +782,18 @@ void Deserializer::ReadChunk(Object** current,
if (where == kNewObject && how == kPlain && within == kStartOfObject) {\ if (where == kNewObject && how == kPlain && within == kStartOfObject) {\
ASSIGN_DEST_SPACE(space_number) \ ASSIGN_DEST_SPACE(space_number) \
ReadObject(space_number, dest_space, current); \ ReadObject(space_number, dest_space, current); \
emit_write_barrier = (space_number == NEW_SPACE && \ emit_write_barrier = (space_number == NEW_SPACE); \
source_space != NEW_SPACE && \
source_space != CELL_SPACE); \
} else { \ } else { \
Object* new_object = NULL; /* May not be a real Object pointer. */ \ Object* new_object = NULL; /* May not be a real Object pointer. */ \
if (where == kNewObject) { \ if (where == kNewObject) { \
ASSIGN_DEST_SPACE(space_number) \ ASSIGN_DEST_SPACE(space_number) \
ReadObject(space_number, dest_space, &new_object); \ ReadObject(space_number, dest_space, &new_object); \
} else if (where == kRootArray) { \ } else if (where == kRootArray) { \
if (source_space != CELL_SPACE && \
source_space != CODE_SPACE && \
source_space != OLD_DATA_SPACE) { \
emit_write_barrier = true; \ emit_write_barrier = true; \
} \
int root_id = source_->GetInt(); \ int root_id = source_->GetInt(); \
new_object = isolate->heap()->roots_array_start()[root_id]; \ new_object = isolate->heap()->roots_array_start()[root_id]; \
} else if (where == kPartialSnapshotCache) { \ } else if (where == kPartialSnapshotCache) { \
if (source_space != CELL_SPACE && \
source_space != CODE_SPACE && \
source_space != OLD_DATA_SPACE) { \
emit_write_barrier = true; \ emit_write_barrier = true; \
} \
int cache_index = source_->GetInt(); \ int cache_index = source_->GetInt(); \
new_object = isolate->serialize_partial_snapshot_cache() \ new_object = isolate->serialize_partial_snapshot_cache() \
[cache_index]; \ [cache_index]; \
...@@ -809,16 +803,12 @@ void Deserializer::ReadChunk(Object** current, ...@@ -809,16 +803,12 @@ void Deserializer::ReadChunk(Object** current,
Decode(reference_id); \ Decode(reference_id); \
new_object = reinterpret_cast<Object*>(address); \ new_object = reinterpret_cast<Object*>(address); \
} else if (where == kBackref) { \ } else if (where == kBackref) { \
emit_write_barrier = (space_number == NEW_SPACE && \ emit_write_barrier = (space_number == NEW_SPACE); \
source_space != NEW_SPACE && \
source_space != CELL_SPACE); \
new_object = GetAddressFromEnd(data & kSpaceMask); \ new_object = GetAddressFromEnd(data & kSpaceMask); \
} else { \ } else { \
ASSERT(where == kFromStart); \ ASSERT(where == kFromStart); \
if (offset_from_start == kUnknownOffsetFromStart) { \ if (offset_from_start == kUnknownOffsetFromStart) { \
emit_write_barrier = (space_number == NEW_SPACE && \ emit_write_barrier = (space_number == NEW_SPACE); \
source_space != NEW_SPACE && \
source_space != CELL_SPACE); \
new_object = GetAddressFromStart(data & kSpaceMask); \ new_object = GetAddressFromStart(data & kSpaceMask); \
} else { \ } else { \
Address object_address = pages_[space_number][0] + \ Address object_address = pages_[space_number][0] + \
...@@ -845,14 +835,14 @@ void Deserializer::ReadChunk(Object** current, ...@@ -845,14 +835,14 @@ void Deserializer::ReadChunk(Object** current,
*current = new_object; \ *current = new_object; \
} \ } \
} \ } \
if (emit_write_barrier && current_object_address != NULL) { \ if (emit_write_barrier && write_barrier_needed) { \
Address current_address = reinterpret_cast<Address>(current); \ Address current_address = reinterpret_cast<Address>(current); \
isolate->heap()->RecordWrite( \ isolate->heap()->RecordWrite( \
current_object_address, \ current_object_address, \
static_cast<int>(current_address - current_object_address)); \ static_cast<int>(current_address - current_object_address)); \
} \ } \
if (!current_was_incremented) { \ if (!current_was_incremented) { \
current++; /* Increment current if it wasn't done above. */ \ current++; \
} \ } \
break; \ break; \
} \ } \
......
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