| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } else if (i > 0 && argv[i][0] != '-') { | 146 } else if (i > 0 && argv[i][0] != '-') { |
| 147 fnames.push_back(std::string(argv[i])); | 147 fnames.push_back(std::string(argv[i])); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 v8::Isolate* isolate = v8::Isolate::New(); | 150 v8::Isolate* isolate = v8::Isolate::New(); |
| 151 { | 151 { |
| 152 v8::Isolate::Scope isolate_scope(isolate); | 152 v8::Isolate::Scope isolate_scope(isolate); |
| 153 v8::HandleScope handle_scope(isolate); | 153 v8::HandleScope handle_scope(isolate); |
| 154 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); | 154 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); |
| 155 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); | 155 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); |
| 156 ASSERT(!context.IsEmpty()); | 156 DCHECK(!context.IsEmpty()); |
| 157 { | 157 { |
| 158 v8::Context::Scope scope(context); | 158 v8::Context::Scope scope(context); |
| 159 double first_parse_total = 0; | 159 double first_parse_total = 0; |
| 160 double second_parse_total = 0; | 160 double second_parse_total = 0; |
| 161 for (size_t i = 0; i < fnames.size(); i++) { | 161 for (size_t i = 0; i < fnames.size(); i++) { |
| 162 std::pair<v8::base::TimeDelta, v8::base::TimeDelta> time = | 162 std::pair<v8::base::TimeDelta, v8::base::TimeDelta> time = |
| 163 RunBaselineParser(fnames[i].c_str(), encoding, repeat, isolate, | 163 RunBaselineParser(fnames[i].c_str(), encoding, repeat, isolate, |
| 164 context); | 164 context); |
| 165 first_parse_total += time.first.InMillisecondsF(); | 165 first_parse_total += time.first.InMillisecondsF(); |
| 166 second_parse_total += time.second.InMillisecondsF(); | 166 second_parse_total += time.second.InMillisecondsF(); |
| 167 } | 167 } |
| 168 if (benchmark.empty()) benchmark = "Baseline"; | 168 if (benchmark.empty()) benchmark = "Baseline"; |
| 169 printf("%s(FirstParseRunTime): %.f ms\n", benchmark.c_str(), | 169 printf("%s(FirstParseRunTime): %.f ms\n", benchmark.c_str(), |
| 170 first_parse_total); | 170 first_parse_total); |
| 171 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), | 171 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), |
| 172 second_parse_total); | 172 second_parse_total); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 v8::V8::Dispose(); | 175 v8::V8::Dispose(); |
| 176 v8::V8::ShutdownPlatform(); | 176 v8::V8::ShutdownPlatform(); |
| 177 delete platform; | 177 delete platform; |
| 178 return 0; | 178 return 0; |
| 179 } | 179 } |
| OLD | NEW |