Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2160943004: Remove ast_value_factory_ and usages from scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rename NewScope(...FunctionKind) to NewFunctionScope Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/preparser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3343 matching lines...) Expand 10 before | Expand all | Expand 10 after
3354 v8::Local<v8::Value> v = CompileRun(src); 3354 v8::Local<v8::Value> v = CompileRun(src);
3355 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); 3355 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
3356 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); 3356 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
3357 i::Context* context = f->context(); 3357 i::Context* context = f->context();
3358 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); 3358 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed());
3359 avf.Internalize(isolate); 3359 avf.Internalize(isolate);
3360 const i::AstRawString* name = avf.GetOneByteString("result"); 3360 const i::AstRawString* name = avf.GetOneByteString("result");
3361 i::Handle<i::String> str = name->string(); 3361 i::Handle<i::String> str = name->string();
3362 CHECK(str->IsInternalizedString()); 3362 CHECK(str->IsInternalizedString());
3363 i::Scope* script_scope = 3363 i::Scope* script_scope =
3364 new (&zone) i::Scope(&zone, NULL, i::SCRIPT_SCOPE, &avf); 3364 new (&zone) i::Scope(&zone, nullptr, i::SCRIPT_SCOPE);
3365 script_scope->Initialize(); 3365 script_scope->Initialize();
3366 i::Scope* s = 3366 i::Scope* s = i::Scope::DeserializeScopeChain(isolate, &zone, context,
3367 i::Scope::DeserializeScopeChain(isolate, &zone, context, script_scope); 3367 script_scope, &avf);
3368 CHECK(s != script_scope); 3368 CHECK(s != script_scope);
3369 CHECK(name != NULL); 3369 CHECK(name != NULL);
3370 3370
3371 // Get result from h's function context (that is f's context) 3371 // Get result from h's function context (that is f's context)
3372 i::Variable* var = s->Lookup(name); 3372 i::Variable* var = s->Lookup(name);
3373 3373
3374 CHECK(var != NULL); 3374 CHECK(var != NULL);
3375 // Maybe assigned should survive deserialization 3375 // Maybe assigned should survive deserialization
3376 CHECK(var->maybe_assigned() == i::kMaybeAssigned); 3376 CHECK(var->maybe_assigned() == i::kMaybeAssigned);
3377 // TODO(sigurds) Figure out if is_used should survive context serialization. 3377 // TODO(sigurds) Figure out if is_used should survive context serialization.
(...skipping 24 matching lines...) Expand all
3402 printf("\n"); 3402 printf("\n");
3403 i::Zone zone(CcTest::i_isolate()->allocator()); 3403 i::Zone zone(CcTest::i_isolate()->allocator());
3404 v8::Local<v8::Value> v = CompileRun(src); 3404 v8::Local<v8::Value> v = CompileRun(src);
3405 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); 3405 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
3406 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); 3406 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
3407 i::Context* context = f->context(); 3407 i::Context* context = f->context();
3408 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); 3408 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed());
3409 avf.Internalize(isolate); 3409 avf.Internalize(isolate);
3410 3410
3411 i::Scope* script_scope = 3411 i::Scope* script_scope =
3412 new (&zone) i::Scope(&zone, NULL, i::SCRIPT_SCOPE, &avf); 3412 new (&zone) i::Scope(&zone, nullptr, i::SCRIPT_SCOPE);
3413 script_scope->Initialize(); 3413 script_scope->Initialize();
3414 i::Scope* s = 3414 i::Scope* s = i::Scope::DeserializeScopeChain(isolate, &zone, context,
3415 i::Scope::DeserializeScopeChain(isolate, &zone, context, script_scope); 3415 script_scope, &avf);
3416 CHECK(s != script_scope); 3416 CHECK(s != script_scope);
3417 const i::AstRawString* name_x = avf.GetOneByteString("x"); 3417 const i::AstRawString* name_x = avf.GetOneByteString("x");
3418 3418
3419 // Get result from f's function context (that is g's outer context) 3419 // Get result from f's function context (that is g's outer context)
3420 i::Variable* var_x = s->Lookup(name_x); 3420 i::Variable* var_x = s->Lookup(name_x);
3421 CHECK(var_x != NULL); 3421 CHECK(var_x != NULL);
3422 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); 3422 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned);
3423 } 3423 }
3424 3424
3425 3425
(...skipping 4527 matching lines...) Expand 10 before | Expand all | Expand 10 after
7953 "(a,);", 7953 "(a,);",
7954 "(a,b,c,);", 7954 "(a,b,c,);",
7955 NULL 7955 NULL
7956 }; 7956 };
7957 // clang-format on 7957 // clang-format on
7958 7958
7959 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; 7959 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas};
7960 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 7960 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
7961 arraysize(always_flags)); 7961 arraysize(always_flags));
7962 } 7962 }
OLDNEW
« no previous file with comments | « src/parsing/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698