"src/transitions-inl.h",
"src/transitions.cc",
"src/transitions.h",
+ "src/type-feedback-vector.cc",
+ "src/type-feedback-vector.h",
"src/type-info.cc",
"src/type-info.h",
"src/types-inl.h",
if (FLAG_vector_ics) {
// Apply embeds an IC, so we need a type vector of size 1 in the shared
// function info.
- Handle<FixedArray> feedback_vector = factory()->NewTypeFeedbackVector(1);
+ Handle<TypeFeedbackVector> feedback_vector =
+ factory()->NewTypeFeedbackVector(1);
apply->shared()->set_feedback_vector(*feedback_vector);
}
if (!shared_info().is_null() && shared_info()->is_compiled()) {
// We should initialize the CompilationInfo feedback vector from the
// passed in shared info, rather than creating a new one.
- feedback_vector_ = Handle<FixedArray>(shared_info()->feedback_vector(),
- isolate);
+ feedback_vector_ =
+ Handle<TypeFeedbackVector>(shared_info()->feedback_vector(), isolate);
}
}
DCHECK(global_scope_ == NULL);
global_scope_ = global_scope;
}
- Handle<FixedArray> feedback_vector() const {
+ Handle<TypeFeedbackVector> feedback_vector() const {
return feedback_vector_;
}
void SetCode(Handle<Code> code) { code_ = code; }
Handle<Context> context_;
// Used by codegen, ultimately kept rooted by the SharedFunctionInfo.
- Handle<FixedArray> feedback_vector_;
+ Handle<TypeFeedbackVector> feedback_vector_;
// Compilation mode flag and whether deoptimization is allowed.
Mode mode_;
}
-Handle<FixedArray> Factory::NewTypeFeedbackVector(int slot_count) {
+Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector(int slot_count) {
// Ensure we can skip the write barrier
DCHECK_EQ(isolate()->heap()->uninitialized_symbol(),
*TypeFeedbackInfo::UninitializedSentinel(isolate()));
- CALL_HEAP_FUNCTION(
- isolate(),
- isolate()->heap()->AllocateFixedArrayWithFiller(
- slot_count,
- TENURED,
- *TypeFeedbackInfo::UninitializedSentinel(isolate())),
- FixedArray);
+ if (slot_count == 0) {
+ return Handle<TypeFeedbackVector>::cast(empty_fixed_array());
+ }
+
+ CALL_HEAP_FUNCTION(isolate(),
+ isolate()->heap()->AllocateFixedArrayWithFiller(
+ slot_count, TENURED,
+ *TypeFeedbackInfo::UninitializedSentinel(isolate())),
+ TypeFeedbackVector);
}
Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
Handle<String> name, int number_of_literals, FunctionKind kind,
Handle<Code> code, Handle<ScopeInfo> scope_info,
- Handle<FixedArray> feedback_vector) {
+ Handle<TypeFeedbackVector> feedback_vector) {
DCHECK(IsValidFunctionKind(kind));
Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code);
shared->set_scope_info(*scope_info);
share->set_script(*undefined_value(), SKIP_WRITE_BARRIER);
share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER);
share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER);
- share->set_feedback_vector(*empty_fixed_array(), SKIP_WRITE_BARRIER);
+ share->set_feedback_vector(*NewTypeFeedbackVector(0), SKIP_WRITE_BARRIER);
share->set_profiler_ticks(0);
share->set_ast_node_count(0);
share->set_counters(0);
Handle<SharedFunctionInfo> NewSharedFunctionInfo(
Handle<String> name, int number_of_literals, FunctionKind kind,
Handle<Code> code, Handle<ScopeInfo> scope_info,
- Handle<FixedArray> feedback_vector);
+ Handle<TypeFeedbackVector> feedback_vector);
Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name,
MaybeHandle<Code> code);
// Allocate a new type feedback vector
- Handle<FixedArray> NewTypeFeedbackVector(int slot_count);
+ Handle<TypeFeedbackVector> NewTypeFeedbackVector(int slot_count);
// Allocates a new JSMessageObject object.
Handle<JSMessageObject> NewJSMessageObject(
isolate()->factory()->NewSharedFunctionInfo(
name, literals, FunctionKind::kNormalFunction, code,
Handle<ScopeInfo>(fun->shared()->scope_info()),
- Handle<FixedArray>(fun->shared()->feedback_vector()));
+ Handle<TypeFeedbackVector>(fun->shared()->feedback_vector()));
shared->set_construct_stub(*construct_stub);
// Copy the function data to the shared function info.
}
-Handle<FixedArray> FunctionInfoWrapper::GetFeedbackVector() {
+Handle<TypeFeedbackVector> FunctionInfoWrapper::GetFeedbackVector() {
Handle<Object> element = this->GetField(kSharedFunctionInfoOffset_);
- Handle<FixedArray> result;
+ Handle<TypeFeedbackVector> result;
if (element->IsJSValue()) {
Handle<JSValue> value_wrapper = Handle<JSValue>::cast(element);
Handle<Object> raw_result = UnwrapJSValue(value_wrapper);
Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>::cast(raw_result);
- result = Handle<FixedArray>(shared->feedback_vector(), isolate());
+ result = Handle<TypeFeedbackVector>(shared->feedback_vector(), isolate());
CHECK_EQ(result->length(), GetSlotCount());
} else {
// Scripts may never have a SharedFunctionInfo created, so
}
shared_info->DisableOptimization(kLiveEdit);
// Update the type feedback vector
- Handle<FixedArray> feedback_vector =
+ Handle<TypeFeedbackVector> feedback_vector =
compile_info_wrapper.GetFeedbackVector();
shared_info->set_feedback_vector(*feedback_vector);
}
Handle<Code> GetFunctionCode();
- Handle<FixedArray> GetFeedbackVector();
+ Handle<TypeFeedbackVector> GetFeedbackVector();
Handle<Object> GetCodeScopeInfo();
#include "src/property.h"
#include "src/prototype.h"
#include "src/transitions-inl.h"
+#include "src/type-feedback-vector.h"
#include "src/v8memory.h"
namespace v8 {
}
+bool Object::IsTypeFeedbackVector() const { return IsFixedArray(); }
+
+
bool Object::IsDeoptimizationInputData() const {
// Must be a fixed array.
if (!IsFixedArray()) return false;
ACCESSORS(SharedFunctionInfo, optimized_code_map, Object,
kOptimizedCodeMapOffset)
ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
-ACCESSORS(SharedFunctionInfo, feedback_vector, FixedArray,
+ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector,
kFeedbackVectorOffset)
ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
kInstanceClassNameOffset)
// - OrderedHashSet
// - OrderedHashMap
// - Context
+// - TypeFeedbackVector
// - JSFunctionResultCache
// - ScopeInfo
// - TransitionArray
class ObjectVisitor;
class LookupIterator;
class StringStream;
+class TypeFeedbackVector;
// We cannot just say "class HeapType;" if it is created from a template... =8-?
template<class> class TypeImpl;
struct HeapTypeConfig;
V(Map) \
V(DescriptorArray) \
V(TransitionArray) \
+ V(TypeFeedbackVector) \
V(DeoptimizationInputData) \
V(DeoptimizationOutputData) \
V(DependentCode) \
// [feedback_vector] - accumulates ast node feedback from full-codegen and
// (increasingly) from crankshafted code where sufficient feedback isn't
- // available. Currently the field is duplicated in
- // TypeFeedbackInfo::feedback_vector, but the allocation is done here.
- DECL_ACCESSORS(feedback_vector, FixedArray)
+ // available.
+ DECL_ACCESSORS(feedback_vector, TypeFeedbackVector)
// [instance class name]: class name for instances.
DECL_ACCESSORS(instance_class_name, Object)
--- /dev/null
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/v8.h"
+
+#include "src/objects.h"
+#include "src/type-feedback-vector.h"
+
+namespace v8 {
+namespace internal {
+
+// static
+Handle<TypeFeedbackVector> TypeFeedbackVector::Copy(
+ Isolate* isolate, Handle<TypeFeedbackVector> vector) {
+ Handle<TypeFeedbackVector> result;
+ result = Handle<TypeFeedbackVector>::cast(
+ isolate->factory()->CopyFixedArray(Handle<FixedArray>::cast(vector)));
+ return result;
+}
+}
+} // namespace v8::internal
--- /dev/null
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_TYPE_FEEDBACK_VECTOR_H_
+#define V8_TYPE_FEEDBACK_VECTOR_H_
+
+#include "src/checks.h"
+#include "src/elements-kind.h"
+#include "src/heap/heap.h"
+#include "src/isolate.h"
+#include "src/objects.h"
+
+namespace v8 {
+namespace internal {
+
+class TypeFeedbackVector : public FixedArray {
+ public:
+ // Casting.
+ static TypeFeedbackVector* cast(Object* obj) {
+ DCHECK(obj->IsTypeFeedbackVector());
+ return reinterpret_cast<TypeFeedbackVector*>(obj);
+ }
+
+ static Handle<TypeFeedbackVector> Copy(Isolate* isolate,
+ Handle<TypeFeedbackVector> vector);
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackVector);
+};
+}
+} // namespace v8::internal
+
+#endif // V8_TRANSITIONS_H_
namespace internal {
-TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code,
- Handle<FixedArray> feedback_vector,
- Handle<Context> native_context,
- Zone* zone)
- : native_context_(native_context),
- zone_(zone) {
+TypeFeedbackOracle::TypeFeedbackOracle(
+ Handle<Code> code, Handle<TypeFeedbackVector> feedback_vector,
+ Handle<Context> native_context, Zone* zone)
+ : native_context_(native_context), zone_(zone) {
BuildDictionary(code);
DCHECK(dictionary_->IsDictionary());
// We make a copy of the feedback vector because a GC could clear
// the type feedback info contained therein.
// TODO(mvstanton): revisit the decision to copy when we weakly
// traverse the feedback vector at GC time.
- feedback_vector_ = isolate()->factory()->CopyFixedArray(feedback_vector);
+ feedback_vector_ = TypeFeedbackVector::Copy(isolate(), feedback_vector);
}
class TypeFeedbackOracle: public ZoneObject {
public:
TypeFeedbackOracle(Handle<Code> code,
- Handle<FixedArray> feedback_vector,
- Handle<Context> native_context,
- Zone* zone);
+ Handle<TypeFeedbackVector> feedback_vector,
+ Handle<Context> native_context, Zone* zone);
bool LoadIsUninitialized(TypeFeedbackId id);
bool StoreIsUninitialized(TypeFeedbackId id);
Handle<Context> native_context_;
Zone* zone_;
Handle<UnseededNumberDictionary> dictionary_;
- Handle<FixedArray> feedback_vector_;
+ Handle<TypeFeedbackVector> feedback_vector_;
DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle);
};
'../../src/transitions-inl.h',
'../../src/transitions.cc',
'../../src/transitions.h',
+ '../../src/type-feedback-vector.cc',
+ '../../src/type-feedback-vector.h',
'../../src/type-info.cc',
'../../src/type-info.h',
'../../src/types-inl.h',