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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 int DuplicateFinder::AddTwoByteSymbol(Vector<const uint16_t> key, int value) { | 1434 int DuplicateFinder::AddTwoByteSymbol(Vector<const uint16_t> key, int value) { |
1435 return AddSymbol(Vector<const uint8_t>::cast(key), false, value); | 1435 return AddSymbol(Vector<const uint8_t>::cast(key), false, value); |
1436 } | 1436 } |
1437 | 1437 |
1438 | 1438 |
1439 int DuplicateFinder::AddSymbol(Vector<const uint8_t> key, | 1439 int DuplicateFinder::AddSymbol(Vector<const uint8_t> key, |
1440 bool is_one_byte, | 1440 bool is_one_byte, |
1441 int value) { | 1441 int value) { |
1442 uint32_t hash = Hash(key, is_one_byte); | 1442 uint32_t hash = Hash(key, is_one_byte); |
1443 byte* encoding = BackupKey(key, is_one_byte); | 1443 byte* encoding = BackupKey(key, is_one_byte); |
1444 HashMap::Entry* entry = map_.Lookup(encoding, hash, true); | 1444 HashMap::Entry* entry = map_.LookupOrInsert(encoding, hash); |
1445 int old_value = static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); | 1445 int old_value = static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); |
1446 entry->value = | 1446 entry->value = |
1447 reinterpret_cast<void*>(static_cast<intptr_t>(value | old_value)); | 1447 reinterpret_cast<void*>(static_cast<intptr_t>(value | old_value)); |
1448 return old_value; | 1448 return old_value; |
1449 } | 1449 } |
1450 | 1450 |
1451 | 1451 |
1452 int DuplicateFinder::AddNumber(Vector<const uint8_t> key, int value) { | 1452 int DuplicateFinder::AddNumber(Vector<const uint8_t> key, int value) { |
1453 DCHECK(key.length() > 0); | 1453 DCHECK(key.length() > 0); |
1454 // Quick check for already being in canonical form. | 1454 // Quick check for already being in canonical form. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 } | 1559 } |
1560 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1560 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
1561 } | 1561 } |
1562 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1562 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
1563 | 1563 |
1564 backing_store_.AddBlock(bytes); | 1564 backing_store_.AddBlock(bytes); |
1565 return backing_store_.EndSequence().start(); | 1565 return backing_store_.EndSequence().start(); |
1566 } | 1566 } |
1567 | 1567 |
1568 } } // namespace v8::internal | 1568 } } // namespace v8::internal |
OLD | NEW |