Revision: 19400
Author: [email protected]
Date: Mon Feb 17 10:41:25 2014 UTC
Log: Do not visit smis in the root list during GC.
[email protected]
BUG=328804
LOG=N
Review URL: https://codereview.chromium.org/166023003
http://code.google.com/p/v8/source/detail?r=19400
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/heap-inl.h
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/serialize.cc
/branches/bleeding_edge/src/serialize.h
=======================================
--- /branches/bleeding_edge/include/v8.h Wed Feb 12 22:04:19 2014 UTC
+++ /branches/bleeding_edge/include/v8.h Mon Feb 17 10:41:25 2014 UTC
@@ -5414,7 +5414,7 @@
static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8;
static const int kFalseValueRootIndex = 9;
- static const int kEmptyStringRootIndex = 148;
+ static const int kEmptyStringRootIndex = 141;
static const int kNodeClassIdOffset = 1 * kApiPointerSize;
static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
=======================================
--- /branches/bleeding_edge/src/heap-inl.h Fri Feb 7 09:54:52 2014 UTC
+++ /branches/bleeding_edge/src/heap-inl.h Mon Feb 17 10:41:25 2014 UTC
@@ -818,6 +818,13 @@
}
}
}
+
+
+void VerifySmisVisitor::VisitPointers(Object** start, Object** end) {
+ for (Object** current = start; current < end; current++) {
+ CHECK((*current)->IsSmi());
+ }
+}
double GCTracer::SizeOfHeapObjects() {
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Feb 13 15:36:17 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Mon Feb 17 10:41:25 2014 UTC
@@ -5841,6 +5841,9 @@
VerifyPointersVisitor visitor;
IterateRoots(&visitor, VISIT_ONLY_STRONG);
+ VerifySmisVisitor smis_visitor;
+ IterateSmiRoots(&smis_visitor);
+
new_space_.Verify();
old_pointer_space_->Verify(&visitor);
@@ -6136,6 +6139,12 @@
}
v->Synchronize(VisitorSynchronization::kExternalStringsTable);
}
+
+
+void Heap::IterateSmiRoots(ObjectVisitor* v) {
+ v->VisitPointers(&roots_[kSmiRootsStart], &roots_[kRootListLength]);
+ v->Synchronize(VisitorSynchronization::kSmiRootList);
+}
void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) {
=======================================
--- /branches/bleeding_edge/src/heap.h Wed Feb 12 22:04:19 2014 UTC
+++ /branches/bleeding_edge/src/heap.h Mon Feb 17 10:41:25 2014 UTC
@@ -78,7 +78,6 @@
V(ByteArray, empty_byte_array,
EmptyByteArray) \
V(DescriptorArray, empty_descriptor_array,
EmptyDescriptorArray) \
V(ConstantPoolArray, empty_constant_pool_array,
EmptyConstantPoolArray) \
- V(Smi, stack_limit,
StackLimit) \
V(Oddball, arguments_marker,
ArgumentsMarker) \
/* The roots above this line should be boring from a GC point of
view. */ \
/* This means they are never in new space and never on a page that
is */ \
@@ -186,14 +185,8 @@
V(Code, js_entry_code,
JsEntryCode) \
V(Code, js_construct_entry_code,
JsConstructEntryCode) \
V(FixedArray, natives_source_cache,
NativesSourceCache) \
- V(Smi, last_script_id,
LastScriptId) \
V(Script, empty_script,
EmptyScript) \
- V(Smi, real_stack_limit,
RealStackLimit) \
V(NameDictionary, intrinsic_function_names,
IntrinsicFunctionNames) \
- V(Smi, arguments_adaptor_deopt_pc_offset,
ArgumentsAdaptorDeoptPCOffset) \
- V(Smi, construct_stub_deopt_pc_offset,
ConstructStubDeoptPCOffset) \
- V(Smi, getter_stub_deopt_pc_offset,
GetterStubDeoptPCOffset) \
- V(Smi, setter_stub_deopt_pc_offset,
SetterStubDeoptPCOffset) \
V(Cell, undefined_cell,
UndefineCell) \
V(JSObject, observation_state,
ObservationState) \
V(Map, external_map,
ExternalMap) \
@@ -206,8 +199,19 @@
V(FixedArray, allocation_sites_scratchpad,
AllocationSitesScratchpad) \
V(JSObject, microtask_state, MicrotaskState)
+// Entries in this list are limited to Smis and are not visited during GC.
+#define
SMI_ROOT_LIST(V) \
+ V(Smi, stack_limit,
StackLimit) \
+ V(Smi, real_stack_limit,
RealStackLimit) \
+ V(Smi, last_script_id,
LastScriptId) \
+ V(Smi, arguments_adaptor_deopt_pc_offset,
ArgumentsAdaptorDeoptPCOffset) \
+ V(Smi, construct_stub_deopt_pc_offset,
ConstructStubDeoptPCOffset) \
+ V(Smi, getter_stub_deopt_pc_offset,
GetterStubDeoptPCOffset) \
+ V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset)
+
#define ROOT_LIST(V) \
STRONG_ROOT_LIST(V) \
+ SMI_ROOT_LIST(V) \
V(StringTable, string_table, StringTable)
// Heap roots that are known to be immortal immovable, for which we can
safely
@@ -1347,6 +1351,9 @@
void IterateRoots(ObjectVisitor* v, VisitMode mode);
// Iterates over all strong roots in the heap.
void IterateStrongRoots(ObjectVisitor* v, VisitMode mode);
+ // Iterates over entries in the smi roots list. Only interesting to the
+ // serializer/deserializer, since GC does not care about smis.
+ void IterateSmiRoots(ObjectVisitor* v);
// Iterates over all the other roots in the heap.
void IterateWeakRoots(ObjectVisitor* v, VisitMode mode);
@@ -1582,7 +1589,7 @@
// Implements the corresponding V8 API function.
bool IdleNotification(int hint);
- // Declare all the root indices.
+ // Declare all the root indices. This defines the root list order.
enum RootListIndex {
#define ROOT_INDEX_DECLARATION(type, name, camel_name)
k##camel_name##RootIndex,
STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION)
@@ -1598,8 +1605,14 @@
#undef DECLARE_STRUCT_MAP
kStringTableRootIndex,
+
+#define ROOT_INDEX_DECLARATION(type, name, camel_name)
k##camel_name##RootIndex,
+ SMI_ROOT_LIST(ROOT_INDEX_DECLARATION)
+#undef ROOT_INDEX_DECLARATION
+
+ kRootListLength,
kStrongRootListLength = kStringTableRootIndex,
- kRootListLength
+ kSmiRootsStart = kStringTableRootIndex + 1
};
STATIC_CHECK(kUndefinedValueRootIndex ==
Internals::kUndefinedValueRootIndex);
@@ -2589,6 +2602,13 @@
};
+// Verify that all objects are Smis.
+class VerifySmisVisitor: public ObjectVisitor {
+ public:
+ inline void VisitPointers(Object** start, Object** end);
+};
+
+
// Space iterator for iterating over all spaces of the heap. Returns each
space
// in turn, and null when it is done.
class AllSpaces BASE_EMBEDDED {
=======================================
--- /branches/bleeding_edge/src/objects.h Fri Feb 14 15:17:26 2014 UTC
+++ /branches/bleeding_edge/src/objects.h Mon Feb 17 10:41:25 2014 UTC
@@ -10636,6 +10636,7 @@
V(kStringTable, "string_table", "(Internalized strings)") \
V(kExternalStringsTable, "external_strings_table", "(External strings)")
\
V(kStrongRootList, "strong_root_list", "(Strong roots)") \
+ V(kSmiRootList, "smi_root_list", "(Smi roots)") \
V(kInternalizedString, "internalized_string", "(Internal string)") \
V(kBootstrapper, "bootstrapper", "(Bootstrapper)") \
V(kTop, "top", "(Isolate)") \
=======================================
--- /branches/bleeding_edge/src/serialize.cc Wed Dec 18 10:40:26 2013 UTC
+++ /branches/bleeding_edge/src/serialize.cc Mon Feb 17 10:41:25 2014 UTC
@@ -789,6 +789,7 @@
ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty());
ASSERT_EQ(NULL, external_reference_decoder_);
external_reference_decoder_ = new ExternalReferenceDecoder(isolate);
+ isolate_->heap()->IterateSmiRoots(this);
isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG);
isolate_->heap()->RepairFreeListsAfterBoot();
isolate_->heap()->IterateWeakRoots(this, VISIT_ALL);
@@ -1253,7 +1254,6 @@
Serializer::Serializer(Isolate* isolate, SnapshotByteSink* sink)
: isolate_(isolate),
sink_(sink),
- current_root_index_(0),
external_reference_encoder_(new ExternalReferenceEncoder(isolate)),
root_index_wave_front_(0) {
// The serializer is meant to be used only to generate initial heap
images
@@ -1279,7 +1279,7 @@
CHECK_EQ(0, isolate->eternal_handles()->NumberOfHandles());
// We don't support serializing installed extensions.
CHECK(!isolate->has_installed_extensions());
-
+ isolate->heap()->IterateSmiRoots(this);
isolate->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG);
}
=======================================
--- /branches/bleeding_edge/src/serialize.h Mon Dec 16 13:08:24 2013 UTC
+++ /branches/bleeding_edge/src/serialize.h Mon Feb 17 10:41:25 2014 UTC
@@ -579,7 +579,6 @@
// relative addresses for back references.
int fullness_[LAST_SPACE + 1];
SnapshotByteSink* sink_;
- int current_root_index_;
ExternalReferenceEncoder* external_reference_encoder_;
static bool serialization_enabled_;
// Did we already make use of the fact that serialization was not
enabled?
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.