Chromium Code Reviews| Index: src/heap.h |
| diff --git a/src/heap.h b/src/heap.h |
| index eb3afd9fc4d94c6c119560b36a9fc6ec764225f1..fc9c67d65eea8141615675d13873725af049d340 100644 |
| --- a/src/heap.h |
| +++ b/src/heap.h |
| @@ -78,7 +78,6 @@ namespace internal { |
| 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 @@ namespace internal { |
| 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 @@ namespace internal { |
| 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 ROOT_SMI_LIST(V) \ |
|
Michael Starzinger
2014/02/14 14:24:01
nit: Can we call it SMI_ROOT_LIST instead?
|
| + 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) \ |
| + ROOT_SMI_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 @@ class Heap { |
| 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 root smis list. Only interesting to the |
| + // serializer/deserializer, since GC does not care about smis. |
| + void IterateRootSmis(ObjectVisitor* v); |
|
Michael Starzinger
2014/02/14 14:24:01
nit: Likewise IterateSmiRoots() here.
|
| // Iterates over all the other roots in the heap. |
| void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); |
| @@ -1582,26 +1589,27 @@ class Heap { |
| // Implements the corresponding V8 API function. |
| bool IdleNotification(int hint); |
| - // Declare all the root indices. |
| - enum RootListIndex { |
| + // Declare all the root indices. This defines the root list order. |
| #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
|
Michael Starzinger
2014/02/14 14:24:01
nit: Can we move the #define and #undef pragmas in
|
| - STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) |
| -#undef ROOT_INDEX_DECLARATION |
| - |
| #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, |
| - INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION) |
| -#undef STRING_DECLARATION |
| +#define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, |
| + enum RootListIndex { |
| + STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) |
| + INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION) |
| // Utility type maps |
| -#define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, |
| STRUCT_LIST(DECLARE_STRUCT_MAP) |
| -#undef DECLARE_STRUCT_MAP |
| - |
| kStringTableRootIndex, |
| + ROOT_SMI_LIST(ROOT_INDEX_DECLARATION) |
| + kRootListLength, |
| kStrongRootListLength = kStringTableRootIndex, |
| - kRootListLength |
| + kRootSmisStart = kStringTableRootIndex + 1 |
| }; |
| +#undef DECLARE_STRUCT_MAP |
| +#undef STRING_DECLARATION |
| +#undef ROOT_INDEX_DECLARATION |
| + |
| STATIC_CHECK(kUndefinedValueRootIndex == Internals::kUndefinedValueRootIndex); |
| STATIC_CHECK(kNullValueRootIndex == Internals::kNullValueRootIndex); |
| STATIC_CHECK(kTrueValueRootIndex == Internals::kTrueValueRootIndex); |
| @@ -2589,6 +2597,13 @@ class VerifyPointersVisitor: public ObjectVisitor { |
| }; |
| +// 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 { |