Index: src/compiler/bytecode-graph-builder.cc |
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc |
index a7a1cb58f40c883488876446f3ddba8fe70121cc..683bd1e9a930c2c4cc601eff53f0266958b8eee7 100644 |
--- a/src/compiler/bytecode-graph-builder.cc |
+++ b/src/compiler/bytecode-graph-builder.cc |
@@ -1177,8 +1177,9 @@ void BytecodeGraphBuilder::BuildCall(TailCallMode tail_call_mode) { |
VectorSlotPair feedback = |
CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); |
+ float const frequency = ComputeCallFrequency(); |
const Operator* call = javascript()->CallFunction( |
- arg_count + 1, feedback, receiver_hint, tail_call_mode); |
+ arg_count + 1, frequency, feedback, receiver_hint, tail_call_mode); |
Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); |
environment()->BindAccumulator(value, &states); |
} |
@@ -1287,8 +1288,9 @@ void BytecodeGraphBuilder::VisitNew() { |
Node* new_target = environment()->LookupAccumulator(); |
Node* callee = environment()->LookupRegister(callee_reg); |
- const Operator* call = |
- javascript()->CallConstruct(static_cast<int>(arg_count) + 2, feedback); |
+ float const frequency = ComputeCallFrequency(); |
+ const Operator* call = javascript()->CallConstruct( |
+ static_cast<int>(arg_count) + 2, frequency, feedback); |
Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, |
arg_count + 2); |
environment()->BindAccumulator(value, &states); |
@@ -1359,6 +1361,15 @@ CompareOperationHint BytecodeGraphBuilder::GetCompareOperationHint() { |
return hint; |
} |
+float BytecodeGraphBuilder::ComputeCallFrequency() const { |
+ if (int const slot_index = bytecode_iterator().GetIndexOperand(3)) { |
rmcilroy
2016/09/12 09:05:41
Drive-by-nit. Not super keen on this getting the b
Benedikt Meurer
2016/09/13 17:45:07
Done.
|
+ FeedbackVectorSlot const slot = feedback_vector()->ToSlot(slot_index + 1); |
+ Object* const feedback_extra = feedback_vector()->Get(slot); |
+ if (feedback_extra->IsSmi()) return Smi::cast(feedback_extra)->value(); |
+ } |
+ return 0.0f; |
+} |
+ |
void BytecodeGraphBuilder::VisitAdd() { |
BuildBinaryOp( |
javascript()->Add(GetBinaryOperationHint(kBinaryOperationHintIndex))); |