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

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

Issue 2632123006: Reland: [Parse] ParseInfo owns the parsing Zone. (Closed)
Patch Set: Rebase 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/unittests/compiler-dispatcher/optimizing-compile-dispatcher-unittest.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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 break; 87 break;
88 } 88 }
89 } 89 }
90 v8::base::TimeDelta parse_time1, parse_time2; 90 v8::base::TimeDelta parse_time1, parse_time2;
91 Handle<Script> script = 91 Handle<Script> script =
92 reinterpret_cast<i::Isolate*>(isolate)->factory()->NewScript( 92 reinterpret_cast<i::Isolate*>(isolate)->factory()->NewScript(
93 v8::Utils::OpenHandle(*source_handle)); 93 v8::Utils::OpenHandle(*source_handle));
94 i::ScriptData* cached_data_impl = NULL; 94 i::ScriptData* cached_data_impl = NULL;
95 // First round of parsing (produce data to cache). 95 // First round of parsing (produce data to cache).
96 { 96 {
97 Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator(), ZONE_NAME); 97 ParseInfo info(script);
98 ParseInfo info(&zone, script);
99 info.set_cached_data(&cached_data_impl); 98 info.set_cached_data(&cached_data_impl);
100 info.set_compile_options(v8::ScriptCompiler::kProduceParserCache); 99 info.set_compile_options(v8::ScriptCompiler::kProduceParserCache);
101 v8::base::ElapsedTimer timer; 100 v8::base::ElapsedTimer timer;
102 timer.Start(); 101 timer.Start();
103 bool success = parsing::ParseProgram(&info); 102 bool success = parsing::ParseProgram(&info);
104 parse_time1 = timer.Elapsed(); 103 parse_time1 = timer.Elapsed();
105 if (!success) { 104 if (!success) {
106 fprintf(stderr, "Parsing failed\n"); 105 fprintf(stderr, "Parsing failed\n");
107 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); 106 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta());
108 } 107 }
109 } 108 }
110 // Second round of parsing (consume cached data). 109 // Second round of parsing (consume cached data).
111 { 110 {
112 Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator(), ZONE_NAME); 111 ParseInfo info(script);
113 ParseInfo info(&zone, script);
114 info.set_cached_data(&cached_data_impl); 112 info.set_cached_data(&cached_data_impl);
115 info.set_compile_options(v8::ScriptCompiler::kConsumeParserCache); 113 info.set_compile_options(v8::ScriptCompiler::kConsumeParserCache);
116 v8::base::ElapsedTimer timer; 114 v8::base::ElapsedTimer timer;
117 timer.Start(); 115 timer.Start();
118 bool success = parsing::ParseProgram(&info); 116 bool success = parsing::ParseProgram(&info);
119 parse_time2 = timer.Elapsed(); 117 parse_time2 = timer.Elapsed();
120 if (!success) { 118 if (!success) {
121 fprintf(stderr, "Parsing failed\n"); 119 fprintf(stderr, "Parsing failed\n");
122 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); 120 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta());
123 } 121 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), 179 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(),
182 second_parse_total); 180 second_parse_total);
183 } 181 }
184 } 182 }
185 v8::V8::Dispose(); 183 v8::V8::Dispose();
186 v8::V8::ShutdownPlatform(); 184 v8::V8::ShutdownPlatform();
187 delete platform; 185 delete platform;
188 delete create_params.array_buffer_allocator; 186 delete create_params.array_buffer_allocator;
189 return 0; 187 return 0;
190 } 188 }
OLDNEW
« no previous file with comments | « test/unittests/compiler-dispatcher/optimizing-compile-dispatcher-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698