| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 9f7524ccefb7a4dc85ae9ee1677840b14e8d1bad..71301c36500228fcbb585e475a8c4b46fadb68a8 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -15776,10 +15776,12 @@ void Symbol::SymbolShortPrint(std::ostream& os) {
|
| class StringSharedKey : public HashTableKey {
|
| public:
|
| StringSharedKey(Handle<String> source, Handle<SharedFunctionInfo> shared,
|
| - LanguageMode language_mode, int scope_position)
|
| + LanguageMode language_mode, bool is_module,
|
| + int scope_position)
|
| : source_(source),
|
| shared_(shared),
|
| language_mode_(language_mode),
|
| + is_module_(is_module),
|
| scope_position_(scope_position) {}
|
|
|
| bool IsMatch(Object* other) override {
|
| @@ -15796,7 +15798,9 @@ class StringSharedKey : public HashTableKey {
|
| DCHECK(is_valid_language_mode(language_unchecked));
|
| LanguageMode language_mode = static_cast<LanguageMode>(language_unchecked);
|
| if (language_mode != language_mode_) return false;
|
| - int scope_position = Smi::cast(other_array->get(3))->value();
|
| + bool is_module = Smi::cast(other_array->get(3))->value() == 1;
|
| + if (is_module != is_module_) return false;
|
| + int scope_position = Smi::cast(other_array->get(4))->value();
|
| if (scope_position != scope_position_) return false;
|
| String* source = String::cast(other_array->get(1));
|
| return source->Equals(*source_);
|
| @@ -15805,7 +15809,7 @@ class StringSharedKey : public HashTableKey {
|
| static uint32_t StringSharedHashHelper(String* source,
|
| SharedFunctionInfo* shared,
|
| LanguageMode language_mode,
|
| - int scope_position) {
|
| + bool is_module, int scope_position) {
|
| uint32_t hash = source->Hash();
|
| if (shared->HasSourceCode()) {
|
| // Instead of using the SharedFunctionInfo pointer in the hash
|
| @@ -15817,6 +15821,7 @@ class StringSharedKey : public HashTableKey {
|
| hash ^= String::cast(script->source())->Hash();
|
| STATIC_ASSERT(LANGUAGE_END == 3);
|
| if (is_strict(language_mode)) hash ^= 0x8000;
|
| + if (is_module) hash ^= 0x4000;
|
| hash += scope_position;
|
| }
|
| return hash;
|
| @@ -15824,7 +15829,7 @@ class StringSharedKey : public HashTableKey {
|
|
|
| uint32_t Hash() override {
|
| return StringSharedHashHelper(*source_, *shared_, language_mode_,
|
| - scope_position_);
|
| + is_module_, scope_position_);
|
| }
|
|
|
| uint32_t HashForObject(Object* obj) override {
|
| @@ -15838,18 +15843,20 @@ class StringSharedKey : public HashTableKey {
|
| int language_unchecked = Smi::cast(other_array->get(2))->value();
|
| DCHECK(is_valid_language_mode(language_unchecked));
|
| LanguageMode language_mode = static_cast<LanguageMode>(language_unchecked);
|
| - int scope_position = Smi::cast(other_array->get(3))->value();
|
| - return StringSharedHashHelper(source, shared, language_mode,
|
| + bool is_module = Smi::cast(other_array->get(3))->value() == 1;
|
| + int scope_position = Smi::cast(other_array->get(4))->value();
|
| + return StringSharedHashHelper(source, shared, language_mode, is_module,
|
| scope_position);
|
| }
|
|
|
|
|
| Handle<Object> AsHandle(Isolate* isolate) override {
|
| - Handle<FixedArray> array = isolate->factory()->NewFixedArray(4);
|
| + Handle<FixedArray> array = isolate->factory()->NewFixedArray(5);
|
| array->set(0, *shared_);
|
| array->set(1, *source_);
|
| array->set(2, Smi::FromInt(language_mode_));
|
| - array->set(3, Smi::FromInt(scope_position_));
|
| + array->set(3, Smi::FromInt(is_module_ ? 1 : 0));
|
| + array->set(4, Smi::FromInt(scope_position_));
|
| return array;
|
| }
|
|
|
| @@ -15857,6 +15864,7 @@ class StringSharedKey : public HashTableKey {
|
| Handle<String> source_;
|
| Handle<SharedFunctionInfo> shared_;
|
| LanguageMode language_mode_;
|
| + bool is_module_;
|
| int scope_position_;
|
| };
|
|
|
| @@ -17104,10 +17112,11 @@ Handle<ObjectHashSet> ObjectHashSet::Add(Handle<ObjectHashSet> set,
|
|
|
| Handle<Object> CompilationCacheTable::Lookup(Handle<String> src,
|
| Handle<Context> context,
|
| - LanguageMode language_mode) {
|
| + LanguageMode language_mode,
|
| + bool is_module) {
|
| Isolate* isolate = GetIsolate();
|
| Handle<SharedFunctionInfo> shared(context->closure()->shared());
|
| - StringSharedKey key(src, shared, language_mode, kNoSourcePosition);
|
| + StringSharedKey key(src, shared, language_mode, is_module, kNoSourcePosition);
|
| int entry = FindEntry(&key);
|
| if (entry == kNotFound) return isolate->factory()->undefined_value();
|
| int index = EntryToIndex(entry);
|
| @@ -17122,7 +17131,7 @@ Handle<Object> CompilationCacheTable::LookupEval(
|
| Isolate* isolate = GetIsolate();
|
| // Cache key is the tuple (source, outer shared function info, scope position)
|
| // to unambiguously identify the context chain the cached eval code assumes.
|
| - StringSharedKey key(src, outer_info, language_mode, scope_position);
|
| + StringSharedKey key(src, outer_info, language_mode, false, scope_position);
|
| int entry = FindEntry(&key);
|
| if (entry == kNotFound) return isolate->factory()->undefined_value();
|
| int index = EntryToIndex(entry);
|
| @@ -17141,13 +17150,13 @@ Handle<Object> CompilationCacheTable::LookupRegExp(Handle<String> src,
|
| return Handle<Object>(get(EntryToIndex(entry) + 1), isolate);
|
| }
|
|
|
| -
|
| Handle<CompilationCacheTable> CompilationCacheTable::Put(
|
| Handle<CompilationCacheTable> cache, Handle<String> src,
|
| - Handle<Context> context, LanguageMode language_mode, Handle<Object> value) {
|
| + Handle<Context> context, LanguageMode language_mode, bool is_module,
|
| + Handle<Object> value) {
|
| Isolate* isolate = cache->GetIsolate();
|
| Handle<SharedFunctionInfo> shared(context->closure()->shared());
|
| - StringSharedKey key(src, shared, language_mode, kNoSourcePosition);
|
| + StringSharedKey key(src, shared, language_mode, is_module, kNoSourcePosition);
|
| Handle<Object> k = key.AsHandle(isolate);
|
| cache = EnsureCapacity(cache, 1, &key);
|
| int entry = cache->FindInsertionEntry(key.Hash());
|
| @@ -17163,7 +17172,8 @@ Handle<CompilationCacheTable> CompilationCacheTable::PutEval(
|
| Handle<SharedFunctionInfo> outer_info, Handle<SharedFunctionInfo> value,
|
| int scope_position) {
|
| Isolate* isolate = cache->GetIsolate();
|
| - StringSharedKey key(src, outer_info, value->language_mode(), scope_position);
|
| + StringSharedKey key(src, outer_info, value->language_mode(), false,
|
| + scope_position);
|
| {
|
| Handle<Object> k = key.AsHandle(isolate);
|
| DisallowHeapAllocation no_allocation_scope;
|
|
|