Commit 8020b0dd authored by jgruber's avatar jgruber Committed by Commit Bot

[builtins] Only create constants table if serializing

Since we currently only fill the constants table if we're serializing,
we should only create & finalize the table in that case. Otherwise,
leave it initialized to empty_fixed_array.

Cq-Include-Trybots: luci.v8.try:v8_linux64_fyi_rel_ng
Bug: v8:6666
Change-Id: I6ecbfac9dc9a9dac7ff0f11331be09b1cbfb4c18
Reviewed-on: https://chromium-review.googlesource.com/948490Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51727}
parent a74b2491
......@@ -32,6 +32,8 @@ uint32_t BuiltinsConstantsTableBuilder::AddObject(Handle<Object> object) {
// Not yet finalized.
DCHECK_EQ(isolate_->heap()->empty_fixed_array(),
isolate_->heap()->builtins_constants_table());
DCHECK(isolate_->serializer_enabled());
#endif
uint32_t* maybe_key = map_.Find(object);
......@@ -68,6 +70,7 @@ void BuiltinsConstantsTableBuilder::Finalize() {
DCHECK_EQ(isolate_->heap()->empty_fixed_array(),
isolate_->heap()->builtins_constants_table());
DCHECK(isolate_->serializer_enabled());
DCHECK_LT(0, map_.size());
Handle<FixedArray> table =
......
......@@ -3050,7 +3050,10 @@ bool Isolate::Init(StartupDeserializer* des) {
// Terminate the partial snapshot cache so we can iterate.
partial_snapshot_cache_.push_back(heap_.undefined_value());
#ifdef V8_EMBEDDED_BUILTINS
builtins_constants_table_builder_ = new BuiltinsConstantsTableBuilder(this);
if (serializer_enabled()) {
builtins_constants_table_builder_ =
new BuiltinsConstantsTableBuilder(this);
}
#endif
}
......@@ -3085,7 +3088,7 @@ bool Isolate::Init(StartupDeserializer* des) {
setup_delegate_->SetupInterpreter(interpreter_);
#ifdef V8_EMBEDDED_BUILTINS
if (create_heap_objects) {
if (create_heap_objects && serializer_enabled()) {
builtins_constants_table_builder_->Finalize();
delete builtins_constants_table_builder_;
builtins_constants_table_builder_ = nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment