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

Unified Diff: src/ast/context-slot-cache.cc

Issue 2280933002: Always deserialize scope infos for parsing (Closed)
Patch Set: updates 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/ast/context-slot-cache.h ('k') | src/ast/scopeinfo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/context-slot-cache.cc
diff --git a/src/ast/context-slot-cache.cc b/src/ast/context-slot-cache.cc
deleted file mode 100644
index 43bd6d6b19205b9be5f909275e06691f0558b299..0000000000000000000000000000000000000000
--- a/src/ast/context-slot-cache.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2016 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/ast/context-slot-cache.h"
-
-#include <stdlib.h>
-
-#include "src/ast/scopes.h"
-#include "src/bootstrapper.h"
-
-namespace v8 {
-namespace internal {
-
-int ContextSlotCache::Hash(Object* data, String* name) {
- // Uses only lower 32 bits if pointers are larger.
- uintptr_t addr_hash =
- static_cast<uint32_t>(reinterpret_cast<uintptr_t>(data)) >> 2;
- return static_cast<int>((addr_hash ^ name->Hash()) % kLength);
-}
-
-int ContextSlotCache::Lookup(Object* data, String* name, VariableMode* mode,
- InitializationFlag* init_flag,
- MaybeAssignedFlag* maybe_assigned_flag) {
- int index = Hash(data, name);
- Key& key = keys_[index];
- if ((key.data == data) && key.name->Equals(name)) {
- Value result(values_[index]);
- if (mode != nullptr) *mode = result.mode();
- if (init_flag != nullptr) *init_flag = result.initialization_flag();
- if (maybe_assigned_flag != nullptr)
- *maybe_assigned_flag = result.maybe_assigned_flag();
- return result.index() + kNotFound;
- }
- return kNotFound;
-}
-
-void ContextSlotCache::Update(Handle<Object> data, Handle<String> name,
- VariableMode mode, InitializationFlag init_flag,
- MaybeAssignedFlag maybe_assigned_flag,
- int slot_index) {
- DisallowHeapAllocation no_gc;
- Handle<String> internalized_name;
- DCHECK(slot_index > kNotFound);
- if (StringTable::InternalizeStringIfExists(name->GetIsolate(), name)
- .ToHandle(&internalized_name)) {
- int index = Hash(*data, *internalized_name);
- Key& key = keys_[index];
- key.data = *data;
- key.name = *internalized_name;
- // Please note value only takes a uint as index.
- values_[index] =
- Value(mode, init_flag, maybe_assigned_flag, slot_index - kNotFound)
- .raw();
-#ifdef DEBUG
- ValidateEntry(data, name, mode, init_flag, maybe_assigned_flag, slot_index);
-#endif
- }
-}
-
-void ContextSlotCache::Clear() {
- for (int index = 0; index < kLength; index++) keys_[index].data = nullptr;
-}
-
-#ifdef DEBUG
-
-void ContextSlotCache::ValidateEntry(Handle<Object> data, Handle<String> name,
- VariableMode mode,
- InitializationFlag init_flag,
- MaybeAssignedFlag maybe_assigned_flag,
- int slot_index) {
- DisallowHeapAllocation no_gc;
- Handle<String> internalized_name;
- if (StringTable::InternalizeStringIfExists(name->GetIsolate(), name)
- .ToHandle(&internalized_name)) {
- int index = Hash(*data, *name);
- Key& key = keys_[index];
- DCHECK(key.data == *data);
- DCHECK(key.name->Equals(*name));
- Value result(values_[index]);
- DCHECK(result.mode() == mode);
- DCHECK(result.initialization_flag() == init_flag);
- DCHECK(result.maybe_assigned_flag() == maybe_assigned_flag);
- DCHECK(result.index() + kNotFound == slot_index);
- }
-}
-
-#endif // DEBUG
-
-} // namespace internal
-} // namespace v8
« no previous file with comments | « src/ast/context-slot-cache.h ('k') | src/ast/scopeinfo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698