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

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

Issue 2165923002: Inline Scope::Initialize into the only constructor that's always called right before (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/parser-base.h ('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 3344 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, nullptr, i::SCRIPT_SCOPE); 3364 new (&zone) i::Scope(&zone, nullptr, i::SCRIPT_SCOPE);
3365 script_scope->Initialize();
3366 i::Scope* s = i::Scope::DeserializeScopeChain(isolate, &zone, context, 3365 i::Scope* s = i::Scope::DeserializeScopeChain(isolate, &zone, context,
3367 script_scope, &avf); 3366 script_scope, &avf);
3368 CHECK(s != script_scope); 3367 CHECK(s != script_scope);
3369 CHECK(name != NULL); 3368 CHECK(name != NULL);
3370 3369
3371 // Get result from h's function context (that is f's context) 3370 // Get result from h's function context (that is f's context)
3372 i::Variable* var = s->Lookup(name); 3371 i::Variable* var = s->Lookup(name);
3373 3372
3374 CHECK(var != NULL); 3373 CHECK(var != NULL);
3375 // Maybe assigned should survive deserialization 3374 // Maybe assigned should survive deserialization
(...skipping 27 matching lines...) Expand all
3403 i::Zone zone(CcTest::i_isolate()->allocator()); 3402 i::Zone zone(CcTest::i_isolate()->allocator());
3404 v8::Local<v8::Value> v = CompileRun(src); 3403 v8::Local<v8::Value> v = CompileRun(src);
3405 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); 3404 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
3406 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); 3405 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
3407 i::Context* context = f->context(); 3406 i::Context* context = f->context();
3408 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); 3407 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed());
3409 avf.Internalize(isolate); 3408 avf.Internalize(isolate);
3410 3409
3411 i::Scope* script_scope = 3410 i::Scope* script_scope =
3412 new (&zone) i::Scope(&zone, nullptr, i::SCRIPT_SCOPE); 3411 new (&zone) i::Scope(&zone, nullptr, i::SCRIPT_SCOPE);
3413 script_scope->Initialize();
3414 i::Scope* s = i::Scope::DeserializeScopeChain(isolate, &zone, context, 3412 i::Scope* s = i::Scope::DeserializeScopeChain(isolate, &zone, context,
3415 script_scope, &avf); 3413 script_scope, &avf);
3416 CHECK(s != script_scope); 3414 CHECK(s != script_scope);
3417 const i::AstRawString* name_x = avf.GetOneByteString("x"); 3415 const i::AstRawString* name_x = avf.GetOneByteString("x");
3418 3416
3419 // Get result from f's function context (that is g's outer context) 3417 // Get result from f's function context (that is g's outer context)
3420 i::Variable* var_x = s->Lookup(name_x); 3418 i::Variable* var_x = s->Lookup(name_x);
3421 CHECK(var_x != NULL); 3419 CHECK(var_x != NULL);
3422 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); 3420 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned);
3423 } 3421 }
(...skipping 4529 matching lines...) Expand 10 before | Expand all | Expand 10 after
7953 "(a,);", 7951 "(a,);",
7954 "(a,b,c,);", 7952 "(a,b,c,);",
7955 NULL 7953 NULL
7956 }; 7954 };
7957 // clang-format on 7955 // clang-format on
7958 7956
7959 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; 7957 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas};
7960 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 7958 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
7961 arraysize(always_flags)); 7959 arraysize(always_flags));
7962 } 7960 }
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698