Handle<Context> native_context = CreateEnvironment(
MaybeHandle<JSGlobalProxy>(), v8::Local<v8::ObjectTemplate>(),
&no_extensions, THIN_CONTEXT);
- isolate->heap()->set_code_stub_context(*native_context);
+ isolate->heap()->SetRootCodeStubContext(*native_context);
isolate->set_context(*native_context);
Handle<JSObject> code_stub_exports =
isolate->factory()->NewJSObject(isolate->object_function());
JSObject::NormalizeProperties(code_stub_exports, CLEAR_INOBJECT_PROPERTIES, 2,
"container to export to extra natives");
- isolate->heap()->set_code_stub_exports_object(*code_stub_exports);
+ isolate->heap()->SetRootCodeStubExportsObject(*code_stub_exports);
return InstallCodeStubNatives(isolate);
}
script_is_embedder_debug_script, attribs);
script_map->AppendDescriptor(&d);
}
-
- // Allocate the empty script.
- Handle<Script> script = factory()->NewScript(factory()->empty_string());
- script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
- heap()->public_set_empty_script(*script);
}
{
// Builtin function for OpaqueReference -- a JSValue-based object,
Handle<UnseededNumberDictionary>(heap->code_stubs()),
GetKey(),
new_object);
- heap->public_set_code_stubs(*dict);
+ heap->SetRootCodeStubs(*dict);
}
code = *new_object;
}
for (int i = array->length(); i < length; i++) {
new_array->set(i, isolate()->heap()->undefined_value());
}
- isolate()->heap()->public_set_materialized_objects(*new_array);
+ isolate()->heap()->SetRootMaterializedObjects(*new_array);
return new_array;
}
PUBLIC_SYMBOL_LIST(SYMBOL_ACCESSOR)
#undef SYMBOL_ACCESSOR
- inline void set_string_table(Handle<StringTable> table) {
- isolate()->heap()->set_string_table(*table);
- }
-
- inline void set_weak_stack_trace_list(Handle<WeakFixedArray> list) {
- isolate()->heap()->set_weak_stack_trace_list(*list);
- }
-
// Allocates a new SharedFunctionInfo object.
Handle<SharedFunctionInfo> NewSharedFunctionInfo(
Handle<String> name, int number_of_literals, FunctionKind kind,
// Handling of script id generation is in Factory::NewScript.
set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId));
+ // Allocate the empty script.
+ Handle<Script> script = factory->NewScript(factory->empty_string());
+ script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
+ set_empty_script(*script);
+
Handle<PropertyCell> cell = factory->NewPropertyCell();
cell->set_value(Smi::FromInt(Isolate::kArrayProtectorValid));
set_array_protector(*cell);
Object** roots_array_start() { return roots_; }
// Sets the stub_cache_ (only used when expanding the dictionary).
- void public_set_code_stubs(UnseededNumberDictionary* value) {
+ void SetRootCodeStubs(UnseededNumberDictionary* value) {
roots_[kCodeStubsRootIndex] = value;
}
// Sets the non_monomorphic_cache_ (only used when expanding the dictionary).
- void public_set_non_monomorphic_cache(UnseededNumberDictionary* value) {
+ void SetRootNonMonomorphicCache(UnseededNumberDictionary* value) {
roots_[kNonMonomorphicCacheRootIndex] = value;
}
- void public_set_empty_script(Script* script) {
- roots_[kEmptyScriptRootIndex] = script;
+ void SetRootMaterializedObjects(FixedArray* objects) {
+ roots_[kMaterializedObjectsRootIndex] = objects;
}
- void public_set_materialized_objects(FixedArray* objects) {
- roots_[kMaterializedObjectsRootIndex] = objects;
+ void SetRootCodeStubContext(Object* value) {
+ roots_[kCodeStubContextRootIndex] = value;
+ }
+
+ void SetRootCodeStubExportsObject(JSObject* value) {
+ roots_[kCodeStubExportsObjectRootIndex] = value;
+ }
+
+ void SetRootScriptList(Object* value) {
+ roots_[kScriptListRootIndex] = value;
+ }
+
+ void SetRootStringTable(StringTable* value) {
+ roots_[kStringTableRootIndex] = value;
}
// Set the stack limit in the roots_ array. Some architectures generate
StrongRootsList* strong_roots_list_;
+ // Classes in "heap" can be friends.
friend class AlwaysAllocateScope;
- friend class Bootstrapper;
- friend class Deserializer;
- friend class Factory;
friend class GCCallbacksScope;
friend class GCTracer;
friend class HeapIterator;
friend class IncrementalMarking;
- friend class Isolate;
friend class MarkCompactCollector;
friend class MarkCompactMarkingVisitor;
- friend class MapCompact;
friend class Page;
friend class StoreBuffer;
+ // The allocator interface.
+ friend class Factory;
+
+ // The Isolate constructs us.
+ friend class Isolate;
+
// Used in cctest.
friend class HeapTester;
static void FillCache(Isolate* isolate, Handle<Code> code) {
Handle<UnseededNumberDictionary> dictionary = UnseededNumberDictionary::Set(
isolate->factory()->non_monomorphic_cache(), code->flags(), code);
- isolate->heap()->public_set_non_monomorphic_cache(*dictionary);
+ isolate->heap()->SetRootNonMonomorphicCache(*dictionary);
}
// We need a key instance for the virtual hash function.
InternalizedStringKey dummy_key(Handle<String>::null());
table = StringTable::EnsureCapacity(table, expected, &dummy_key);
- isolate->factory()->set_string_table(table);
+ isolate->heap()->SetRootStringTable(*table);
}
table->set(EntryToIndex(entry), *string);
table->ElementAdded();
- isolate->factory()->set_string_table(table);
+ isolate->heap()->SetRootStringTable(*table);
return Handle<String>::cast(string);
}
// Assign a new script id to avoid collision.
script->set_id(isolate_->heap()->NextScriptId());
// Add script to list.
- heap->set_script_list(*WeakFixedArray::Add(factory->script_list(), script));
+ Handle<Object> list = WeakFixedArray::Add(factory->script_list(), script);
+ heap->SetRootScriptList(*list);
}
}