OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 if (!*ok) return Identifier::Default(); | 1678 if (!*ok) return Identifier::Default(); |
1679 if (scanner_->is_literal_ascii() && | 1679 if (scanner_->is_literal_ascii() && |
1680 scanner_->literal_length() == 3) { | 1680 scanner_->literal_length() == 3) { |
1681 const char* token = scanner_->literal_ascii_string().start(); | 1681 const char* token = scanner_->literal_ascii_string().start(); |
1682 *is_get = strncmp(token, "get", 3) == 0; | 1682 *is_get = strncmp(token, "get", 3) == 0; |
1683 *is_set = !*is_get && strncmp(token, "set", 3) == 0; | 1683 *is_set = !*is_get && strncmp(token, "set", 3) == 0; |
1684 } | 1684 } |
1685 return result; | 1685 return result; |
1686 } | 1686 } |
1687 | 1687 |
| 1688 |
1688 bool PreParser::peek_any_identifier() { | 1689 bool PreParser::peek_any_identifier() { |
1689 i::Token::Value next = peek(); | 1690 i::Token::Value next = peek(); |
1690 return next == i::Token::IDENTIFIER || | 1691 return next == i::Token::IDENTIFIER || |
1691 next == i::Token::FUTURE_RESERVED_WORD || | 1692 next == i::Token::FUTURE_RESERVED_WORD || |
1692 next == i::Token::FUTURE_STRICT_RESERVED_WORD || | 1693 next == i::Token::FUTURE_STRICT_RESERVED_WORD || |
1693 next == i::Token::YIELD; | 1694 next == i::Token::YIELD; |
1694 } | 1695 } |
1695 | 1696 |
1696 | 1697 |
1697 int DuplicateFinder::AddAsciiSymbol(i::Vector<const char> key, int value) { | 1698 int DuplicateFinder::AddAsciiSymbol(i::Vector<const char> key, int value) { |
1698 return AddSymbol(i::Vector<const byte>::cast(key), true, value); | 1699 return AddSymbol(i::Vector<const byte>::cast(key), true, value); |
1699 } | 1700 } |
1700 | 1701 |
| 1702 |
1701 int DuplicateFinder::AddUtf16Symbol(i::Vector<const uint16_t> key, int value) { | 1703 int DuplicateFinder::AddUtf16Symbol(i::Vector<const uint16_t> key, int value) { |
1702 return AddSymbol(i::Vector<const byte>::cast(key), false, value); | 1704 return AddSymbol(i::Vector<const byte>::cast(key), false, value); |
1703 } | 1705 } |
1704 | 1706 |
1705 int DuplicateFinder::AddSymbol(i::Vector<const byte> key, | 1707 int DuplicateFinder::AddSymbol(i::Vector<const byte> key, |
1706 bool is_ascii, | 1708 bool is_ascii, |
1707 int value) { | 1709 int value) { |
1708 uint32_t hash = Hash(key, is_ascii); | 1710 uint32_t hash = Hash(key, is_ascii); |
1709 byte* encoding = BackupKey(key, is_ascii); | 1711 byte* encoding = BackupKey(key, is_ascii); |
1710 i::HashMap::Entry* entry = map_.Lookup(encoding, hash, true); | 1712 i::HashMap::Entry* entry = map_.Lookup(encoding, hash, true); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); | 1822 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); |
1821 } | 1823 } |
1822 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); | 1824 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); |
1823 } | 1825 } |
1824 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); | 1826 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); |
1825 | 1827 |
1826 backing_store_.AddBlock(bytes); | 1828 backing_store_.AddBlock(bytes); |
1827 return backing_store_.EndSequence().start(); | 1829 return backing_store_.EndSequence().start(); |
1828 } | 1830 } |
1829 } } // v8::preparser | 1831 } } // v8::preparser |
OLD | NEW |