OLD | NEW |
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 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "scanner.h" | 9 #include "scanner.h" |
10 | 10 |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 | 1131 |
1132 | 1132 |
1133 int Scanner::FindSymbol(DuplicateFinder* finder, int value) { | 1133 int Scanner::FindSymbol(DuplicateFinder* finder, int value) { |
1134 if (is_literal_one_byte()) { | 1134 if (is_literal_one_byte()) { |
1135 return finder->AddOneByteSymbol(literal_one_byte_string(), value); | 1135 return finder->AddOneByteSymbol(literal_one_byte_string(), value); |
1136 } | 1136 } |
1137 return finder->AddTwoByteSymbol(literal_two_byte_string(), value); | 1137 return finder->AddTwoByteSymbol(literal_two_byte_string(), value); |
1138 } | 1138 } |
1139 | 1139 |
1140 | 1140 |
1141 void Scanner::LogSymbol(ParserRecorder* log, int position) { | |
1142 if (is_literal_one_byte()) { | |
1143 log->LogOneByteSymbol(position, literal_one_byte_string()); | |
1144 } else { | |
1145 log->LogTwoByteSymbol(position, literal_two_byte_string()); | |
1146 } | |
1147 } | |
1148 | |
1149 | |
1150 int DuplicateFinder::AddOneByteSymbol(Vector<const uint8_t> key, int value) { | 1141 int DuplicateFinder::AddOneByteSymbol(Vector<const uint8_t> key, int value) { |
1151 return AddSymbol(key, true, value); | 1142 return AddSymbol(key, true, value); |
1152 } | 1143 } |
1153 | 1144 |
1154 | 1145 |
1155 int DuplicateFinder::AddTwoByteSymbol(Vector<const uint16_t> key, int value) { | 1146 int DuplicateFinder::AddTwoByteSymbol(Vector<const uint16_t> key, int value) { |
1156 return AddSymbol(Vector<const uint8_t>::cast(key), false, value); | 1147 return AddSymbol(Vector<const uint8_t>::cast(key), false, value); |
1157 } | 1148 } |
1158 | 1149 |
1159 | 1150 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 } | 1271 } |
1281 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1272 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
1282 } | 1273 } |
1283 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1274 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
1284 | 1275 |
1285 backing_store_.AddBlock(bytes); | 1276 backing_store_.AddBlock(bytes); |
1286 return backing_store_.EndSequence().start(); | 1277 return backing_store_.EndSequence().start(); |
1287 } | 1278 } |
1288 | 1279 |
1289 } } // namespace v8::internal | 1280 } } // namespace v8::internal |
OLD | NEW |