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

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

Issue 2678393002: 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 i::SNPrintF(lazy_program + prefix_len + inner_function_len + params_len + 311 i::SNPrintF(lazy_program + prefix_len + inner_function_len + params_len +
312 source_len, 312 source_len,
313 "%s", suffix); 313 "%s", suffix);
314 314
315 i::Handle<i::String> source = 315 i::Handle<i::String> source =
316 factory->InternalizeUtf8String(lazy_program.start()); 316 factory->InternalizeUtf8String(lazy_program.start());
317 source->PrintOn(stdout); 317 source->PrintOn(stdout);
318 printf("\n"); 318 printf("\n");
319 319
320 i::Handle<i::Script> script = factory->NewScript(source); 320 i::Handle<i::Script> script = factory->NewScript(source);
321 i::ParseInfo lazy_info(script); 321 i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
322 i::ParseInfo lazy_info(&zone, script);
322 323
323 // No need to run scope analysis; preparser scope data is produced when 324 // No need to run scope analysis; preparser scope data is produced when
324 // parsing. 325 // parsing.
325 CHECK(i::parsing::ParseProgram(&lazy_info)); 326 CHECK(i::parsing::ParseProgram(&lazy_info));
326 327
327 // Then parse eagerly and check against the scope data. 328 // Then parse eagerly and check against the scope data.
328 inner_function = eager_inner; 329 inner_function = eager_inner;
329 inner_function_len = Utf8LengthHelper(inner_function) - 4; 330 inner_function_len = Utf8LengthHelper(inner_function) - 4;
330 len = 331 len =
331 prefix_len + inner_function_len + params_len + source_len + suffix_len; 332 prefix_len + inner_function_len + params_len + source_len + suffix_len;
332 333
333 i::ScopedVector<char> eager_program(len + 1); 334 i::ScopedVector<char> eager_program(len + 1);
334 i::SNPrintF(eager_program, "%s", prefix); 335 i::SNPrintF(eager_program, "%s", prefix);
335 i::SNPrintF(eager_program + prefix_len, inner_function, inners[i].params, 336 i::SNPrintF(eager_program + prefix_len, inner_function, inners[i].params,
336 inners[i].source); 337 inners[i].source);
337 i::SNPrintF(eager_program + prefix_len + inner_function_len + params_len + 338 i::SNPrintF(eager_program + prefix_len + inner_function_len + params_len +
338 source_len, 339 source_len,
339 "%s", suffix); 340 "%s", suffix);
340 341
341 source = factory->InternalizeUtf8String(eager_program.start()); 342 source = factory->InternalizeUtf8String(eager_program.start());
342 source->PrintOn(stdout); 343 source->PrintOn(stdout);
343 printf("\n"); 344 printf("\n");
344 345
345 script = factory->NewScript(source); 346 script = factory->NewScript(source);
346 i::ParseInfo eager_info(script); 347 i::ParseInfo eager_info(&zone, script);
347 eager_info.set_allow_lazy_parsing(false); 348 eager_info.set_allow_lazy_parsing(false);
348 349
349 CHECK(i::parsing::ParseProgram(&eager_info)); 350 CHECK(i::parsing::ParseProgram(&eager_info));
350 CHECK(i::Compiler::Analyze(&eager_info)); 351 CHECK(i::Compiler::Analyze(&eager_info));
351 352
352 i::Scope* scope = 353 i::Scope* scope =
353 eager_info.literal()->scope()->inner_scope()->inner_scope(); 354 eager_info.literal()->scope()->inner_scope()->inner_scope();
354 DCHECK_NOT_NULL(scope); 355 DCHECK_NOT_NULL(scope);
355 DCHECK_NULL(scope->sibling()); 356 DCHECK_NULL(scope->sibling());
356 DCHECK(scope->is_function_scope()); 357 DCHECK(scope->is_function_scope());
357 358
358 size_t index = 0; 359 size_t index = 0;
359 i::ScopeTestHelper::CompareScopeToData( 360 i::ScopeTestHelper::CompareScopeToData(
360 scope, lazy_info.preparsed_scope_data(), index); 361 scope, lazy_info.preparsed_scope_data(), index);
361 } 362 }
362 } 363 }
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