Commit e24f3f3b authored by yangguo's avatar yangguo Committed by Commit bot

Use map to distinguish type feedback vectors.

R=mvstanton@chromium.org, ulan@chromium.org
BUG=v8:5808

Review-Url: https://codereview.chromium.org/2617363003
Cr-Commit-Position: refs/heads/master@{#42137}
parent 7c7e1888
......@@ -2247,6 +2247,7 @@ bool Heap::CreateInitialMaps() {
ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info)
ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, module_info)
ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, type_feedback_vector)
ALLOCATE_PRIMITIVE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number,
Context::NUMBER_FUNCTION_INDEX)
ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize,
......@@ -2775,6 +2776,7 @@ void Heap::CreateInitialObjects() {
empty_fixed_array());
empty_type_feedback_vector->set(TypeFeedbackVector::kInvocationCountIndex,
Smi::kZero);
empty_type_feedback_vector->set_map(type_feedback_vector_map());
set_empty_type_feedback_vector(*empty_type_feedback_vector);
// We use a canonical empty LiteralsArray for all functions that neither
......
......@@ -94,6 +94,7 @@ using v8::MemoryPressureLevel;
V(Map, external_map, ExternalMap) \
V(Map, bytecode_array_map, BytecodeArrayMap) \
V(Map, module_info_map, ModuleInfoMap) \
V(Map, type_feedback_vector_map, TypeFeedbackVectorMap) \
/* String maps */ \
V(Map, native_source_string_map, NativeSourceStringMap) \
V(Map, string_map, StringMap) \
......
......@@ -349,7 +349,9 @@ bool Object::IsLayoutDescriptor() const {
return IsSmi() || IsFixedTypedArrayBase();
}
bool HeapObject::IsTypeFeedbackVector() const { return IsFixedArray(); }
bool HeapObject::IsTypeFeedbackVector() const {
return map() == GetHeap()->type_feedback_vector_map();
}
bool HeapObject::IsTypeFeedbackMetadata() const { return IsFixedArray(); }
......
......@@ -27,7 +27,7 @@ FeedbackVectorSlot FeedbackVectorSpecBase<Derived>::AddSlot(
// static
TypeFeedbackMetadata* TypeFeedbackMetadata::cast(Object* obj) {
DCHECK(obj->IsTypeFeedbackVector());
DCHECK(obj->IsTypeFeedbackMetadata());
return reinterpret_cast<TypeFeedbackMetadata*>(obj);
}
......
......@@ -191,6 +191,7 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New(
}
Handle<FixedArray> array = factory->NewFixedArray(length, TENURED);
array->set_map_no_write_barrier(isolate->heap()->type_feedback_vector_map());
array->set(kMetadataIndex, *metadata);
array->set(kInvocationCountIndex, Smi::kZero);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment