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

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

Issue 8662037: Don't preparse large files to find boundaries of lazy functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 int length = i::OS::SNPrintF(program, "%s%s%s", 848 int length = i::OS::SNPrintF(program, "%s%s%s",
849 source_data[i].outer_prefix, 849 source_data[i].outer_prefix,
850 source_data[i].inner_source, 850 source_data[i].inner_source,
851 source_data[i].outer_suffix); 851 source_data[i].outer_suffix);
852 CHECK(length == kProgramSize); 852 CHECK(length == kProgramSize);
853 853
854 // Parse program source. 854 // Parse program source.
855 i::Handle<i::String> source( 855 i::Handle<i::String> source(
856 FACTORY->NewStringFromAscii(i::CStrVector(program.start()))); 856 FACTORY->NewStringFromAscii(i::CStrVector(program.start())));
857 i::Handle<i::Script> script = FACTORY->NewScript(source); 857 i::Handle<i::Script> script = FACTORY->NewScript(source);
858 i::Parser parser(script, false, NULL, NULL); 858 i::Parser parser(script, i::kAllowLazy, NULL, NULL);
859 parser.SetHarmonyScoping(true); 859 parser.SetHarmonyScoping(true);
860 i::CompilationInfo info(script); 860 i::CompilationInfo info(script);
861 info.MarkAsGlobal(); 861 info.MarkAsGlobal();
862 i::FunctionLiteral* function = parser.ParseProgram(&info); 862 i::FunctionLiteral* function = parser.ParseProgram(&info);
863 CHECK(function != NULL); 863 CHECK(function != NULL);
864 864
865 // Check scope types and positions. 865 // Check scope types and positions.
866 i::Scope* scope = function->scope(); 866 i::Scope* scope = function->scope();
867 CHECK(scope->is_global_scope()); 867 CHECK(scope->is_global_scope());
868 CHECK_EQ(scope->start_position(), 0); 868 CHECK_EQ(scope->start_position(), 0);
869 CHECK_EQ(scope->end_position(), kProgramSize); 869 CHECK_EQ(scope->end_position(), kProgramSize);
870 CHECK_EQ(scope->inner_scopes()->length(), 1); 870 CHECK_EQ(scope->inner_scopes()->length(), 1);
871 871
872 i::Scope* inner_scope = scope->inner_scopes()->at(0); 872 i::Scope* inner_scope = scope->inner_scopes()->at(0);
873 CHECK_EQ(inner_scope->type(), source_data[i].scope_type); 873 CHECK_EQ(inner_scope->type(), source_data[i].scope_type);
874 CHECK_EQ(inner_scope->start_position(), kPrefixLen); 874 CHECK_EQ(inner_scope->start_position(), kPrefixLen);
875 // The end position of a token is one position after the last 875 // The end position of a token is one position after the last
876 // character belonging to that token. 876 // character belonging to that token.
877 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen); 877 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen);
878 } 878 }
879 } 879 }
OLDNEW
« src/parser.cc ('K') | « src/preparser.cc ('k') | test/mjsunit/regress/regress-1110.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698