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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 break; | 63 break; |
64 } | 64 } |
65 case LATIN1: { | 65 case LATIN1: { |
66 source_handle = v8::String::NewFromOneByte(isolate, source); | 66 source_handle = v8::String::NewFromOneByte(isolate, source); |
67 break; | 67 break; |
68 } | 68 } |
69 } | 69 } |
70 TimeDelta parse_time1, parse_time2; | 70 TimeDelta parse_time1, parse_time2; |
71 Handle<Script> script = Isolate::Current()->factory()->NewScript( | 71 Handle<Script> script = Isolate::Current()->factory()->NewScript( |
72 v8::Utils::OpenHandle(*source_handle)); | 72 v8::Utils::OpenHandle(*source_handle)); |
73 i::ScriptDataImpl* cached_data_impl = NULL; | 73 i::ScriptData* cached_data_impl = NULL; |
74 // First round of parsing (produce data to cache). | 74 // First round of parsing (produce data to cache). |
75 { | 75 { |
76 CompilationInfoWithZone info(script); | 76 CompilationInfoWithZone info(script); |
77 info.MarkAsGlobal(); | 77 info.MarkAsGlobal(); |
78 info.SetCachedData(&cached_data_impl, i::PRODUCE_CACHED_DATA); | 78 info.SetCachedData(&cached_data_impl, i::PRODUCE_CACHED_DATA); |
79 ElapsedTimer timer; | 79 ElapsedTimer timer; |
80 timer.Start(); | 80 timer.Start(); |
81 // Allow lazy parsing; otherwise we won't produce cached data. | 81 // Allow lazy parsing; otherwise we won't produce cached data. |
82 bool success = Parser::Parse(&info, true); | 82 bool success = Parser::Parse(&info, true); |
83 parse_time1 = timer.Elapsed(); | 83 parse_time1 = timer.Elapsed(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (benchmark.empty()) benchmark = "Baseline"; | 147 if (benchmark.empty()) benchmark = "Baseline"; |
148 printf("%s(FirstParseRunTime): %.f ms\n", benchmark.c_str(), | 148 printf("%s(FirstParseRunTime): %.f ms\n", benchmark.c_str(), |
149 first_parse_total); | 149 first_parse_total); |
150 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), | 150 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), |
151 second_parse_total); | 151 second_parse_total); |
152 } | 152 } |
153 } | 153 } |
154 v8::V8::Dispose(); | 154 v8::V8::Dispose(); |
155 return 0; | 155 return 0; |
156 } | 156 } |
OLD | NEW |