| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 | 107 |
| 108 // ---------------------------------------------------------------------------- | 108 // ---------------------------------------------------------------------------- |
| 109 // CompleteParserRecorder - Record both function entries and symbols. | 109 // CompleteParserRecorder - Record both function entries and symbols. |
| 110 | 110 |
| 111 CompleteParserRecorder::CompleteParserRecorder() | 111 CompleteParserRecorder::CompleteParserRecorder() |
| 112 : FunctionLoggingParserRecorder(), | 112 : FunctionLoggingParserRecorder(), |
| 113 literal_chars_(0), | 113 literal_chars_(0), |
| 114 symbol_store_(0), | 114 symbol_store_(0), |
| 115 symbol_keys_(0), | 115 symbol_keys_(0), |
| 116 symbol_table_(vector_compare), | 116 string_table_(vector_compare), |
| 117 symbol_id_(0) { | 117 symbol_id_(0) { |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| 121 void CompleteParserRecorder::LogSymbol(int start, | 121 void CompleteParserRecorder::LogSymbol(int start, |
| 122 int hash, | 122 int hash, |
| 123 bool is_ascii, | 123 bool is_ascii, |
| 124 Vector<const byte> literal_bytes) { | 124 Vector<const byte> literal_bytes) { |
| 125 Key key = { is_ascii, literal_bytes }; | 125 Key key = { is_ascii, literal_bytes }; |
| 126 HashMap::Entry* entry = symbol_table_.Lookup(&key, hash, true); | 126 HashMap::Entry* entry = string_table_.Lookup(&key, hash, true); |
| 127 int id = static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); | 127 int id = static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); |
| 128 if (id == 0) { | 128 if (id == 0) { |
| 129 // Copy literal contents for later comparison. | 129 // Copy literal contents for later comparison. |
| 130 key.literal_bytes = | 130 key.literal_bytes = |
| 131 Vector<const byte>::cast(literal_chars_.AddBlock(literal_bytes)); | 131 Vector<const byte>::cast(literal_chars_.AddBlock(literal_bytes)); |
| 132 // Put (symbol_id_ + 1) into entry and increment it. | 132 // Put (symbol_id_ + 1) into entry and increment it. |
| 133 id = ++symbol_id_; | 133 id = ++symbol_id_; |
| 134 entry->value = reinterpret_cast<void*>(id); | 134 entry->value = reinterpret_cast<void*>(id); |
| 135 Vector<Key> symbol = symbol_keys_.AddBlock(1, key); | 135 Vector<Key> symbol = symbol_keys_.AddBlock(1, key); |
| 136 entry->key = &symbol[0]; | 136 entry->key = &symbol[0]; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 symbol_store_.Add(static_cast<byte>(number >> i) | 0x80u); | 174 symbol_store_.Add(static_cast<byte>(number >> i) | 0x80u); |
| 175 number &= mask; | 175 number &= mask; |
| 176 } | 176 } |
| 177 mask >>= 7; | 177 mask >>= 7; |
| 178 } | 178 } |
| 179 symbol_store_.Add(static_cast<byte>(number)); | 179 symbol_store_.Add(static_cast<byte>(number)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 | 182 |
| 183 } } // namespace v8::internal. | 183 } } // namespace v8::internal. |
| OLD | NEW |