Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: test/cctest/test-parsing.cc

Issue 231073002: WIP: Parser: delay string internalization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: more cleanup Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-ast.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 "v8.h" 32 #include "v8.h"
33 33
34 #include "ast-string-table.h"
34 #include "cctest.h" 35 #include "cctest.h"
35 #include "compiler.h" 36 #include "compiler.h"
36 #include "execution.h" 37 #include "execution.h"
37 #include "isolate.h" 38 #include "isolate.h"
38 #include "objects.h" 39 #include "objects.h"
39 #include "parser.h" 40 #include "parser.h"
40 #include "preparser.h" 41 #include "preparser.h"
41 #include "scanner-character-streams.h" 42 #include "scanner-character-streams.h"
42 #include "token.h" 43 #include "token.h"
43 #include "utils.h" 44 #include "utils.h"
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
799 i::Handle<i::String> val = 800 i::AstStringTable string_table(NULL);
800 scanner.AllocateInternalizedString(CcTest::i_isolate()); 801 string_table.Internalize(CcTest::i_isolate());
802 i::Handle<i::String> val = scanner.CurrentSymbol(&string_table)->string();
801 i::DisallowHeapAllocation no_alloc; 803 i::DisallowHeapAllocation no_alloc;
802 i::String::FlatContent content = val->GetFlatContent(); 804 i::String::FlatContent content = val->GetFlatContent();
803 CHECK(content.IsAscii()); 805 CHECK(content.IsAscii());
804 i::Vector<const uint8_t> actual = content.ToOneByteVector(); 806 i::Vector<const uint8_t> actual = content.ToOneByteVector();
805 for (int i = 0; i < actual.length(); i++) { 807 for (int i = 0; i < actual.length(); i++) {
806 CHECK_NE('\0', expected[i]); 808 CHECK_NE('\0', expected[i]);
807 CHECK_EQ(expected[i], actual[i]); 809 CHECK_EQ(expected[i], actual[i]);
808 } 810 }
809 } 811 }
810 812
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); 2452 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError);
2451 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, 2453 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment,
2452 kError); 2454 kError);
2453 2455
2454 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); 2456 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess);
2455 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); 2457 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError);
2456 2458
2457 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); 2459 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess);
2458 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); 2460 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError);
2459 } 2461 }
OLDNEW
« no previous file with comments | « test/cctest/test-ast.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698