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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 TYPE_CHECKER(JSPromise, JS_PROMISE_TYPE) 99 TYPE_CHECKER(JSPromise, JS_PROMISE_TYPE)
100 TYPE_CHECKER(JSRegExp, JS_REGEXP_TYPE) 100 TYPE_CHECKER(JSRegExp, JS_REGEXP_TYPE)
101 TYPE_CHECKER(JSSet, JS_SET_TYPE) 101 TYPE_CHECKER(JSSet, JS_SET_TYPE)
102 TYPE_CHECKER(JSSetIterator, JS_SET_ITERATOR_TYPE) 102 TYPE_CHECKER(JSSetIterator, JS_SET_ITERATOR_TYPE)
103 TYPE_CHECKER(JSAsyncFromSyncIterator, JS_ASYNC_FROM_SYNC_ITERATOR_TYPE) 103 TYPE_CHECKER(JSAsyncFromSyncIterator, JS_ASYNC_FROM_SYNC_ITERATOR_TYPE)
104 TYPE_CHECKER(JSStringIterator, JS_STRING_ITERATOR_TYPE) 104 TYPE_CHECKER(JSStringIterator, JS_STRING_ITERATOR_TYPE)
105 TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE) 105 TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE)
106 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) 106 TYPE_CHECKER(JSValue, JS_VALUE_TYPE)
107 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE) 107 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE)
108 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE) 108 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE)
109 TYPE_CHECKER(WasmInstanceObject, WASM_INSTANCE_TYPE)
110 TYPE_CHECKER(WasmMemoryObject, WASM_MEMORY_TYPE)
111 TYPE_CHECKER(WasmModuleObject, WASM_MODULE_TYPE)
112 TYPE_CHECKER(WasmTableObject, WASM_TABLE_TYPE)
109 TYPE_CHECKER(Map, MAP_TYPE) 113 TYPE_CHECKER(Map, MAP_TYPE)
110 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) 114 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE)
111 TYPE_CHECKER(Oddball, ODDBALL_TYPE) 115 TYPE_CHECKER(Oddball, ODDBALL_TYPE)
112 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) 116 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE)
113 TYPE_CHECKER(SourcePositionTableWithFrameCache, TUPLE2_TYPE) 117 TYPE_CHECKER(SourcePositionTableWithFrameCache, TUPLE2_TYPE)
114 TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE) 118 TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE)
115 TYPE_CHECKER(TypeFeedbackInfo, TUPLE3_TYPE) 119 TYPE_CHECKER(TypeFeedbackInfo, TUPLE3_TYPE)
116 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) 120 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE)
117 TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE) 121 TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE)
118 TYPE_CHECKER(SmallOrderedHashSet, SMALL_ORDERED_HASH_SET_TYPE) 122 TYPE_CHECKER(SmallOrderedHashSet, SMALL_ORDERED_HASH_SET_TYPE)
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 } 1473 }
1470 1474
1471 1475
1472 void WeakCell::clear_next(Object* the_hole_value) { 1476 void WeakCell::clear_next(Object* the_hole_value) {
1473 DCHECK_EQ(GetHeap()->the_hole_value(), the_hole_value); 1477 DCHECK_EQ(GetHeap()->the_hole_value(), the_hole_value);
1474 set_next(the_hole_value, SKIP_WRITE_BARRIER); 1478 set_next(the_hole_value, SKIP_WRITE_BARRIER);
1475 } 1479 }
1476 1480
1477 bool WeakCell::next_cleared() { return next()->IsTheHole(GetIsolate()); } 1481 bool WeakCell::next_cleared() { return next()->IsTheHole(GetIsolate()); }
1478 1482
1479 int JSObject::GetHeaderSize() { return GetHeaderSize(map()->instance_type()); } 1483 int JSObject::GetHeaderSize() {
1480
1481
1482 int JSObject::GetHeaderSize(InstanceType type) {
1483 // Check for the most common kind of JavaScript object before 1484 // Check for the most common kind of JavaScript object before
1484 // falling into the generic switch. This speeds up the internal 1485 // falling into the generic switch. This speeds up the internal
1485 // field operations considerably on average. 1486 // field operations considerably on average.
1486 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; 1487 InstanceType type = map()->instance_type();
1487 switch (type) { 1488 return type == JS_OBJECT_TYPE ? JSObject::kHeaderSize : GetHeaderSize(type);
1488 case JS_API_OBJECT_TYPE:
1489 case JS_SPECIAL_API_OBJECT_TYPE:
1490 return JSObject::kHeaderSize;
1491 case JS_GENERATOR_OBJECT_TYPE:
1492 return JSGeneratorObject::kSize;
1493 case JS_ASYNC_GENERATOR_OBJECT_TYPE:
1494 return JSAsyncGeneratorObject::kSize;
1495 case JS_GLOBAL_PROXY_TYPE:
1496 return JSGlobalProxy::kSize;
1497 case JS_GLOBAL_OBJECT_TYPE:
1498 return JSGlobalObject::kSize;
1499 case JS_BOUND_FUNCTION_TYPE:
1500 return JSBoundFunction::kSize;
1501 case JS_FUNCTION_TYPE:
1502 return JSFunction::kSize;
1503 case JS_VALUE_TYPE:
1504 return JSValue::kSize;
1505 case JS_DATE_TYPE:
1506 return JSDate::kSize;
1507 case JS_ARRAY_TYPE:
1508 return JSArray::kSize;
1509 case JS_ARRAY_BUFFER_TYPE:
1510 return JSArrayBuffer::kSize;
1511 case JS_TYPED_ARRAY_TYPE:
1512 return JSTypedArray::kSize;
1513 case JS_DATA_VIEW_TYPE:
1514 return JSDataView::kSize;
1515 case JS_SET_TYPE:
1516 return JSSet::kSize;
1517 case JS_MAP_TYPE:
1518 return JSMap::kSize;
1519 case JS_SET_ITERATOR_TYPE:
1520 return JSSetIterator::kSize;
1521 case JS_MAP_ITERATOR_TYPE:
1522 return JSMapIterator::kSize;
1523 case JS_WEAK_MAP_TYPE:
1524 return JSWeakMap::kSize;
1525 case JS_WEAK_SET_TYPE:
1526 return JSWeakSet::kSize;
1527 case JS_PROMISE_CAPABILITY_TYPE:
1528 return JSPromiseCapability::kSize;
1529 case JS_PROMISE_TYPE:
1530 return JSPromise::kSize;
1531 case JS_REGEXP_TYPE:
1532 return JSRegExp::kSize;
1533 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1534 return JSObject::kHeaderSize;
1535 case JS_MESSAGE_OBJECT_TYPE:
1536 return JSMessageObject::kSize;
1537 case JS_ARGUMENTS_TYPE:
1538 return JSArgumentsObject::kHeaderSize;
1539 case JS_ERROR_TYPE:
1540 return JSObject::kHeaderSize;
1541 case JS_STRING_ITERATOR_TYPE:
1542 return JSStringIterator::kSize;
1543 case JS_MODULE_NAMESPACE_TYPE:
1544 return JSModuleNamespace::kHeaderSize;
1545 default:
1546 if (type >= FIRST_ARRAY_ITERATOR_TYPE &&
1547 type <= LAST_ARRAY_ITERATOR_TYPE) {
1548 return JSArrayIterator::kSize;
1549 }
1550 UNREACHABLE();
1551 }
1552 } 1489 }
1553 1490
1554 inline bool IsSpecialReceiverInstanceType(InstanceType instance_type) { 1491 inline bool IsSpecialReceiverInstanceType(InstanceType instance_type) {
1555 return instance_type <= LAST_SPECIAL_RECEIVER_TYPE; 1492 return instance_type <= LAST_SPECIAL_RECEIVER_TYPE;
1556 } 1493 }
1557 1494
1558 // static 1495 // static
1559 int JSObject::GetEmbedderFieldCount(const Map* map) { 1496 int JSObject::GetEmbedderFieldCount(const Map* map) {
1560 int instance_size = map->instance_size(); 1497 int instance_size = map->instance_size();
1561 if (instance_size == kVariableSizeSentinel) return 0; 1498 if (instance_size == kVariableSizeSentinel) return 0;
(...skipping 4739 matching lines...) Expand 10 before | Expand all | Expand 10 after
6301 6238
6302 ACCESSORS(JSStringIterator, string, String, kStringOffset) 6239 ACCESSORS(JSStringIterator, string, String, kStringOffset)
6303 SMI_ACCESSORS(JSStringIterator, index, kNextIndexOffset) 6240 SMI_ACCESSORS(JSStringIterator, index, kNextIndexOffset)
6304 6241
6305 } // namespace internal 6242 } // namespace internal
6306 } // namespace v8 6243 } // namespace v8
6307 6244
6308 #include "src/objects/object-macros-undef.h" 6245 #include "src/objects/object-macros-undef.h"
6309 6246
6310 #endif // V8_OBJECTS_INL_H_ 6247 #endif // V8_OBJECTS_INL_H_
OLDNEW
« 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