Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 49c8db8db5f4d9c1fa7b51dcad44fbe077c0be6c..ac328ce316dca1c44e1f7497132dfa72fee52883 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -581,7 +581,8 @@ bool Object::IsContext() { |
map == heap->catch_context_map() || |
map == heap->with_context_map() || |
map == heap->global_context_map() || |
- map == heap->block_context_map()); |
+ map == heap->block_context_map() || |
+ map == heap->module_context_map()); |
} |
return false; |
} |
@@ -594,6 +595,13 @@ bool Object::IsGlobalContext() { |
} |
+bool Object::IsModuleContext() { |
+ return Object::IsHeapObject() && |
+ HeapObject::cast(this)->map() == |
+ HeapObject::cast(this)->GetHeap()->module_context_map(); |
+} |
+ |
+ |
bool Object::IsScopeInfo() { |
return Object::IsHeapObject() && |
HeapObject::cast(this)->map() == |
@@ -613,6 +621,7 @@ TYPE_CHECKER(Code, CODE_TYPE) |
TYPE_CHECKER(Oddball, ODDBALL_TYPE) |
TYPE_CHECKER(JSGlobalPropertyCell, JS_GLOBAL_PROPERTY_CELL_TYPE) |
TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) |
+TYPE_CHECKER(JSModule, JS_MODULE_TYPE) |
TYPE_CHECKER(JSValue, JS_VALUE_TYPE) |
TYPE_CHECKER(JSDate, JS_DATE_TYPE) |
TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) |
@@ -1436,6 +1445,8 @@ int JSObject::GetHeaderSize() { |
// field operations considerably on average. |
if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; |
switch (type) { |
+ case JS_MODULE_TYPE: |
+ return JSModule::kSize; |
case JS_GLOBAL_PROXY_TYPE: |
return JSGlobalProxy::kSize; |
case JS_GLOBAL_OBJECT_TYPE: |
@@ -4078,6 +4089,16 @@ void Foreign::set_foreign_address(Address value) { |
} |
+ACCESSORS(JSModule, context, Object, kContextOffset) |
+ |
+ |
+JSModule* JSModule::cast(Object* obj) { |
+ ASSERT(obj->IsJSModule()); |
+ ASSERT(HeapObject::cast(obj)->Size() == JSModule::kSize); |
+ return reinterpret_cast<JSModule*>(obj); |
+} |
+ |
+ |
ACCESSORS(JSValue, value, Object, kValueOffset) |