Commit 96b3ff02 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[parser] Fix unsafe object access in test-parsing

Bug: v8:9996
Change-Id: I8c39a3a74a58e35eea784b8b26a2c519819b3269
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1924364
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65043}
parent 7935d196
...@@ -3308,7 +3308,7 @@ TEST(SerializationOfMaybeAssignmentFlag) { ...@@ -3308,7 +3308,7 @@ TEST(SerializationOfMaybeAssignmentFlag) {
v8::Local<v8::Value> v = CompileRun(src); v8::Local<v8::Value> v = CompileRun(src);
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Context context = f->context(); i::Handle<i::Context> context(f->context(), isolate);
i::AstValueFactory avf(&zone, isolate->ast_string_constants(), i::AstValueFactory avf(&zone, isolate->ast_string_constants(),
HashSeed(isolate)); HashSeed(isolate));
const i::AstRawString* name = avf.GetOneByteString("result"); const i::AstRawString* name = avf.GetOneByteString("result");
...@@ -3318,7 +3318,7 @@ TEST(SerializationOfMaybeAssignmentFlag) { ...@@ -3318,7 +3318,7 @@ TEST(SerializationOfMaybeAssignmentFlag) {
i::DeclarationScope* script_scope = i::DeclarationScope* script_scope =
new (&zone) i::DeclarationScope(&zone, &avf); new (&zone) i::DeclarationScope(&zone, &avf);
i::Scope* s = i::Scope::DeserializeScopeChain( i::Scope* s = i::Scope::DeserializeScopeChain(
isolate, &zone, context.scope_info(), script_scope, &avf, isolate, &zone, context->scope_info(), script_scope, &avf,
i::Scope::DeserializationMode::kIncludingVariables); i::Scope::DeserializationMode::kIncludingVariables);
CHECK(s != script_scope); CHECK(s != script_scope);
CHECK_NOT_NULL(name); CHECK_NOT_NULL(name);
...@@ -3358,7 +3358,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) { ...@@ -3358,7 +3358,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) {
v8::Local<v8::Value> v = CompileRun(src); v8::Local<v8::Value> v = CompileRun(src);
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Context context = f->context(); i::Handle<i::Context> context(f->context(), isolate);
i::AstValueFactory avf(&zone, isolate->ast_string_constants(), i::AstValueFactory avf(&zone, isolate->ast_string_constants(),
HashSeed(isolate)); HashSeed(isolate));
const i::AstRawString* name_x = avf.GetOneByteString("x"); const i::AstRawString* name_x = avf.GetOneByteString("x");
...@@ -3367,7 +3367,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) { ...@@ -3367,7 +3367,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) {
i::DeclarationScope* script_scope = i::DeclarationScope* script_scope =
new (&zone) i::DeclarationScope(&zone, &avf); new (&zone) i::DeclarationScope(&zone, &avf);
i::Scope* s = i::Scope::DeserializeScopeChain( i::Scope* s = i::Scope::DeserializeScopeChain(
isolate, &zone, context.scope_info(), script_scope, &avf, isolate, &zone, context->scope_info(), script_scope, &avf,
i::Scope::DeserializationMode::kIncludingVariables); i::Scope::DeserializationMode::kIncludingVariables);
CHECK(s != script_scope); CHECK(s != script_scope);
......
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