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

Side by Side Diff: src/lexer/experimental-scanner.h

Issue 39673002: Experimental scanner: save all token data into one vector. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month 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 | « no previous file | src/lexer/experimental-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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 bool IsValid() const { 47 bool IsValid() const {
48 return beg_pos >= 0 && end_pos >= beg_pos; 48 return beg_pos >= 0 && end_pos >= beg_pos;
49 } 49 }
50 50
51 static Location invalid() { return Location(-1, -1); } 51 static Location invalid() { return Location(-1, -1); }
52 52
53 int beg_pos; 53 int beg_pos;
54 int end_pos; 54 int end_pos;
55 }; 55 };
56 56
57 struct SavedToken {
58 int beg, end;
59 Token::Value value;
60 };
61
57 ExperimentalScanner(const char* fname, 62 ExperimentalScanner(const char* fname,
58 bool read_all_at_once, 63 bool read_all_at_once,
59 Isolate* isolate); 64 Isolate* isolate);
60 ~ExperimentalScanner(); 65 ~ExperimentalScanner();
61 66
62 Token::Value Next(); 67 Token::Value Next();
63 Token::Value current_token(); 68 Token::Value current_token();
64 Location location(); 69 Location location();
65 70
66 void Record(v8::internal::Token::Value token, int beg_pos, int end_pos); 71 void Record(v8::internal::Token::Value token, int beg_pos, int end_pos);
67 72
68 private: 73 private:
69 void FillTokens(); 74 void FillTokens();
70 static const int BUFFER_SIZE = 256; 75 static const int BUFFER_SIZE = 256;
71 std::vector<v8::internal::Token::Value> token_; 76 std::vector<SavedToken> token_;
72 std::vector<int> beg_;
73 std::vector<int> end_;
74 size_t current_; 77 size_t current_;
75 size_t fetched_; 78 size_t fetched_;
76 FILE* file_; 79 FILE* file_;
77 PushScanner* scanner_; 80 PushScanner* scanner_;
78 bool read_all_at_once_; 81 bool read_all_at_once_;
79 const v8::internal::byte* source_; 82 const v8::internal::byte* source_;
80 int length_; 83 int length_;
81 }; 84 };
82 85
83 } } // namespace v8::internal 86 } } // namespace v8::internal
84 87
85 #endif 88 #endif
OLDNEW
« no previous file with comments | « no previous file | src/lexer/experimental-scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698