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

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: rebased Created 6 years, 7 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
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 19 matching lines...) Expand all
30 #include <string.h> 30 #include <string.h>
31 31
32 #include "v8.h" 32 #include "v8.h"
33 33
34 #include "cctest.h" 34 #include "cctest.h"
35 #include "compiler.h" 35 #include "compiler.h"
36 #include "execution.h" 36 #include "execution.h"
37 #include "isolate.h" 37 #include "isolate.h"
38 #include "objects.h" 38 #include "objects.h"
39 #include "parser.h" 39 #include "parser.h"
40 #include "parser-symbol-table.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"
44 45
45 TEST(ScanKeywords) { 46 TEST(ScanKeywords) {
46 struct KeywordToken { 47 struct KeywordToken {
47 const char* keyword; 48 const char* keyword;
48 i::Token::Value token; 49 i::Token::Value token;
49 }; 50 };
(...skipping 739 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::ParserSymbolTable symbol_table;
800 scanner.AllocateInternalizedString(CcTest::i_isolate()); 801 symbol_table.AlwaysInternalize(CcTest::i_isolate());
802 i::Handle<i::String> val = scanner.CurrentString(&symbol_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 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after
2449 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); 2451 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError);
2450 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, 2452 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment,
2451 kError); 2453 kError);
2452 2454
2453 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); 2455 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess);
2454 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); 2456 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError);
2455 2457
2456 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); 2458 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess);
2457 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); 2459 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError);
2458 } 2460 }
OLDNEW
« src/parser-symbol-table.cc ('K') | « src/variables.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698