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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-body-descriptors-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 Heap* heap = object->GetHeap(); 1283 Heap* heap = object->GetHeap();
1284 if (raw_elems->map() != heap->fixed_cow_array_map()) return; 1284 if (raw_elems->map() != heap->fixed_cow_array_map()) return;
1285 Isolate* isolate = heap->isolate(); 1285 Isolate* isolate = heap->isolate();
1286 Handle<FixedArray> elems(raw_elems, isolate); 1286 Handle<FixedArray> elems(raw_elems, isolate);
1287 Handle<FixedArray> writable_elems = isolate->factory()->CopyFixedArrayWithMap( 1287 Handle<FixedArray> writable_elems = isolate->factory()->CopyFixedArrayWithMap(
1288 elems, isolate->factory()->fixed_array_map()); 1288 elems, isolate->factory()->fixed_array_map());
1289 object->set_elements(*writable_elems); 1289 object->set_elements(*writable_elems);
1290 isolate->counters()->cow_arrays_converted()->Increment(); 1290 isolate->counters()->cow_arrays_converted()->Increment();
1291 } 1291 }
1292 1292
1293 int JSObject::GetHeaderSize(InstanceType type) {
1294 switch (type) {
1295 case JS_OBJECT_TYPE:
1296 case JS_API_OBJECT_TYPE:
1297 case JS_SPECIAL_API_OBJECT_TYPE:
1298 return JSObject::kHeaderSize;
1299 case JS_GENERATOR_OBJECT_TYPE:
1300 return JSGeneratorObject::kSize;
1301 case JS_ASYNC_GENERATOR_OBJECT_TYPE:
1302 return JSAsyncGeneratorObject::kSize;
1303 case JS_GLOBAL_PROXY_TYPE:
1304 return JSGlobalProxy::kSize;
1305 case JS_GLOBAL_OBJECT_TYPE:
1306 return JSGlobalObject::kSize;
1307 case JS_BOUND_FUNCTION_TYPE:
1308 return JSBoundFunction::kSize;
1309 case JS_FUNCTION_TYPE:
1310 return JSFunction::kSize;
1311 case JS_VALUE_TYPE:
1312 return JSValue::kSize;
1313 case JS_DATE_TYPE:
1314 return JSDate::kSize;
1315 case JS_ARRAY_TYPE:
1316 return JSArray::kSize;
1317 case JS_ARRAY_BUFFER_TYPE:
1318 return JSArrayBuffer::kSize;
1319 case JS_TYPED_ARRAY_TYPE:
1320 return JSTypedArray::kSize;
1321 case JS_DATA_VIEW_TYPE:
1322 return JSDataView::kSize;
1323 case JS_SET_TYPE:
1324 return JSSet::kSize;
1325 case JS_MAP_TYPE:
1326 return JSMap::kSize;
1327 case JS_SET_ITERATOR_TYPE:
1328 return JSSetIterator::kSize;
1329 case JS_MAP_ITERATOR_TYPE:
1330 return JSMapIterator::kSize;
1331 case JS_WEAK_MAP_TYPE:
1332 return JSWeakMap::kSize;
1333 case JS_WEAK_SET_TYPE:
1334 return JSWeakSet::kSize;
1335 case JS_PROMISE_CAPABILITY_TYPE:
1336 return JSPromiseCapability::kSize;
1337 case JS_PROMISE_TYPE:
1338 return JSPromise::kSize;
1339 case JS_REGEXP_TYPE:
1340 return JSRegExp::kSize;
1341 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1342 return JSObject::kHeaderSize;
1343 case JS_MESSAGE_OBJECT_TYPE:
1344 return JSMessageObject::kSize;
1345 case JS_ARGUMENTS_TYPE:
1346 return JSArgumentsObject::kHeaderSize;
1347 case JS_ERROR_TYPE:
1348 return JSObject::kHeaderSize;
1349 case JS_STRING_ITERATOR_TYPE:
1350 return JSStringIterator::kSize;
1351 case JS_MODULE_NAMESPACE_TYPE:
1352 return JSModuleNamespace::kHeaderSize;
1353 case WASM_INSTANCE_TYPE:
1354 return WasmInstanceObject::kSize;
1355 case WASM_MEMORY_TYPE:
1356 return WasmMemoryObject::kSize;
1357 case WASM_MODULE_TYPE:
1358 return WasmModuleObject::kSize;
1359 case WASM_TABLE_TYPE:
1360 return WasmTableObject::kSize;
1361 default:
1362 if (type >= FIRST_ARRAY_ITERATOR_TYPE &&
1363 type <= LAST_ARRAY_ITERATOR_TYPE) {
1364 return JSArrayIterator::kSize;
1365 }
1366 UNREACHABLE();
1367 }
1368 }
1293 1369
1294 // ES6 9.5.1 1370 // ES6 9.5.1
1295 // static 1371 // static
1296 MaybeHandle<Object> JSProxy::GetPrototype(Handle<JSProxy> proxy) { 1372 MaybeHandle<Object> JSProxy::GetPrototype(Handle<JSProxy> proxy) {
1297 Isolate* isolate = proxy->GetIsolate(); 1373 Isolate* isolate = proxy->GetIsolate();
1298 Handle<String> trap_name = isolate->factory()->getPrototypeOf_string(); 1374 Handle<String> trap_name = isolate->factory()->getPrototypeOf_string();
1299 1375
1300 STACK_CHECK(isolate, MaybeHandle<Object>()); 1376 STACK_CHECK(isolate, MaybeHandle<Object>());
1301 1377
1302 // 1. Let handler be the value of the [[ProxyHandler]] internal slot. 1378 // 1. Let handler be the value of the [[ProxyHandler]] internal slot.
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after
3004 case JS_FAST_SMI_ARRAY_VALUE_ITERATOR_TYPE: 3080 case JS_FAST_SMI_ARRAY_VALUE_ITERATOR_TYPE:
3005 case JS_FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_TYPE: 3081 case JS_FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_TYPE:
3006 case JS_FAST_ARRAY_VALUE_ITERATOR_TYPE: 3082 case JS_FAST_ARRAY_VALUE_ITERATOR_TYPE:
3007 case JS_FAST_HOLEY_ARRAY_VALUE_ITERATOR_TYPE: 3083 case JS_FAST_HOLEY_ARRAY_VALUE_ITERATOR_TYPE:
3008 case JS_FAST_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: 3084 case JS_FAST_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE:
3009 case JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: 3085 case JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE:
3010 case JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE: 3086 case JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE:
3011 3087
3012 case JS_PROMISE_CAPABILITY_TYPE: 3088 case JS_PROMISE_CAPABILITY_TYPE:
3013 case JS_PROMISE_TYPE: 3089 case JS_PROMISE_TYPE:
3090 case WASM_INSTANCE_TYPE:
3091 case WASM_MEMORY_TYPE:
3092 case WASM_MODULE_TYPE:
3093 case WASM_TABLE_TYPE:
3014 case JS_BOUND_FUNCTION_TYPE: 3094 case JS_BOUND_FUNCTION_TYPE:
3015 return has_unboxed_fields ? kVisitJSObject : kVisitJSObjectFast; 3095 return has_unboxed_fields ? kVisitJSObject : kVisitJSObjectFast;
3016 case JS_API_OBJECT_TYPE: 3096 case JS_API_OBJECT_TYPE:
3017 case JS_SPECIAL_API_OBJECT_TYPE: 3097 case JS_SPECIAL_API_OBJECT_TYPE:
3018 return kVisitJSApiObject; 3098 return kVisitJSApiObject;
3019 3099
3020 case JS_FUNCTION_TYPE: 3100 case JS_FUNCTION_TYPE:
3021 return kVisitJSFunction; 3101 return kVisitJSFunction;
3022 3102
3023 case FILLER_TYPE: 3103 case FILLER_TYPE:
(...skipping 17104 matching lines...) Expand 10 before | Expand all | Expand 10 after
20128 // not 20208 // not
20129 // depend on this. 20209 // depend on this.
20130 return DICTIONARY_ELEMENTS; 20210 return DICTIONARY_ELEMENTS;
20131 } 20211 }
20132 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20212 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20133 return kind; 20213 return kind;
20134 } 20214 }
20135 } 20215 }
20136 } // namespace internal 20216 } // namespace internal
20137 } // namespace v8 20217 } // namespace v8
OLDNEW
« 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