OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 static const int kAllUtf8CharsSize = | 571 static const int kAllUtf8CharsSize = |
572 (unibrow::Utf8::kMaxOneByteChar + 1) + | 572 (unibrow::Utf8::kMaxOneByteChar + 1) + |
573 (unibrow::Utf8::kMaxTwoByteChar - unibrow::Utf8::kMaxOneByteChar) * 2 + | 573 (unibrow::Utf8::kMaxTwoByteChar - unibrow::Utf8::kMaxOneByteChar) * 2 + |
574 (unibrow::Utf8::kMaxThreeByteChar - unibrow::Utf8::kMaxTwoByteChar) * 3; | 574 (unibrow::Utf8::kMaxThreeByteChar - unibrow::Utf8::kMaxTwoByteChar) * 3; |
575 static const unsigned kAllUtf8CharsSizeU = | 575 static const unsigned kAllUtf8CharsSizeU = |
576 static_cast<unsigned>(kAllUtf8CharsSize); | 576 static_cast<unsigned>(kAllUtf8CharsSize); |
577 | 577 |
578 char buffer[kAllUtf8CharsSizeU]; | 578 char buffer[kAllUtf8CharsSizeU]; |
579 unsigned cursor = 0; | 579 unsigned cursor = 0; |
580 for (int i = 0; i <= kMaxUC16Char; i++) { | 580 for (int i = 0; i <= kMaxUC16Char; i++) { |
| 581 // @TODO Fix this Utf8::Encode call site somehow. |
581 cursor += unibrow::Utf8::Encode(buffer + cursor, | 582 cursor += unibrow::Utf8::Encode(buffer + cursor, |
582 i, | 583 i, |
583 unibrow::Utf16::kNoPreviousCharacter); | 584 unibrow::Utf16::kNoPreviousCharacter); |
584 } | 585 } |
585 ASSERT(cursor == kAllUtf8CharsSizeU); | 586 ASSERT(cursor == kAllUtf8CharsSizeU); |
586 | 587 |
587 i::Utf8ToUtf16CharacterStream stream(reinterpret_cast<const i::byte*>(buffer), | 588 i::Utf8ToUtf16CharacterStream stream(reinterpret_cast<const i::byte*>(buffer), |
588 kAllUtf8CharsSizeU); | 589 kAllUtf8CharsSizeU); |
589 for (int i = 0; i <= kMaxUC16Char; i++) { | 590 for (int i = 0; i <= kMaxUC16Char; i++) { |
590 CHECK_EQU(i, stream.pos()); | 591 CHECK_EQU(i, stream.pos()); |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 " b = function() { \n" | 1330 " b = function() { \n" |
1330 " 01; \n" | 1331 " 01; \n" |
1331 " }; \n" | 1332 " }; \n" |
1332 "}; \n"; | 1333 "}; \n"; |
1333 v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script)); | 1334 v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script)); |
1334 CHECK(try_catch.HasCaught()); | 1335 CHECK(try_catch.HasCaught()); |
1335 v8::String::Utf8Value exception(try_catch.Exception()); | 1336 v8::String::Utf8Value exception(try_catch.Exception()); |
1336 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", | 1337 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", |
1337 *exception); | 1338 *exception); |
1338 } | 1339 } |
OLD | NEW |