// RegExpKey carries the source and flags of a regular expression as key.
class RegExpKey : public HashTableKey {
public:
- RegExpKey(String* string, JSRegExp::Flags flags)
+ RegExpKey(Handle<String> string, JSRegExp::Flags flags)
: string_(string),
flags_(Smi::FromInt(flags.value())) { }
&& (flags_ == val->get(JSRegExp::kFlagsIndex));
}
- uint32_t Hash() { return RegExpHash(string_, flags_); }
+ uint32_t Hash() { return RegExpHash(*string_, flags_); }
Object* AsObject(Heap* heap) {
// Plain hash maps, which is where regexp keys are used, don't
return string->Hash() + flags->value();
}
- String* string_;
+ Handle<String> string_;
Smi* flags_;
};
JSRegExp::Flags flags) {
Isolate* isolate = GetIsolate();
DisallowHeapAllocation no_allocation;
- RegExpKey key(*src, flags);
+ RegExpKey key(src, flags);
int entry = FindEntry(&key);
if (entry == kNotFound) return isolate->factory()->undefined_value();
return Handle<Object>(get(EntryToIndex(entry) + 1), isolate);
Handle<CompilationCacheTable> CompilationCacheTable::PutRegExp(
Handle<CompilationCacheTable> cache, Handle<String> src,
JSRegExp::Flags flags, Handle<FixedArray> value) {
- RegExpKey key(*src, flags);
+ RegExpKey key(src, flags);
cache = EnsureCapacityFor(cache, 1, &key);
int entry = cache->FindInsertionEntry(key.Hash());
// We store the value in the key slot, and compare the search key