Commit 25259d3f authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

Make Snapshot::EnsureBuiltinIsDeserialized more robust.

Also unskip test that has already been fixed in f1b1ec70.

R=jgruber@chromium.org

Bug: v8:178
Change-Id: I9cd2156ef41146b0dd58a974088726f5cbda8058
Reviewed-on: https://chromium-review.googlesource.com/970243Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52050}
parent b6b9c9fd
......@@ -458,6 +458,19 @@ RUNTIME_FUNCTION(Runtime_DeserializeLazy) {
DCHECK(FLAG_lazy_deserialization);
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
#ifdef DEBUG
int builtin_id = shared->lazy_deserialization_builtin_id();
// At this point, the builtins table should definitely have DeserializeLazy
// set at the position of the target builtin.
CHECK_EQ(Builtins::kDeserializeLazy,
isolate->builtins()->builtin(builtin_id)->builtin_index());
// The DeserializeLazy builtin tail-calls the deserialized builtin. This only
// works with JS-linkage.
CHECK(Builtins::IsLazy(builtin_id));
CHECK_EQ(Builtins::TFJ, Builtins::KindOf(builtin_id));
#endif // DEBUG
Snapshot::EnsureBuiltinIsDeserialized(isolate, shared);
function->set_code(shared->code());
......
......@@ -147,22 +147,19 @@ void Snapshot::EnsureBuiltinIsDeserialized(Isolate* isolate,
int builtin_id = shared->lazy_deserialization_builtin_id();
// At this point, the builtins table should definitely have DeserializeLazy
// set at the position of the target builtin. Also, we should never lazily
// deserialize DeserializeLazy.
// We should never lazily deserialize DeserializeLazy.
DCHECK_NE(Builtins::kDeserializeLazy, builtin_id);
DCHECK_EQ(Builtins::kDeserializeLazy,
isolate->builtins()->builtin(builtin_id)->builtin_index());
// The DeserializeLazy builtin tail-calls the deserialized builtin. This only
// works with JS-linkage.
DCHECK(Builtins::IsLazy(builtin_id));
DCHECK_EQ(Builtins::TFJ, Builtins::KindOf(builtin_id));
// Look up code from builtins list.
Code* code = isolate->builtins()->builtin(builtin_id);
Code* code = Snapshot::DeserializeBuiltin(isolate, builtin_id);
DCHECK_EQ(builtin_id, code->builtin_index());
DCHECK_EQ(code, isolate->builtins()->builtin(builtin_id));
// Deserialize if builtin is not on the list.
if (code->builtin_index() != builtin_id) {
DCHECK_EQ(code->builtin_index(), Builtins::kDeserializeLazy);
code = Snapshot::DeserializeBuiltin(isolate, builtin_id);
DCHECK_EQ(builtin_id, code->builtin_index());
DCHECK_EQ(code, isolate->builtins()->builtin(builtin_id));
}
shared->set_code(code);
}
......
......@@ -136,7 +136,6 @@
# https://crbug.com/v8/7543
'test-debug/BreakPointJSBuiltin': [SKIP],
'test-debug/BreakPointBuiltin': [SKIP],
}], # ALWAYS
##############################################################################
......
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