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

Unified Diff: src/objects-inl.h

Issue 1480873003: Introduce instance type for transition arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix zapping Created 5 years, 1 month 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 b39bf682c3d9db8a14fb02740c95547735a14182..df56d5ce5b14260ad439532e45f1ceda5cb473ca 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -134,6 +134,14 @@ bool Object::IsFixedArrayBase() const {
}
+bool Object::IsFixedArray() const {
+ if (!IsHeapObject()) return false;
+ InstanceType instance_type = HeapObject::cast(this)->map()->instance_type();
+ return instance_type == FIXED_ARRAY_TYPE ||
+ instance_type == TRANSITION_ARRAY_TYPE;
+}
+
+
// External objects are not extensible, so the map check is enough.
bool Object::IsExternal() const {
return Object::IsHeapObject() &&
@@ -717,9 +725,9 @@ TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE)
TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE)
TYPE_CHECKER(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE)
TYPE_CHECKER(Map, MAP_TYPE)
-TYPE_CHECKER(FixedArray, FIXED_ARRAY_TYPE)
TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE)
TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE)
+TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE)
bool Object::IsJSWeakCollection() const {
@@ -740,11 +748,6 @@ bool Object::IsLayoutDescriptor() const {
}
-bool Object::IsTransitionArray() const {
- return IsFixedArray();
-}
-
-
bool Object::IsTypeFeedbackVector() const { return IsFixedArray(); }
@@ -2406,7 +2409,7 @@ void FixedArray::set(int index, Smi* value) {
void FixedArray::set(int index, Object* value) {
DCHECK_NE(GetHeap()->fixed_cow_array_map(), map());
- DCHECK_EQ(FIXED_ARRAY_TYPE, map()->instance_type());
+ DCHECK(IsFixedArray());
DCHECK(index >= 0 && index < this->length());
int offset = kHeaderSize + index * kPointerSize;
WRITE_FIELD(this, offset, value);
@@ -4456,7 +4459,8 @@ int HeapObject::SizeFromMap(Map* map) {
if (instance_size != kVariableSizeSentinel) return instance_size;
// Only inline the most frequent cases.
InstanceType instance_type = map->instance_type();
- if (instance_type == FIXED_ARRAY_TYPE) {
+ if (instance_type == FIXED_ARRAY_TYPE ||
+ instance_type == TRANSITION_ARRAY_TYPE) {
return FixedArray::SizeFor(
reinterpret_cast<FixedArray*>(this)->synchronized_length());
}
« 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