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

Unified Diff: src/objects-inl.h

Issue 140913009: Experimental lexer: fix internalization and allocation of literals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Add comments Created 6 years, 11 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/objects.cc ('k') | src/parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index fb996a219e28df171504916345c496394ab4c3c1..73fc0a6b71ff1912188bc1c4e05f73931294bee3 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -499,17 +499,16 @@ class OneByteStringKey : public SequentialStringKey<uint8_t> {
};
-class SubStringOneByteStringKey : public HashTableKey {
+template<class Char>
+class SubStringKey : public HashTableKey {
public:
- explicit SubStringOneByteStringKey(Handle<SeqOneByteString> string,
- int from,
- int length)
+ SubStringKey(Handle<String> string, int from, int length)
: string_(string), from_(from), length_(length) { }
virtual uint32_t Hash() {
ASSERT(length_ >= 0);
ASSERT(from_ + length_ <= string_->length());
- uint8_t* chars = string_->GetChars() + from_;
+ const Char* chars = GetChars() + from_;
hash_field_ = StringHasher::HashSequentialString(
chars, length_, string_->GetHeap()->HashSeed());
uint32_t result = hash_field_ >> String::kHashShift;
@@ -517,20 +516,17 @@ class SubStringOneByteStringKey : public HashTableKey {
return result;
}
-
virtual uint32_t HashForObject(Object* other) {
return String::cast(other)->Hash();
}
- virtual bool IsMatch(Object* string) {
- Vector<const uint8_t> chars(string_->GetChars() + from_, length_);
- return String::cast(string)->IsOneByteEqualTo(chars);
- }
-
+ virtual bool IsMatch(Object* string);
virtual MaybeObject* AsObject(Heap* heap);
private:
- Handle<SeqOneByteString> string_;
+ const Char* GetChars();
+
+ Handle<String> string_;
int from_;
int length_;
uint32_t hash_field_;
« no previous file with comments | « src/objects.cc ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698