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

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

Issue 1847543002: Expose a lower bound of malloc'd memory via heap statistics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 8 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 | « tools/gyp/v8.gyp ('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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 break; 95 break;
96 } 96 }
97 } 97 }
98 v8::base::TimeDelta parse_time1, parse_time2; 98 v8::base::TimeDelta parse_time1, parse_time2;
99 Handle<Script> script = 99 Handle<Script> script =
100 reinterpret_cast<i::Isolate*>(isolate)->factory()->NewScript( 100 reinterpret_cast<i::Isolate*>(isolate)->factory()->NewScript(
101 v8::Utils::OpenHandle(*source_handle)); 101 v8::Utils::OpenHandle(*source_handle));
102 i::ScriptData* cached_data_impl = NULL; 102 i::ScriptData* cached_data_impl = NULL;
103 // First round of parsing (produce data to cache). 103 // First round of parsing (produce data to cache).
104 { 104 {
105 Zone zone; 105 Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator());
106 ParseInfo info(&zone, script); 106 ParseInfo info(&zone, script);
107 info.set_global(); 107 info.set_global();
108 info.set_cached_data(&cached_data_impl); 108 info.set_cached_data(&cached_data_impl);
109 info.set_compile_options(v8::ScriptCompiler::kProduceParserCache); 109 info.set_compile_options(v8::ScriptCompiler::kProduceParserCache);
110 v8::base::ElapsedTimer timer; 110 v8::base::ElapsedTimer timer;
111 timer.Start(); 111 timer.Start();
112 // Allow lazy parsing; otherwise we won't produce cached data. 112 // Allow lazy parsing; otherwise we won't produce cached data.
113 info.set_allow_lazy_parsing(); 113 info.set_allow_lazy_parsing();
114 bool success = Parser::ParseStatic(&info); 114 bool success = Parser::ParseStatic(&info);
115 parse_time1 = timer.Elapsed(); 115 parse_time1 = timer.Elapsed();
116 if (!success) { 116 if (!success) {
117 fprintf(stderr, "Parsing failed\n"); 117 fprintf(stderr, "Parsing failed\n");
118 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); 118 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta());
119 } 119 }
120 } 120 }
121 // Second round of parsing (consume cached data). 121 // Second round of parsing (consume cached data).
122 { 122 {
123 Zone zone; 123 Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator());
124 ParseInfo info(&zone, script); 124 ParseInfo info(&zone, script);
125 info.set_global(); 125 info.set_global();
126 info.set_cached_data(&cached_data_impl); 126 info.set_cached_data(&cached_data_impl);
127 info.set_compile_options(v8::ScriptCompiler::kConsumeParserCache); 127 info.set_compile_options(v8::ScriptCompiler::kConsumeParserCache);
128 v8::base::ElapsedTimer timer; 128 v8::base::ElapsedTimer timer;
129 timer.Start(); 129 timer.Start();
130 // Allow lazy parsing; otherwise cached data won't help. 130 // Allow lazy parsing; otherwise cached data won't help.
131 info.set_allow_lazy_parsing(); 131 info.set_allow_lazy_parsing();
132 bool success = Parser::ParseStatic(&info); 132 bool success = Parser::ParseStatic(&info);
133 parse_time2 = timer.Elapsed(); 133 parse_time2 = timer.Elapsed();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 first_parse_total); 194 first_parse_total);
195 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), 195 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(),
196 second_parse_total); 196 second_parse_total);
197 } 197 }
198 } 198 }
199 v8::V8::Dispose(); 199 v8::V8::Dispose();
200 v8::V8::ShutdownPlatform(); 200 v8::V8::ShutdownPlatform();
201 delete platform; 201 delete platform;
202 return 0; 202 return 0;
203 } 203 }
OLDNEW
« no previous file with comments | « tools/gyp/v8.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698