OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 #include <stdio.h> | 30 #include <stdio.h> |
31 #include <stdlib.h> | 31 #include <stdlib.h> |
32 #include <string> | 32 #include <string> |
33 #include <vector> | 33 #include <vector> |
34 #include "src/v8.h" | 34 #include "src/v8.h" |
35 | 35 |
36 #include "include/libplatform/libplatform.h" | 36 #include "include/libplatform/libplatform.h" |
37 #include "src/api.h" | 37 #include "src/api.h" |
38 #include "src/compiler.h" | 38 #include "src/compiler.h" |
39 #include "src/parsing/parse-info.h" | 39 #include "src/parsing/parse-info.h" |
40 #include "src/parsing/parser.h" | 40 #include "src/parsing/parsing.h" |
41 #include "src/parsing/preparse-data-format.h" | 41 #include "src/parsing/preparse-data-format.h" |
42 #include "src/parsing/preparse-data.h" | 42 #include "src/parsing/preparse-data.h" |
43 #include "src/parsing/preparser.h" | 43 #include "src/parsing/preparser.h" |
44 #include "src/parsing/scanner-character-streams.h" | 44 #include "src/parsing/scanner-character-streams.h" |
45 #include "tools/shell-utils.h" | 45 #include "tools/shell-utils.h" |
46 | 46 |
47 using namespace v8::internal; | 47 using namespace v8::internal; |
48 | 48 |
49 class StringResource8 : public v8::String::ExternalOneByteStringResource { | 49 class StringResource8 : public v8::String::ExternalOneByteStringResource { |
50 public: | 50 public: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 v8::Utils::OpenHandle(*source_handle)); | 92 v8::Utils::OpenHandle(*source_handle)); |
93 i::ScriptData* cached_data_impl = NULL; | 93 i::ScriptData* cached_data_impl = NULL; |
94 // First round of parsing (produce data to cache). | 94 // First round of parsing (produce data to cache). |
95 { | 95 { |
96 Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator(), ZONE_NAME); | 96 Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator(), ZONE_NAME); |
97 ParseInfo info(&zone, script); | 97 ParseInfo info(&zone, script); |
98 info.set_cached_data(&cached_data_impl); | 98 info.set_cached_data(&cached_data_impl); |
99 info.set_compile_options(v8::ScriptCompiler::kProduceParserCache); | 99 info.set_compile_options(v8::ScriptCompiler::kProduceParserCache); |
100 v8::base::ElapsedTimer timer; | 100 v8::base::ElapsedTimer timer; |
101 timer.Start(); | 101 timer.Start(); |
102 bool success = Parser::ParseStatic(&info); | 102 bool success = parsing::ParseProgram(&info); |
103 parse_time1 = timer.Elapsed(); | 103 parse_time1 = timer.Elapsed(); |
104 if (!success) { | 104 if (!success) { |
105 fprintf(stderr, "Parsing failed\n"); | 105 fprintf(stderr, "Parsing failed\n"); |
106 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); | 106 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); |
107 } | 107 } |
108 } | 108 } |
109 // Second round of parsing (consume cached data). | 109 // Second round of parsing (consume cached data). |
110 { | 110 { |
111 Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator(), ZONE_NAME); | 111 Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator(), ZONE_NAME); |
112 ParseInfo info(&zone, script); | 112 ParseInfo info(&zone, script); |
113 info.set_cached_data(&cached_data_impl); | 113 info.set_cached_data(&cached_data_impl); |
114 info.set_compile_options(v8::ScriptCompiler::kConsumeParserCache); | 114 info.set_compile_options(v8::ScriptCompiler::kConsumeParserCache); |
115 v8::base::ElapsedTimer timer; | 115 v8::base::ElapsedTimer timer; |
116 timer.Start(); | 116 timer.Start(); |
117 bool success = Parser::ParseStatic(&info); | 117 bool success = parsing::ParseProgram(&info); |
118 parse_time2 = timer.Elapsed(); | 118 parse_time2 = timer.Elapsed(); |
119 if (!success) { | 119 if (!success) { |
120 fprintf(stderr, "Parsing failed\n"); | 120 fprintf(stderr, "Parsing failed\n"); |
121 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); | 121 return std::make_pair(v8::base::TimeDelta(), v8::base::TimeDelta()); |
122 } | 122 } |
123 } | 123 } |
124 return std::make_pair(parse_time1, parse_time2); | 124 return std::make_pair(parse_time1, parse_time2); |
125 } | 125 } |
126 | 126 |
127 | 127 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), | 180 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), |
181 second_parse_total); | 181 second_parse_total); |
182 } | 182 } |
183 } | 183 } |
184 v8::V8::Dispose(); | 184 v8::V8::Dispose(); |
185 v8::V8::ShutdownPlatform(); | 185 v8::V8::ShutdownPlatform(); |
186 delete platform; | 186 delete platform; |
187 delete create_params.array_buffer_allocator; | 187 delete create_params.array_buffer_allocator; |
188 return 0; | 188 return 0; |
189 } | 189 } |
OLD | NEW |