| 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 "src/parsing/scanner.h" | 7 #include "src/parsing/scanner.h" |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 int DuplicateFinder::AddTwoByteSymbol(Vector<const uint16_t> key, int value) { | 1583 int DuplicateFinder::AddTwoByteSymbol(Vector<const uint16_t> key, int value) { |
| 1584 return AddSymbol(Vector<const uint8_t>::cast(key), false, value); | 1584 return AddSymbol(Vector<const uint8_t>::cast(key), false, value); |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 | 1587 |
| 1588 int DuplicateFinder::AddSymbol(Vector<const uint8_t> key, | 1588 int DuplicateFinder::AddSymbol(Vector<const uint8_t> key, |
| 1589 bool is_one_byte, | 1589 bool is_one_byte, |
| 1590 int value) { | 1590 int value) { |
| 1591 uint32_t hash = Hash(key, is_one_byte); | 1591 uint32_t hash = Hash(key, is_one_byte); |
| 1592 byte* encoding = BackupKey(key, is_one_byte); | 1592 byte* encoding = BackupKey(key, is_one_byte); |
| 1593 HashMap::Entry* entry = map_.LookupOrInsert(encoding, hash); | 1593 base::HashMap::Entry* entry = map_.LookupOrInsert(encoding, hash); |
| 1594 int old_value = static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); | 1594 int old_value = static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); |
| 1595 entry->value = | 1595 entry->value = |
| 1596 reinterpret_cast<void*>(static_cast<intptr_t>(value | old_value)); | 1596 reinterpret_cast<void*>(static_cast<intptr_t>(value | old_value)); |
| 1597 return old_value; | 1597 return old_value; |
| 1598 } | 1598 } |
| 1599 | 1599 |
| 1600 | 1600 |
| 1601 int DuplicateFinder::AddNumber(Vector<const uint8_t> key, int value) { | 1601 int DuplicateFinder::AddNumber(Vector<const uint8_t> key, int value) { |
| 1602 DCHECK(key.length() > 0); | 1602 DCHECK(key.length() > 0); |
| 1603 // Quick check for already being in canonical form. | 1603 // Quick check for already being in canonical form. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1709 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
| 1710 } | 1710 } |
| 1711 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1711 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
| 1712 | 1712 |
| 1713 backing_store_.AddBlock(bytes); | 1713 backing_store_.AddBlock(bytes); |
| 1714 return backing_store_.EndSequence().start(); | 1714 return backing_store_.EndSequence().start(); |
| 1715 } | 1715 } |
| 1716 | 1716 |
| 1717 } // namespace internal | 1717 } // namespace internal |
| 1718 } // namespace v8 | 1718 } // namespace v8 |
| OLD | NEW |