aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/objects/compilation-cache-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/objects/compilation-cache-inl.h')
-rw-r--r--deps/v8/src/objects/compilation-cache-inl.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/deps/v8/src/objects/compilation-cache-inl.h b/deps/v8/src/objects/compilation-cache-inl.h
index 1637e64d6d..07af9a6029 100644
--- a/deps/v8/src/objects/compilation-cache-inl.h
+++ b/deps/v8/src/objects/compilation-cache-inl.h
@@ -10,6 +10,7 @@
#include "src/objects/name-inl.h"
#include "src/objects/script-inl.h"
#include "src/objects/shared-function-info.h"
+#include "src/objects/smi.h"
#include "src/objects/string.h"
// Has to be the last include (doesn't have include guards):
@@ -18,14 +19,20 @@
namespace v8 {
namespace internal {
+CompilationCacheTable::CompilationCacheTable(Address ptr)
+ : HashTable<CompilationCacheTable, CompilationCacheShape>(ptr) {
+ SLOW_DCHECK(IsCompilationCacheTable());
+}
+
+NEVER_READ_ONLY_SPACE_IMPL(CompilationCacheTable)
CAST_ACCESSOR(CompilationCacheTable)
-uint32_t CompilationCacheShape::RegExpHash(String* string, Smi* flags) {
+uint32_t CompilationCacheShape::RegExpHash(String string, Smi flags) {
return string->Hash() + flags->value();
}
-uint32_t CompilationCacheShape::StringSharedHash(String* source,
- SharedFunctionInfo* shared,
+uint32_t CompilationCacheShape::StringSharedHash(String source,
+ SharedFunctionInfo shared,
LanguageMode language_mode,
int position) {
uint32_t hash = source->Hash();
@@ -35,7 +42,7 @@ uint32_t CompilationCacheShape::StringSharedHash(String* source,
// script source code and the start position of the calling scope.
// We do this to ensure that the cache entries can survive garbage
// collection.
- Script* script(Script::cast(shared->script()));
+ Script script(Script::cast(shared->script()));
hash ^= String::cast(script->source())->Hash();
STATIC_ASSERT(LanguageModeSize == 2);
if (is_strict(language_mode)) hash ^= 0x8000;
@@ -44,15 +51,14 @@ uint32_t CompilationCacheShape::StringSharedHash(String* source,
return hash;
}
-uint32_t CompilationCacheShape::HashForObject(Isolate* isolate,
- Object* object) {
+uint32_t CompilationCacheShape::HashForObject(Isolate* isolate, Object object) {
if (object->IsNumber()) return static_cast<uint32_t>(object->Number());
- FixedArray* val = FixedArray::cast(object);
+ FixedArray val = FixedArray::cast(object);
if (val->map() == val->GetReadOnlyRoots().fixed_cow_array_map()) {
DCHECK_EQ(4, val->length());
- SharedFunctionInfo* shared = SharedFunctionInfo::cast(val->get(0));
- String* source = String::cast(val->get(1));
+ SharedFunctionInfo shared = SharedFunctionInfo::cast(val->get(0));
+ String source = String::cast(val->get(1));
int language_unchecked = Smi::ToInt(val->get(2));
DCHECK(is_valid_language_mode(language_unchecked));
LanguageMode language_mode = static_cast<LanguageMode>(language_unchecked);
@@ -64,6 +70,13 @@ uint32_t CompilationCacheShape::HashForObject(Isolate* isolate,
Smi::cast(val->get(JSRegExp::kFlagsIndex)));
}
+InfoCellPair::InfoCellPair(SharedFunctionInfo shared,
+ FeedbackCell feedback_cell)
+ : is_compiled_scope_(!shared.is_null() ? shared->is_compiled_scope()
+ : IsCompiledScope()),
+ shared_(shared),
+ feedback_cell_(feedback_cell) {}
+
} // namespace internal
} // namespace v8