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 13 matching lines...) Expand all Loading... |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 #include <stdio.h> | 29 #include <stdio.h> |
30 #include <string.h> | 30 #include <string.h> |
31 | 31 |
32 #include "src/v8.h" | 32 #include "src/v8.h" |
33 | 33 |
| 34 #include "src/ast-value-factory.h" |
34 #include "src/compiler.h" | 35 #include "src/compiler.h" |
35 #include "src/execution.h" | 36 #include "src/execution.h" |
36 #include "src/isolate.h" | 37 #include "src/isolate.h" |
37 #include "src/objects.h" | 38 #include "src/objects.h" |
38 #include "src/parser.h" | 39 #include "src/parser.h" |
39 #include "src/preparser.h" | 40 #include "src/preparser.h" |
40 #include "src/scanner-character-streams.h" | 41 #include "src/scanner-character-streams.h" |
41 #include "src/token.h" | 42 #include "src/token.h" |
42 #include "src/utils.h" | 43 #include "src/utils.h" |
43 #include "test/cctest/cctest.h" | 44 #include "test/cctest/cctest.h" |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 reinterpret_cast<const i::byte*>(re_source), | 790 reinterpret_cast<const i::byte*>(re_source), |
790 static_cast<unsigned>(strlen(re_source))); | 791 static_cast<unsigned>(strlen(re_source))); |
791 i::HandleScope scope(CcTest::i_isolate()); | 792 i::HandleScope scope(CcTest::i_isolate()); |
792 i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); | 793 i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); |
793 scanner.Initialize(&stream); | 794 scanner.Initialize(&stream); |
794 | 795 |
795 i::Token::Value start = scanner.peek(); | 796 i::Token::Value start = scanner.peek(); |
796 CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV); | 797 CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV); |
797 CHECK(scanner.ScanRegExpPattern(start == i::Token::ASSIGN_DIV)); | 798 CHECK(scanner.ScanRegExpPattern(start == i::Token::ASSIGN_DIV)); |
798 scanner.Next(); // Current token is now the regexp literal. | 799 scanner.Next(); // Current token is now the regexp literal. |
| 800 i::AstValueFactory ast_value_factory(NULL); |
| 801 ast_value_factory.Internalize(CcTest::i_isolate()); |
799 i::Handle<i::String> val = | 802 i::Handle<i::String> val = |
800 scanner.AllocateInternalizedString(CcTest::i_isolate()); | 803 scanner.CurrentSymbol(&ast_value_factory)->string(); |
801 i::DisallowHeapAllocation no_alloc; | 804 i::DisallowHeapAllocation no_alloc; |
802 i::String::FlatContent content = val->GetFlatContent(); | 805 i::String::FlatContent content = val->GetFlatContent(); |
803 CHECK(content.IsAscii()); | 806 CHECK(content.IsAscii()); |
804 i::Vector<const uint8_t> actual = content.ToOneByteVector(); | 807 i::Vector<const uint8_t> actual = content.ToOneByteVector(); |
805 for (int i = 0; i < actual.length(); i++) { | 808 for (int i = 0; i < actual.length(); i++) { |
806 CHECK_NE('\0', expected[i]); | 809 CHECK_NE('\0', expected[i]); |
807 CHECK_EQ(expected[i], actual[i]); | 810 CHECK_EQ(expected[i], actual[i]); |
808 } | 811 } |
809 } | 812 } |
810 | 813 |
(...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2540 v8::Local<v8::String> source = | 2543 v8::Local<v8::String> source = |
2541 v8::String::NewFromTwoByte(isolate, two_byte_source); | 2544 v8::String::NewFromTwoByte(isolate, two_byte_source); |
2542 v8::Local<v8::Value> result = CompileRun(source); | 2545 v8::Local<v8::Value> result = CompileRun(source); |
2543 CHECK(result->IsString()); | 2546 CHECK(result->IsString()); |
2544 v8::Local<v8::String> expected_name = | 2547 v8::Local<v8::String> expected_name = |
2545 v8::String::NewFromTwoByte(isolate, two_byte_name); | 2548 v8::String::NewFromTwoByte(isolate, two_byte_name); |
2546 CHECK(result->Equals(expected_name)); | 2549 CHECK(result->Equals(expected_name)); |
2547 i::DeleteArray(two_byte_source); | 2550 i::DeleteArray(two_byte_source); |
2548 i::DeleteArray(two_byte_name); | 2551 i::DeleteArray(two_byte_name); |
2549 } | 2552 } |
OLD | NEW |