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

Side by Side Diff: src/scanner.h

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 | « src/rewriter.cc ('k') | src/scanner.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #ifndef V8_SCANNER_H_ 7 #ifndef V8_SCANNER_H_
8 #define V8_SCANNER_H_ 8 #define V8_SCANNER_H_
9 9
10 #include "allocation.h" 10 #include "allocation.h"
11 #include "char-predicates.h" 11 #include "char-predicates.h"
12 #include "checks.h" 12 #include "checks.h"
13 #include "globals.h" 13 #include "globals.h"
14 #include "hashmap.h" 14 #include "hashmap.h"
15 #include "list.h" 15 #include "list.h"
16 #include "token.h" 16 #include "token.h"
17 #include "unicode-inl.h" 17 #include "unicode-inl.h"
18 #include "utils.h" 18 #include "utils.h"
19 19
20 namespace v8 { 20 namespace v8 {
21 namespace internal { 21 namespace internal {
22 22
23 23
24 class AstString;
25 class AstStringTable;
24 class ParserRecorder; 26 class ParserRecorder;
25 27
26 28
27 // Returns the value (0 .. 15) of a hexadecimal character c. 29 // Returns the value (0 .. 15) of a hexadecimal character c.
28 // If c is not a legal hexadecimal character, returns a value < 0. 30 // If c is not a legal hexadecimal character, returns a value < 0.
29 inline int HexValue(uc32 c) { 31 inline int HexValue(uc32 c) {
30 c -= '0'; 32 c -= '0';
31 if (static_cast<unsigned>(c) <= 9) return c; 33 if (static_cast<unsigned>(c) <= 9) return c;
32 c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36. 34 c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36.
33 if (static_cast<unsigned>(c) <= 5) return c + 10; 35 if (static_cast<unsigned>(c) <= 5) return c + 10;
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 371 }
370 bool is_literal_contextual_keyword(Vector<const char> keyword) { 372 bool is_literal_contextual_keyword(Vector<const char> keyword) {
371 ASSERT_NOT_NULL(current_.literal_chars); 373 ASSERT_NOT_NULL(current_.literal_chars);
372 return current_.literal_chars->is_contextual_keyword(keyword); 374 return current_.literal_chars->is_contextual_keyword(keyword);
373 } 375 }
374 bool is_next_contextual_keyword(Vector<const char> keyword) { 376 bool is_next_contextual_keyword(Vector<const char> keyword) {
375 ASSERT_NOT_NULL(next_.literal_chars); 377 ASSERT_NOT_NULL(next_.literal_chars);
376 return next_.literal_chars->is_contextual_keyword(keyword); 378 return next_.literal_chars->is_contextual_keyword(keyword);
377 } 379 }
378 380
379 Handle<String> AllocateNextLiteralString(Isolate* isolate, 381 const AstString* CurrentSymbol(AstStringTable* string_table);
380 PretenureFlag tenured); 382 const AstString* NextSymbol(AstStringTable* string_table);
381 Handle<String> AllocateInternalizedString(Isolate* isolate);
382 383
383 double DoubleValue(); 384 double DoubleValue();
384 bool UnescapedLiteralMatches(const char* data, int length) { 385 bool UnescapedLiteralMatches(const char* data, int length) {
385 if (is_literal_one_byte() && 386 if (is_literal_one_byte() &&
386 literal_length() == length && 387 literal_length() == length &&
387 !literal_contains_escapes()) { 388 !literal_contains_escapes()) {
388 const char* token = 389 const char* token =
389 reinterpret_cast<const char*>(literal_one_byte_string().start()); 390 reinterpret_cast<const char*>(literal_one_byte_string().start());
390 return !strncmp(token, data, length); 391 return !strncmp(token, data, length);
391 } 392 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 bool harmony_scoping_; 630 bool harmony_scoping_;
630 // Whether we scan 'module', 'import', 'export' as keywords. 631 // Whether we scan 'module', 'import', 'export' as keywords.
631 bool harmony_modules_; 632 bool harmony_modules_;
632 // Whether we scan 0o777 and 0b111 as numbers. 633 // Whether we scan 0o777 and 0b111 as numbers.
633 bool harmony_numeric_literals_; 634 bool harmony_numeric_literals_;
634 }; 635 };
635 636
636 } } // namespace v8::internal 637 } } // namespace v8::internal
637 638
638 #endif // V8_SCANNER_H_ 639 #endif // V8_SCANNER_H_
OLDNEW
« no previous file with comments | « src/rewriter.cc ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698