}
-Node* AstGraphBuilder::GetFeedbackVector() {
- if (!feedback_vector_.is_set()) {
- Node* vector =
- jsgraph()->Constant(handle(info()->shared_info()->feedback_vector()));
- feedback_vector_.set(vector);
- }
- return feedback_vector_.get();
-}
-
-
void AstGraphBuilder::CreateFunctionContext(bool constant_context) {
function_context_.set(constant_context
? jsgraph()->HeapConstant(info()->context())
uint32_t check_bitset = ComputeBitsetForDynamicGlobal(variable);
const Operator* op = javascript()->LoadDynamicGlobal(
name, check_bitset, feedback, contextual_mode);
- value = NewNode(op, GetFeedbackVector(), current_context());
+ value = NewNode(op, BuildLoadFeedbackVector(), current_context());
states.AddToNode(value, bailout_id, combine);
} else if (mode == DYNAMIC_LOCAL) {
Variable* local = variable->local_if_not_shadowed();
uint32_t check_bitset = DynamicGlobalAccess::kFullCheckRequired;
const Operator* op = javascript()->LoadDynamicGlobal(
name, check_bitset, feedback, contextual_mode);
- value = NewNode(op, GetFeedbackVector(), current_context());
+ value = NewNode(op, BuildLoadFeedbackVector(), current_context());
states.AddToNode(value, bailout_id, combine);
}
return value;
Node* AstGraphBuilder::BuildKeyedLoad(Node* object, Node* key,
const VectorSlotPair& feedback) {
const Operator* op = javascript()->LoadProperty(feedback);
- return Record(js_type_feedback_,
- NewNode(op, object, key, GetFeedbackVector()), feedback.slot());
+ Node* node = NewNode(op, object, key, BuildLoadFeedbackVector());
+ return Record(js_type_feedback_, node, feedback.slot());
}
ContextualMode mode) {
const Operator* op =
javascript()->LoadNamed(MakeUnique(name), feedback, mode);
- return Record(js_type_feedback_, NewNode(op, object, GetFeedbackVector()),
- feedback.slot());
+ Node* node = NewNode(op, object, BuildLoadFeedbackVector());
+ return Record(js_type_feedback_, node, feedback.slot());
}
const VectorSlotPair& feedback,
TypeFeedbackId id) {
const Operator* op = javascript()->StoreProperty(language_mode(), feedback);
- return Record(js_type_feedback_, NewNode(op, object, key, value), id);
+ Node* node = NewNode(op, object, key, value);
+ return Record(js_type_feedback_, node, id);
}
TypeFeedbackId id) {
const Operator* op =
javascript()->StoreNamed(language_mode(), MakeUnique(name), feedback);
- return Record(js_type_feedback_, NewNode(op, object, value), id);
+ Node* node = NewNode(op, object, value);
+ return Record(js_type_feedback_, node, id);
}
const VectorSlotPair& feedback) {
Node* name_node = jsgraph()->Constant(name);
const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper, 3);
- Node* value = NewNode(op, receiver, home_object, name_node);
- return Record(js_type_feedback_, value, feedback.slot());
+ Node* node = NewNode(op, receiver, home_object, name_node);
+ return Record(js_type_feedback_, node, feedback.slot());
}
const VectorSlotPair& feedback) {
const Operator* op =
javascript()->CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
- Node* value = NewNode(op, receiver, home_object, key);
- return Record(js_type_feedback_, value, feedback.slot());
+ Node* node = NewNode(op, receiver, home_object, key);
+ return Record(js_type_feedback_, node, feedback.slot());
}
? Runtime::kStoreKeyedToSuper_Strict
: Runtime::kStoreKeyedToSuper_Sloppy;
const Operator* op = javascript()->CallRuntime(function_id, 4);
- Node* result = NewNode(op, receiver, home_object, key, value);
- return Record(js_type_feedback_, result, id);
+ Node* node = NewNode(op, receiver, home_object, key, value);
+ return Record(js_type_feedback_, node, id);
}
? Runtime::kStoreToSuper_Strict
: Runtime::kStoreToSuper_Sloppy;
const Operator* op = javascript()->CallRuntime(function_id, 4);
- Node* result = NewNode(op, receiver, home_object, name_node, value);
- return Record(js_type_feedback_, result, id);
+ Node* node = NewNode(op, receiver, home_object, name_node, value);
+ return Record(js_type_feedback_, node, id);
}
}
+Node* AstGraphBuilder::BuildLoadImmutableObjectField(Node* object, int offset) {
+ return graph()->NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object,
+ jsgraph()->IntPtrConstant(offset - kHeapObjectTag),
+ graph()->start(), graph()->start());
+}
+
+
Node* AstGraphBuilder::BuildLoadBuiltinsObject() {
Node* global = BuildLoadGlobalObject();
Node* builtins =
}
+Node* AstGraphBuilder::BuildLoadFeedbackVector() {
+ if (!feedback_vector_.is_set()) {
+ Node* closure = GetFunctionClosure();
+ Node* shared = BuildLoadImmutableObjectField(
+ closure, JSFunction::kSharedFunctionInfoOffset);
+ Node* vector = BuildLoadImmutableObjectField(
+ shared, SharedFunctionInfo::kFeedbackVectorOffset);
+ feedback_vector_.set(vector);
+ }
+ return feedback_vector_.get();
+}
+
+
Node* AstGraphBuilder::BuildLoadExternal(ExternalReference reference,
MachineType type) {
return NewNode(jsgraph()->machine()->Load(type),
// Nodes representing values in the activation record.
SetOncePointer<Node> function_closure_;
SetOncePointer<Node> function_context_;
- SetOncePointer<Node> feedback_vector_;
// Tracks how many try-blocks are currently entered.
int try_catch_nesting_level_;
int input_buffer_size_;
Node** input_buffer_;
+ // Optimization to cache loaded feedback vector.
+ SetOncePointer<Node> feedback_vector_;
+
// Control nodes that exit the function body.
ZoneVector<Node*> exit_controls_;
Node* GetFunctionClosureForContext();
Node* GetFunctionClosure();
- // Get or create the node that represents the functions type feedback vector.
- Node* GetFeedbackVector();
-
// Node creation helpers.
Node* NewNode(const Operator* op, bool incomplete = false) {
return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete);
Node* BuildLoadBuiltinsObject();
Node* BuildLoadGlobalObject();
Node* BuildLoadGlobalProxy();
- Node* BuildLoadClosure();
+ Node* BuildLoadFeedbackVector();
+
+ // Builder for accessing a (potentially immutable) object field.
Node* BuildLoadObjectField(Node* object, int offset);
+ Node* BuildLoadImmutableObjectField(Node* object, int offset);
// Builders for accessing external references.
Node* BuildLoadExternal(ExternalReference ref, MachineType type);