OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } else if (strncmp(argv[i], "--repeat=", 9) == 0) { | 238 } else if (strncmp(argv[i], "--repeat=", 9) == 0) { |
239 std::string repeat_str = std::string(argv[i]).substr(9); | 239 std::string repeat_str = std::string(argv[i]).substr(9); |
240 repeat = atoi(repeat_str.c_str()); | 240 repeat = atoi(repeat_str.c_str()); |
241 } else if (i > 0 && argv[i][0] != '-') { | 241 } else if (i > 0 && argv[i][0] != '-') { |
242 fnames.push_back(std::string(argv[i])); | 242 fnames.push_back(std::string(argv[i])); |
243 } | 243 } |
244 } | 244 } |
245 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 245 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
246 { | 246 { |
247 v8::HandleScope handle_scope(isolate); | 247 v8::HandleScope handle_scope(isolate); |
248 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); | 248 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); |
249 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); | 249 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); |
250 ASSERT(!context.IsEmpty()); | 250 ASSERT(!context.IsEmpty()); |
251 { | 251 { |
252 v8::Context::Scope scope(context); | 252 v8::Context::Scope scope(context); |
253 Isolate* isolate = Isolate::Current(); | 253 Isolate* isolate = Isolate::Current(); |
254 double baseline_total = 0; | 254 double baseline_total = 0; |
255 for (size_t i = 0; i < fnames.size(); i++) { | 255 for (size_t i = 0; i < fnames.size(); i++) { |
256 TimeDelta time; | 256 TimeDelta time; |
257 time = ProcessFile(fnames[i].c_str(), encoding, isolate, print_tokens, | 257 time = ProcessFile(fnames[i].c_str(), encoding, isolate, print_tokens, |
258 repeat); | 258 repeat); |
259 baseline_total += time.InMillisecondsF(); | 259 baseline_total += time.InMillisecondsF(); |
260 } | 260 } |
261 if (benchmark.empty()) benchmark = "Baseline"; | 261 if (benchmark.empty()) benchmark = "Baseline"; |
262 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), baseline_total); | 262 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), baseline_total); |
263 } | 263 } |
264 } | 264 } |
265 v8::V8::Dispose(); | 265 v8::V8::Dispose(); |
266 return 0; | 266 return 0; |
267 } | 267 } |
OLD | NEW |