| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 scanner_ = new Scanner(unicode_cache_); | 61 scanner_ = new Scanner(unicode_cache_); |
| 62 switch (encoding) { | 62 switch (encoding) { |
| 63 case UTF8: | 63 case UTF8: |
| 64 stream_ = new Utf8ToUtf16CharacterStream(source_, length); | 64 stream_ = new Utf8ToUtf16CharacterStream(source_, length); |
| 65 break; | 65 break; |
| 66 case UTF16: { | 66 case UTF16: { |
| 67 Handle<String> result = isolate->factory()->NewStringFromTwoByte( | 67 Handle<String> result = isolate->factory()->NewStringFromTwoByte( |
| 68 Vector<const uint16_t>( | 68 Vector<const uint16_t>( |
| 69 reinterpret_cast<const uint16_t*>(source_), | 69 reinterpret_cast<const uint16_t*>(source_), |
| 70 length / 2)); | 70 length / 2)); |
| 71 CHECK_NOT_EMPTY_HANDLE(isolate, result); |
| 71 stream_ = | 72 stream_ = |
| 72 new GenericStringUtf16CharacterStream(result, 0, result->length()); | 73 new GenericStringUtf16CharacterStream(result, 0, result->length()); |
| 73 break; | 74 break; |
| 74 } | 75 } |
| 75 case LATIN1: { | 76 case LATIN1: { |
| 76 Handle<String> result = isolate->factory()->NewStringFromOneByte( | 77 Handle<String> result = isolate->factory()->NewStringFromOneByte( |
| 77 Vector<const uint8_t>(source_, length)); | 78 Vector<const uint8_t>(source_, length)); |
| 79 CHECK_NOT_EMPTY_HANDLE(isolate, result); |
| 78 stream_ = | 80 stream_ = |
| 79 new GenericStringUtf16CharacterStream(result, 0, result->length()); | 81 new GenericStringUtf16CharacterStream(result, 0, result->length()); |
| 80 break; | 82 break; |
| 81 } | 83 } |
| 82 } | 84 } |
| 83 timer->Start(); | 85 timer->Start(); |
| 84 scanner_->Initialize(stream_); | 86 scanner_->Initialize(stream_); |
| 85 } | 87 } |
| 86 | 88 |
| 87 ~BaselineScanner() { | 89 ~BaselineScanner() { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 repeat); | 224 repeat); |
| 223 baseline_total += time.InMillisecondsF(); | 225 baseline_total += time.InMillisecondsF(); |
| 224 } | 226 } |
| 225 if (benchmark.empty()) benchmark = "Baseline"; | 227 if (benchmark.empty()) benchmark = "Baseline"; |
| 226 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), baseline_total); | 228 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), baseline_total); |
| 227 } | 229 } |
| 228 } | 230 } |
| 229 v8::V8::Dispose(); | 231 v8::V8::Dispose(); |
| 230 return 0; | 232 return 0; |
| 231 } | 233 } |
| OLD | NEW |