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

Side by Side Diff: tools/parser-shell.cc

Issue 974213002: Extract ParseInfo from CompilationInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/test-serialize.cc ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 source_handle = v8::String::NewExternal(isolate, string_resource); 81 source_handle = v8::String::NewExternal(isolate, string_resource);
82 break; 82 break;
83 } 83 }
84 } 84 }
85 v8::base::TimeDelta parse_time1, parse_time2; 85 v8::base::TimeDelta parse_time1, parse_time2;
86 Handle<Script> script = Isolate::Current()->factory()->NewScript( 86 Handle<Script> script = Isolate::Current()->factory()->NewScript(
87 v8::Utils::OpenHandle(*source_handle)); 87 v8::Utils::OpenHandle(*source_handle));
88 i::ScriptData* cached_data_impl = NULL; 88 i::ScriptData* cached_data_impl = NULL;
89 // First round of parsing (produce data to cache). 89 // First round of parsing (produce data to cache).
90 { 90 {
91 CompilationInfoWithZone info(script); 91 Zone zone;
92 info.MarkAsGlobal(); 92 ParseInfo info(&zone);
93 info.SetCachedData(&cached_data_impl, 93 info.InitializeFromScript(script);
94 v8::ScriptCompiler::kProduceParserCache); 94 info.set_global();
95 info.set_cached_data(&cached_data_impl);
96 info.set_compile_options(v8::ScriptCompiler::kProduceParserCache);
95 v8::base::ElapsedTimer timer; 97 v8::base::ElapsedTimer timer;
96 timer.Start(); 98 timer.Start();
97 // Allow lazy parsing; otherwise we won't produce cached data. 99 // Allow lazy parsing; otherwise we won't produce cached data.
98 bool success = Parser::ParseStatic(&info, true); 100 info.set_allow_lazy_parsing();
101 bool success = Parser::ParseStatic(&info);
99 parse_time1 = timer.Elapsed(); 102 parse_time1 = timer.Elapsed();
100 if (!success) { 103 if (!success) {
101 fprintf(stderr, "Parsing failed\n"); 104 fprintf(stderr, "Parsing failed\n");
102 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); 105 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta());
103 } 106 }
104 } 107 }
105 // Second round of parsing (consume cached data). 108 // Second round of parsing (consume cached data).
106 { 109 {
107 CompilationInfoWithZone info(script); 110 Zone zone;
108 info.MarkAsGlobal(); 111 ParseInfo info(&zone);
109 info.SetCachedData(&cached_data_impl, 112 info.InitializeFromScript(script);
110 v8::ScriptCompiler::kConsumeParserCache); 113 info.set_global();
114 info.set_cached_data(&cached_data_impl);
115 info.set_compile_options(v8::ScriptCompiler::kConsumeParserCache);
111 v8::base::ElapsedTimer timer; 116 v8::base::ElapsedTimer timer;
112 timer.Start(); 117 timer.Start();
113 // Allow lazy parsing; otherwise cached data won't help. 118 // Allow lazy parsing; otherwise cached data won't help.
114 bool success = Parser::ParseStatic(&info, true); 119 info.set_allow_lazy_parsing();
120 bool success = Parser::ParseStatic(&info);
115 parse_time2 = timer.Elapsed(); 121 parse_time2 = timer.Elapsed();
116 if (!success) { 122 if (!success) {
117 fprintf(stderr, "Parsing failed\n"); 123 fprintf(stderr, "Parsing failed\n");
118 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); 124 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta());
119 } 125 }
120 } 126 }
121 return std::make_pair(parse_time1, parse_time2); 127 return std::make_pair(parse_time1, parse_time2);
122 } 128 }
123 129
124 130
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 first_parse_total); 177 first_parse_total);
172 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), 178 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(),
173 second_parse_total); 179 second_parse_total);
174 } 180 }
175 } 181 }
176 v8::V8::Dispose(); 182 v8::V8::Dispose();
177 v8::V8::ShutdownPlatform(); 183 v8::V8::ShutdownPlatform();
178 delete platform; 184 delete platform;
179 return 0; 185 return 0;
180 } 186 }
OLDNEW
« no previous file with comments | « test/cctest/test-serialize.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698