Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: src/parsing/scanner.h

Issue 2281443002: Separate DuplicateFinder from Scanner. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/preparser.cc ('k') | src/parsing/scanner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/scanner.h
diff --git a/src/parsing/scanner.h b/src/parsing/scanner.h
index 66c6ce8133e18f053898135a658399d01b2f0ac4..cb37f7cc1a5dd7025579d03902a789c6c1e530bb 100644
--- a/src/parsing/scanner.h
+++ b/src/parsing/scanner.h
@@ -8,12 +8,9 @@
#define V8_PARSING_SCANNER_H_
#include "src/allocation.h"
-#include "src/base/hashmap.h"
#include "src/base/logging.h"
#include "src/char-predicates.h"
-#include "src/collector.h"
#include "src/globals.h"
-#include "src/list.h"
#include "src/messages.h"
#include "src/parsing/token.h"
#include "src/unicode-decoder.h"
@@ -25,6 +22,7 @@ namespace internal {
class AstRawString;
class AstValueFactory;
+class DuplicateFinder;
class ParserRecorder;
class UnicodeCache;
@@ -99,56 +97,6 @@ class Utf16CharacterStream {
};
-// ---------------------------------------------------------------------
-// DuplicateFinder discovers duplicate symbols.
-
-class DuplicateFinder {
- public:
- explicit DuplicateFinder(UnicodeCache* constants)
- : unicode_constants_(constants),
- backing_store_(16),
- map_(&Match) { }
-
- int AddOneByteSymbol(Vector<const uint8_t> key, int value);
- int AddTwoByteSymbol(Vector<const uint16_t> key, int value);
- // Add a a number literal by converting it (if necessary)
- // to the string that ToString(ToNumber(literal)) would generate.
- // and then adding that string with AddOneByteSymbol.
- // This string is the actual value used as key in an object literal,
- // and the one that must be different from the other keys.
- int AddNumber(Vector<const uint8_t> key, int value);
-
- private:
- int AddSymbol(Vector<const uint8_t> key, bool is_one_byte, int value);
- // Backs up the key and its length in the backing store.
- // The backup is stored with a base 127 encoding of the
- // length (plus a bit saying whether the string is one byte),
- // followed by the bytes of the key.
- uint8_t* BackupKey(Vector<const uint8_t> key, bool is_one_byte);
-
- // Compare two encoded keys (both pointing into the backing store)
- // for having the same base-127 encoded lengths and representation.
- // and then having the same 'length' bytes following.
- static bool Match(void* first, void* second);
- // Creates a hash from a sequence of bytes.
- static uint32_t Hash(Vector<const uint8_t> key, bool is_one_byte);
- // Checks whether a string containing a JS number is its canonical
- // form.
- static bool IsNumberCanonical(Vector<const uint8_t> key);
-
- // Size of buffer. Sufficient for using it to call DoubleToCString in
- // from conversions.h.
- static const int kBufferSize = 100;
-
- UnicodeCache* unicode_constants_;
- // Backing store used to store strings used as hashmap keys.
- SequenceCollector<unsigned char> backing_store_;
- base::HashMap map_;
- // Buffer used for string->number->canonical string conversions.
- char number_buffer_[kBufferSize];
-};
-
-
// ----------------------------------------------------------------------------
// JavaScript Scanner.
« no previous file with comments | « src/parsing/preparser.cc ('k') | src/parsing/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698