| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 &experimental_tokens, repeat, harmony_settings); | 288 &experimental_tokens, repeat, harmony_settings); |
| 289 break; | 289 break; |
| 290 case UTF16: | 290 case UTF16: |
| 291 case UTF8TO16: { | 291 case UTF8TO16: { |
| 292 const uc16* buffer_16 = reinterpret_cast<const uc16*>(buffer); | 292 const uc16* buffer_16 = reinterpret_cast<const uc16*>(buffer); |
| 293 const uc16* buffer_end_16 = reinterpret_cast<const uc16*>(buffer_end); | 293 const uc16* buffer_end_16 = reinterpret_cast<const uc16*>(buffer_end); |
| 294 source = isolate->factory()->NewStringFromTwoByte( | 294 source = isolate->factory()->NewStringFromTwoByte( |
| 295 Vector<const uc16>(buffer_16, buffer_end_16 - buffer_16)); | 295 Vector<const uc16>(buffer_16, buffer_end_16 - buffer_16)); |
| 296 // If the string was just an expaneded one byte string, V8 detects it | 296 // If the string was just an expaneded one byte string, V8 detects it |
| 297 // and doesn't store it as two byte. | 297 // and doesn't store it as two byte. |
| 298 CHECK(source->IsTwoByteRepresentation()); | 298 if (!source->IsTwoByteRepresentation()) { |
| 299 experimental_time = RunExperimentalScanner<uint16_t>( | 299 experimental_time = RunExperimentalScanner<uint8_t>( |
| 300 source, isolate, encoding, print_tokens || check_tokens, | 300 source, isolate, encoding, print_tokens || check_tokens, |
| 301 &experimental_tokens, repeat, harmony_settings); | 301 &experimental_tokens, repeat, harmony_settings); |
| 302 } else { |
| 303 experimental_time = RunExperimentalScanner<uint16_t>( |
| 304 source, isolate, encoding, print_tokens || check_tokens, |
| 305 &experimental_tokens, repeat, harmony_settings); |
| 306 } |
| 302 break; | 307 break; |
| 303 } | 308 } |
| 304 default: | 309 default: |
| 305 printf("Encoding not supported by the experimental scanner\n"); | 310 printf("Encoding not supported by the experimental scanner\n"); |
| 306 exit(1); | 311 exit(1); |
| 307 break; | 312 break; |
| 308 } | 313 } |
| 309 } | 314 } |
| 310 if (print_tokens && !run_experimental) { | 315 if (print_tokens && !run_experimental) { |
| 311 PrintTokens("Baseline", baseline_tokens); | 316 PrintTokens("Baseline", baseline_tokens); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 if (run_experimental) { | 430 if (run_experimental) { |
| 426 if (benchmark.empty()) benchmark = "Experimental"; | 431 if (benchmark.empty()) benchmark = "Experimental"; |
| 427 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), | 432 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), |
| 428 experimental_total); | 433 experimental_total); |
| 429 } | 434 } |
| 430 } | 435 } |
| 431 } | 436 } |
| 432 v8::V8::Dispose(); | 437 v8::V8::Dispose(); |
| 433 return 0; | 438 return 0; |
| 434 } | 439 } |
| OLD | NEW |