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

Unified Diff: src/objects.cc

Issue 2964943002: [wasm] Introduce instance types for WebAssembly.* objects. (Closed)
Patch Set: Address rossberg comments. Created 3 years, 5 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/objects.h ('k') | src/objects-body-descriptors-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 7179c8c3f77850c777d263299348f338056f1f50..0ccfb8126dadfc7da7ab5739b30dc1acd4f92a2e 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1290,6 +1290,82 @@ void JSObject::EnsureWritableFastElements(Handle<JSObject> object) {
isolate->counters()->cow_arrays_converted()->Increment();
}
+int JSObject::GetHeaderSize(InstanceType type) {
+ switch (type) {
+ case JS_OBJECT_TYPE:
+ case JS_API_OBJECT_TYPE:
+ case JS_SPECIAL_API_OBJECT_TYPE:
+ return JSObject::kHeaderSize;
+ case JS_GENERATOR_OBJECT_TYPE:
+ return JSGeneratorObject::kSize;
+ case JS_ASYNC_GENERATOR_OBJECT_TYPE:
+ return JSAsyncGeneratorObject::kSize;
+ case JS_GLOBAL_PROXY_TYPE:
+ return JSGlobalProxy::kSize;
+ case JS_GLOBAL_OBJECT_TYPE:
+ return JSGlobalObject::kSize;
+ case JS_BOUND_FUNCTION_TYPE:
+ return JSBoundFunction::kSize;
+ case JS_FUNCTION_TYPE:
+ return JSFunction::kSize;
+ case JS_VALUE_TYPE:
+ return JSValue::kSize;
+ case JS_DATE_TYPE:
+ return JSDate::kSize;
+ case JS_ARRAY_TYPE:
+ return JSArray::kSize;
+ case JS_ARRAY_BUFFER_TYPE:
+ return JSArrayBuffer::kSize;
+ case JS_TYPED_ARRAY_TYPE:
+ return JSTypedArray::kSize;
+ case JS_DATA_VIEW_TYPE:
+ return JSDataView::kSize;
+ case JS_SET_TYPE:
+ return JSSet::kSize;
+ case JS_MAP_TYPE:
+ return JSMap::kSize;
+ case JS_SET_ITERATOR_TYPE:
+ return JSSetIterator::kSize;
+ case JS_MAP_ITERATOR_TYPE:
+ return JSMapIterator::kSize;
+ case JS_WEAK_MAP_TYPE:
+ return JSWeakMap::kSize;
+ case JS_WEAK_SET_TYPE:
+ return JSWeakSet::kSize;
+ case JS_PROMISE_CAPABILITY_TYPE:
+ return JSPromiseCapability::kSize;
+ case JS_PROMISE_TYPE:
+ return JSPromise::kSize;
+ case JS_REGEXP_TYPE:
+ return JSRegExp::kSize;
+ case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
+ return JSObject::kHeaderSize;
+ case JS_MESSAGE_OBJECT_TYPE:
+ return JSMessageObject::kSize;
+ case JS_ARGUMENTS_TYPE:
+ return JSArgumentsObject::kHeaderSize;
+ case JS_ERROR_TYPE:
+ return JSObject::kHeaderSize;
+ case JS_STRING_ITERATOR_TYPE:
+ return JSStringIterator::kSize;
+ case JS_MODULE_NAMESPACE_TYPE:
+ return JSModuleNamespace::kHeaderSize;
+ case WASM_INSTANCE_TYPE:
+ return WasmInstanceObject::kSize;
+ case WASM_MEMORY_TYPE:
+ return WasmMemoryObject::kSize;
+ case WASM_MODULE_TYPE:
+ return WasmModuleObject::kSize;
+ case WASM_TABLE_TYPE:
+ return WasmTableObject::kSize;
+ default:
+ if (type >= FIRST_ARRAY_ITERATOR_TYPE &&
+ type <= LAST_ARRAY_ITERATOR_TYPE) {
+ return JSArrayIterator::kSize;
+ }
+ UNREACHABLE();
+ }
+}
// ES6 9.5.1
// static
@@ -3011,6 +3087,10 @@ VisitorId Map::GetVisitorId(Map* map) {
case JS_PROMISE_CAPABILITY_TYPE:
case JS_PROMISE_TYPE:
+ case WASM_INSTANCE_TYPE:
+ case WASM_MEMORY_TYPE:
+ case WASM_MODULE_TYPE:
+ case WASM_TABLE_TYPE:
case JS_BOUND_FUNCTION_TYPE:
return has_unboxed_fields ? kVisitJSObject : kVisitJSObjectFast;
case JS_API_OBJECT_TYPE:
« no previous file with comments | « src/objects.h ('k') | src/objects-body-descriptors-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698