Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index 44f2276ee6513231af2bcdd29fa6023323fbcd52..57eb79a7cb73a46207118d5b8a003fb5ff8291cf 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -479,16 +479,6 @@ Node* AstGraphBuilder::GetFunctionClosure() { |
} |
-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()) |
@@ -3293,7 +3283,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, |
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(); |
@@ -3317,7 +3307,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, |
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; |
@@ -3491,8 +3481,8 @@ static inline Node* Record(JSTypeFeedbackTable* js_type_feedback, Node* node, |
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()); |
} |
@@ -3501,8 +3491,8 @@ Node* AstGraphBuilder::BuildNamedLoad(Node* object, Handle<Name> name, |
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()); |
} |
@@ -3510,7 +3500,8 @@ Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value, |
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); |
} |
@@ -3520,7 +3511,8 @@ Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name, |
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); |
} |
@@ -3529,8 +3521,8 @@ Node* AstGraphBuilder::BuildNamedSuperLoad(Node* receiver, Node* home_object, |
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()); |
} |
@@ -3539,8 +3531,8 @@ Node* AstGraphBuilder::BuildKeyedSuperLoad(Node* receiver, Node* home_object, |
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()); |
} |
@@ -3551,8 +3543,8 @@ Node* AstGraphBuilder::BuildKeyedSuperStore(Node* receiver, Node* home_object, |
? 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); |
} |
@@ -3564,8 +3556,8 @@ Node* AstGraphBuilder::BuildNamedSuperStore(Node* receiver, Node* home_object, |
? 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); |
} |
@@ -3575,6 +3567,13 @@ Node* AstGraphBuilder::BuildLoadObjectField(Node* object, int offset) { |
} |
+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 = |
@@ -3598,6 +3597,19 @@ Node* AstGraphBuilder::BuildLoadGlobalProxy() { |
} |
+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), |