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

Unified Diff: src/transitions.cc

Issue 1157943003: Replace ad-hoc weakness in transition array with WeakCell. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove redundant dchecks Created 5 years, 6 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
Index: src/transitions.cc
diff --git a/src/transitions.cc b/src/transitions.cc
index c39534bbb566a2930934d2a56482517a2d18e1c6..d646eb80c888f287b42ec346ccc9585c22a4b622 100644
--- a/src/transitions.cc
+++ b/src/transitions.cc
@@ -17,11 +17,11 @@ void TransitionArray::Insert(Handle<Map> map, Handle<Name> name,
Handle<Map> target, SimpleTransitionFlag flag) {
Isolate* isolate = map->GetIsolate();
target->SetBackPointer(*map);
+ Handle<WeakCell> cell = Map::WeakCellForMap(target);
// If the map doesn't have any transitions at all yet, install the new one.
if (CanStoreSimpleTransition(map->raw_transitions())) {
if (flag == SIMPLE_PROPERTY_TRANSITION) {
- Handle<WeakCell> cell = Map::WeakCellForMap(target);
ReplaceTransitions(map, *cell);
return;
}
@@ -42,7 +42,6 @@ void TransitionArray::Insert(Handle<Map> map, Handle<Name> name,
if (flag == SIMPLE_PROPERTY_TRANSITION && key->Equals(*name) &&
old_details.kind() == new_details.kind() &&
old_details.attributes() == new_details.attributes()) {
- Handle<WeakCell> cell = Map::WeakCellForMap(target);
ReplaceTransitions(map, *cell);
return;
}
@@ -51,8 +50,8 @@ void TransitionArray::Insert(Handle<Map> map, Handle<Name> name,
// Re-read existing data; the allocation might have caused it to be cleared.
if (IsSimpleTransition(map->raw_transitions())) {
old_target = GetSimpleTransition(map->raw_transitions());
- result->NoIncrementalWriteBarrierSet(
- 0, GetSimpleTransitionKey(old_target), old_target);
+ result->Set(0, GetSimpleTransitionKey(old_target),
+ GetSimpleTransitionCell(map->raw_transitions()));
} else {
result->SetNumberOfTransitions(0);
}
@@ -83,7 +82,7 @@ void TransitionArray::Insert(Handle<Map> map, Handle<Name> name,
&insertion_index);
// If an existing entry was found, overwrite it and return.
if (index != kNotFound) {
- array->SetTarget(index, *target);
+ array->SetTargetCell(index, *cell);
return;
}
@@ -96,10 +95,10 @@ void TransitionArray::Insert(Handle<Map> map, Handle<Name> name,
array->SetNumberOfTransitions(new_nof);
for (index = number_of_transitions; index > insertion_index; --index) {
array->SetKey(index, array->GetKey(index - 1));
- array->SetTarget(index, array->GetTarget(index - 1));
+ array->SetTargetCell(index, array->GetTargetCell(index - 1));
}
array->SetKey(index, *name);
- array->SetTarget(index, *target);
+ array->SetTargetCell(index, *cell);
SLOW_DCHECK(array->IsSortedNoDuplicates());
return;
}
@@ -145,11 +144,11 @@ void TransitionArray::Insert(Handle<Map> map, Handle<Name> name,
DCHECK_NE(kNotFound, insertion_index);
for (int i = 0; i < insertion_index; ++i) {
- result->NoIncrementalWriteBarrierCopyFrom(array, i, i);
+ result->CopyFrom(array, i, i);
}
- result->NoIncrementalWriteBarrierSet(insertion_index, *name, *target);
+ result->Set(insertion_index, *name, *cell);
for (int i = insertion_index; i < number_of_transitions; ++i) {
- result->NoIncrementalWriteBarrierCopyFrom(array, i, i + 1);
+ result->CopyFrom(array, i, i + 1);
}
SLOW_DCHECK(result->IsSortedNoDuplicates());
@@ -349,12 +348,10 @@ Handle<TransitionArray> TransitionArray::Allocate(Isolate* isolate,
}
-void TransitionArray::NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin,
- int origin_transition,
- int target_transition) {
- NoIncrementalWriteBarrierSet(target_transition,
- origin->GetKey(origin_transition),
- origin->GetTarget(origin_transition));
+void TransitionArray::CopyFrom(TransitionArray* origin, int origin_transition,
+ int target_transition) {
+ Set(target_transition, origin->GetKey(origin_transition),
+ origin->GetTargetCell(origin_transition));
}
@@ -422,9 +419,9 @@ void TransitionArray::EnsureHasFullTransitionArray(Handle<Map> map) {
result->Shrink(ToKeyIndex(0));
result->SetNumberOfTransitions(0);
} else if (nof == 1) {
- Map* target = GetSimpleTransition(raw_transitions);
- Name* key = GetSimpleTransitionKey(target);
- result->NoIncrementalWriteBarrierSet(0, key, target);
+ WeakCell* target_cell = GetSimpleTransitionCell(raw_transitions);
+ Name* key = GetSimpleTransitionKey(Map::cast(target_cell->value()));
+ result->Set(0, key, target_cell);
}
ReplaceTransitions(map, *result);
}
« src/heap/mark-compact.cc ('K') | « src/transitions.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698