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

Unified Diff: src/objects-inl.h

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-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 0781949a3c2320fc9eca93c3920cc313ca7dfa54..77d9ef585d938767e406eb633f5164f3374bf337 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -106,6 +106,10 @@ TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE)
TYPE_CHECKER(JSValue, JS_VALUE_TYPE)
TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE)
TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE)
+TYPE_CHECKER(WasmInstanceObject, WASM_INSTANCE_TYPE)
+TYPE_CHECKER(WasmMemoryObject, WASM_MEMORY_TYPE)
+TYPE_CHECKER(WasmModuleObject, WASM_MODULE_TYPE)
+TYPE_CHECKER(WasmTableObject, WASM_TABLE_TYPE)
TYPE_CHECKER(Map, MAP_TYPE)
TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE)
TYPE_CHECKER(Oddball, ODDBALL_TYPE)
@@ -1476,79 +1480,12 @@ void WeakCell::clear_next(Object* the_hole_value) {
bool WeakCell::next_cleared() { return next()->IsTheHole(GetIsolate()); }
-int JSObject::GetHeaderSize() { return GetHeaderSize(map()->instance_type()); }
-
-
-int JSObject::GetHeaderSize(InstanceType type) {
+int JSObject::GetHeaderSize() {
// Check for the most common kind of JavaScript object before
// falling into the generic switch. This speeds up the internal
// field operations considerably on average.
- if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize;
- switch (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;
- default:
- if (type >= FIRST_ARRAY_ITERATOR_TYPE &&
- type <= LAST_ARRAY_ITERATOR_TYPE) {
- return JSArrayIterator::kSize;
- }
- UNREACHABLE();
- }
+ InstanceType type = map()->instance_type();
+ return type == JS_OBJECT_TYPE ? JSObject::kHeaderSize : GetHeaderSize(type);
}
inline bool IsSpecialReceiverInstanceType(InstanceType instance_type) {
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698