Commit 14e0f3cc authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[GetIsolate] Allow GetIsolate for Context & JSObjects

Add a separate GetIsolate implementation for Context and JSObjects
so that we can continue using it on these context-specific types,
while eventually removing HeapObject::GetIsolate().

Bug: v8:7786
Change-Id: I86c2e12c6878e060338cbd5c3bbe27dcf978e34b
Reviewed-on: https://chromium-review.googlesource.com/1101320
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53746}
parent 1228861d
......@@ -39,13 +39,14 @@ Handle<Context> ScriptContextTable::GetContext(Handle<ScriptContextTable> table,
FixedArray::get(*table, i + kFirstContextSlotIndex, table->GetIsolate()));
}
// static
Context* Context::cast(Object* context) {
DCHECK(context->IsContext());
return reinterpret_cast<Context*>(context);
}
Isolate* Context::GetIsolate() const { return GetHeap()->isolate(); }
void Context::set_scope_info(ScopeInfo* scope_info) {
set(SCOPE_INFO_INDEX, scope_info);
}
......
......@@ -439,6 +439,8 @@ class Context : public FixedArray {
// Conversions.
static inline Context* cast(Object* context);
inline Isolate* GetIsolate() const;
// The default context slot layout; indices are FixedArray slot indices.
enum Field {
// These slots are in all contexts.
......
......@@ -55,6 +55,8 @@ FeedbackVector* FeedbackVector::cast(Object* obj) {
return reinterpret_cast<FeedbackVector*>(obj);
}
Isolate* FeedbackVector::GetIsolate() const { return GetHeap()->isolate(); }
int FeedbackMetadata::GetSlotSize(FeedbackSlotKind kind) {
switch (kind) {
case FeedbackSlotKind::kForIn:
......
......@@ -145,6 +145,8 @@ class FeedbackVector : public HeapObject {
// Casting.
static inline FeedbackVector* cast(Object* obj);
inline Isolate* GetIsolate() const;
inline void ComputeCounts(int* with_type_info, int* generic,
int* vector_ic_count);
......
......@@ -1016,6 +1016,8 @@ Isolate* HeapObject::GetIsolate() const {
return GetHeap()->isolate();
}
Isolate* JSReceiver::GetIsolate() const { return GetHeap()->isolate(); }
Map* HeapObject::map() const {
return map_word().ToMap();
}
......
......@@ -2101,6 +2101,8 @@ class JSReceiver: public HeapObject {
// Returns true if there is no slow (ie, dictionary) backing store.
inline bool HasFastProperties() const;
inline Isolate* GetIsolate() const;
// Returns the properties array backing store if it
// exists. Otherwise, returns an empty_property_array when there's a
// Smi (hash code) or an empty_fixed_array for a fast properties
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment