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

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

Issue 2683733002: Revert of Reland: [Parse] ParseInfo owns the parsing Zone. (Closed)
Patch Set: Created 3 years, 10 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 | « test/cctest/compiler/test-run-bytecode-graph-builder.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ast/ast.h" 5 #include "src/ast/ast.h"
6 #include "src/compiler.h" 6 #include "src/compiler.h"
7 #include "src/objects-inl.h" 7 #include "src/objects-inl.h"
8 #include "src/parsing/parse-info.h" 8 #include "src/parsing/parse-info.h"
9 #include "src/parsing/parsing.h" 9 #include "src/parsing/parsing.h"
10 10
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 i::SNPrintF(lazy_program + prefix_len + inner_function_len + params_len + 317 i::SNPrintF(lazy_program + prefix_len + inner_function_len + params_len +
318 source_len, 318 source_len,
319 "%s", suffix); 319 "%s", suffix);
320 320
321 i::Handle<i::String> source = 321 i::Handle<i::String> source =
322 factory->InternalizeUtf8String(lazy_program.start()); 322 factory->InternalizeUtf8String(lazy_program.start());
323 source->PrintOn(stdout); 323 source->PrintOn(stdout);
324 printf("\n"); 324 printf("\n");
325 325
326 i::Handle<i::Script> script = factory->NewScript(source); 326 i::Handle<i::Script> script = factory->NewScript(source);
327 i::ParseInfo lazy_info(script); 327 i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
328 i::ParseInfo lazy_info(&zone, script);
328 329
329 // No need to run scope analysis; preparser scope data is produced when 330 // No need to run scope analysis; preparser scope data is produced when
330 // parsing. 331 // parsing.
331 CHECK(i::parsing::ParseProgram(&lazy_info)); 332 CHECK(i::parsing::ParseProgram(&lazy_info));
332 333
333 // Then parse eagerly and check against the scope data. 334 // Then parse eagerly and check against the scope data.
334 inner_function = eager_inner; 335 inner_function = eager_inner;
335 inner_function_len = Utf8LengthHelper(inner_function) - 4; 336 inner_function_len = Utf8LengthHelper(inner_function) - 4;
336 len = 337 len =
337 prefix_len + inner_function_len + params_len + source_len + suffix_len; 338 prefix_len + inner_function_len + params_len + source_len + suffix_len;
338 339
339 i::ScopedVector<char> eager_program(len + 1); 340 i::ScopedVector<char> eager_program(len + 1);
340 i::SNPrintF(eager_program, "%s", prefix); 341 i::SNPrintF(eager_program, "%s", prefix);
341 i::SNPrintF(eager_program + prefix_len, inner_function, inners[i].params, 342 i::SNPrintF(eager_program + prefix_len, inner_function, inners[i].params,
342 inners[i].source); 343 inners[i].source);
343 i::SNPrintF(eager_program + prefix_len + inner_function_len + params_len + 344 i::SNPrintF(eager_program + prefix_len + inner_function_len + params_len +
344 source_len, 345 source_len,
345 "%s", suffix); 346 "%s", suffix);
346 347
347 source = factory->InternalizeUtf8String(eager_program.start()); 348 source = factory->InternalizeUtf8String(eager_program.start());
348 source->PrintOn(stdout); 349 source->PrintOn(stdout);
349 printf("\n"); 350 printf("\n");
350 351
351 script = factory->NewScript(source); 352 script = factory->NewScript(source);
352 i::ParseInfo eager_info(script); 353 i::ParseInfo eager_info(&zone, script);
353 eager_info.set_allow_lazy_parsing(false); 354 eager_info.set_allow_lazy_parsing(false);
354 355
355 CHECK(i::parsing::ParseProgram(&eager_info)); 356 CHECK(i::parsing::ParseProgram(&eager_info));
356 CHECK(i::Compiler::Analyze(&eager_info)); 357 CHECK(i::Compiler::Analyze(&eager_info));
357 358
358 i::Scope* scope = 359 i::Scope* scope =
359 eager_info.literal()->scope()->inner_scope()->inner_scope(); 360 eager_info.literal()->scope()->inner_scope()->inner_scope();
360 DCHECK_NOT_NULL(scope); 361 DCHECK_NOT_NULL(scope);
361 DCHECK_NULL(scope->sibling()); 362 DCHECK_NULL(scope->sibling());
362 DCHECK(scope->is_function_scope()); 363 DCHECK(scope->is_function_scope());
363 364
364 size_t index = 0; 365 size_t index = 0;
365 i::ScopeTestHelper::CompareScopeToData( 366 i::ScopeTestHelper::CompareScopeToData(
366 scope, lazy_info.preparsed_scope_data(), index, 367 scope, lazy_info.preparsed_scope_data(), index,
367 inners[i].precise_maybe_assigned); 368 inners[i].precise_maybe_assigned);
368 } 369 }
369 } 370 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-bytecode-graph-builder.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698