| 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 i::Utf8ToUtf16CharacterStream stream( | 795 i::Utf8ToUtf16CharacterStream stream( |
| 796 reinterpret_cast<const i::byte*>(re_source), | 796 reinterpret_cast<const i::byte*>(re_source), |
| 797 static_cast<unsigned>(strlen(re_source))); | 797 static_cast<unsigned>(strlen(re_source))); |
| 798 i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); | 798 i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); |
| 799 scanner.Initialize(&stream); | 799 scanner.Initialize(&stream); |
| 800 | 800 |
| 801 i::Token::Value start = scanner.peek(); | 801 i::Token::Value start = scanner.peek(); |
| 802 CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV); | 802 CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV); |
| 803 CHECK(scanner.ScanRegExpPattern(start == i::Token::ASSIGN_DIV)); | 803 CHECK(scanner.ScanRegExpPattern(start == i::Token::ASSIGN_DIV)); |
| 804 scanner.Next(); // Current token is now the regexp literal. | 804 scanner.Next(); // Current token is now the regexp literal. |
| 805 CHECK(scanner.is_literal_ascii()); | 805 CHECK(scanner.is_literal_one_byte()); |
| 806 i::Vector<const char> actual = scanner.literal_ascii_string(); | 806 i::Vector<const char> actual = scanner.literal_one_byte_string(); |
| 807 for (int i = 0; i < actual.length(); i++) { | 807 for (int i = 0; i < actual.length(); i++) { |
| 808 CHECK_NE('\0', expected[i]); | 808 CHECK_NE('\0', expected[i]); |
| 809 CHECK_EQ(expected[i], actual[i]); | 809 CHECK_EQ(expected[i], actual[i]); |
| 810 } | 810 } |
| 811 } | 811 } |
| 812 | 812 |
| 813 | 813 |
| 814 TEST(RegExpScanning) { | 814 TEST(RegExpScanning) { |
| 815 v8::V8::Initialize(); | 815 v8::V8::Initialize(); |
| 816 | 816 |
| (...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2344 | 2344 |
| 2345 const char* statement_data[] = { | 2345 const char* statement_data[] = { |
| 2346 statement, | 2346 statement, |
| 2347 NULL | 2347 NULL |
| 2348 }; | 2348 }; |
| 2349 | 2349 |
| 2350 // The test is quite slow, so run it with a reduced set of flags. | 2350 // The test is quite slow, so run it with a reduced set of flags. |
| 2351 static const ParserFlag empty_flags[] = {kAllowLazy}; | 2351 static const ParserFlag empty_flags[] = {kAllowLazy}; |
| 2352 RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1); | 2352 RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1); |
| 2353 } | 2353 } |
| OLD | NEW |