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

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

Issue 2065453002: [module] Track script "module code" status Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Extend compilation cache to recognize module code Created 4 years, 6 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
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 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 i::PreParser::PreParseResult result = 1565 i::PreParser::PreParseResult result =
1566 preparser.PreParseProgram(&preparser_materialized_literals, is_module); 1566 preparser.PreParseProgram(&preparser_materialized_literals, is_module);
1567 CHECK_EQ(i::PreParser::kPreParseSuccess, result); 1567 CHECK_EQ(i::PreParser::kPreParseSuccess, result);
1568 } 1568 }
1569 bool preparse_error = log.HasError(); 1569 bool preparse_error = log.HasError();
1570 1570
1571 // Parse the data 1571 // Parse the data
1572 i::FunctionLiteral* function; 1572 i::FunctionLiteral* function;
1573 { 1573 {
1574 i::Handle<i::Script> script = factory->NewScript(source); 1574 i::Handle<i::Script> script = factory->NewScript(source);
1575 script->set_is_module(is_module);
1575 i::Zone zone(CcTest::i_isolate()->allocator()); 1576 i::Zone zone(CcTest::i_isolate()->allocator());
1576 i::ParseInfo info(&zone, script); 1577 i::ParseInfo info(&zone, script);
1577 i::Parser parser(&info); 1578 i::Parser parser(&info);
1578 SetParserFlags(&parser, flags); 1579 SetParserFlags(&parser, flags);
1579 if (is_module) { 1580 if (!is_module) {
1580 info.set_module();
1581 } else {
1582 info.set_global(); 1581 info.set_global();
1583 } 1582 }
1584 parser.Parse(&info); 1583 parser.Parse(&info);
1585 function = info.literal(); 1584 function = info.literal();
1586 if (function) { 1585 if (function) {
1587 parser_materialized_literals = function->materialized_literal_count(); 1586 parser_materialized_literals = function->materialized_literal_count();
1588 } 1587 }
1589 } 1588 }
1590 1589
1591 // Check that preparsing fails iff parsing fails. 1590 // Check that preparsing fails iff parsing fails.
(...skipping 6190 matching lines...) Expand 10 before | Expand all | Expand 10 after
7782 NULL}; 7781 NULL};
7783 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; 7782 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait};
7784 // The preparser doesn't enforce the restriction, so turn it off. 7783 // The preparser doesn't enforce the restriction, so turn it off.
7785 bool test_preparser = false; 7784 bool test_preparser = false;
7786 RunParserSyncTest(block_context_data, error_data, kError, NULL, 0, 7785 RunParserSyncTest(block_context_data, error_data, kError, NULL, 0,
7787 always_flags, arraysize(always_flags), NULL, 0, false, 7786 always_flags, arraysize(always_flags), NULL, 0, false,
7788 test_preparser); 7787 test_preparser);
7789 RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0, 7788 RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0,
7790 always_flags, arraysize(always_flags)); 7789 always_flags, arraysize(always_flags));
7791 } 7790 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698