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

Unified Diff: src/transitions.cc

Issue 1480873003: Introduce instance type for transition arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix zapping Created 5 years, 1 month 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/transitions.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/transitions.cc
diff --git a/src/transitions.cc b/src/transitions.cc
index 85e5dc7967dccc65235a6b6e274489498eed2e2e..4fe2ace3d94f28736bcef8e94db59e208fc3fee3 100644
--- a/src/transitions.cc
+++ b/src/transitions.cc
@@ -391,18 +391,23 @@ int TransitionArray::Capacity(Object* raw_transitions) {
Handle<TransitionArray> TransitionArray::Allocate(Isolate* isolate,
int number_of_transitions,
int slack) {
- Handle<FixedArray> array = isolate->factory()->NewFixedArray(
- LengthFor(number_of_transitions + slack), TENURED);
+ Handle<FixedArray> array = isolate->factory()->NewTransitionArray(
+ LengthFor(number_of_transitions + slack));
+ array->set(kNextLinkIndex, isolate->heap()->undefined_value());
array->set(kPrototypeTransitionsIndex, Smi::FromInt(0));
array->set(kTransitionLengthIndex, Smi::FromInt(number_of_transitions));
return Handle<TransitionArray>::cast(array);
}
-static void ZapTransitionArray(TransitionArray* transitions) {
- MemsetPointer(transitions->data_start(),
+// static
+void TransitionArray::ZapTransitionArray(TransitionArray* transitions) {
+ // Do not zap the next link that is used by GC.
+ STATIC_ASSERT(kNextLinkIndex + 1 == kPrototypeTransitionsIndex);
+ MemsetPointer(transitions->data_start() + kPrototypeTransitionsIndex,
transitions->GetHeap()->the_hole_value(),
- transitions->length());
+ transitions->length() - kPrototypeTransitionsIndex);
+ transitions->SetNumberOfTransitions(0);
}
« no previous file with comments | « src/transitions.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698