Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 2856103002: [turbofan] Introduce dedicated CallFrequency class. (Closed)
Patch Set: Address offline feedback from jarin@. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/bytecode-graph-builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index e9628036398b1c19559e5c33c736e591347f0a10..fd2209ed53bcc6419dec58a0b627d0b976248a23 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -268,9 +268,9 @@ class AstGraphBuilder::ControlScopeForIteration : public ControlScope {
LoopBuilder* control_;
};
-
AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info,
- JSGraph* jsgraph, float invocation_frequency,
+ JSGraph* jsgraph,
+ CallFrequency invocation_frequency,
LoopAssignmentAnalysis* loop)
: isolate_(info->isolate()),
local_zone_(local_zone),
@@ -1692,7 +1692,7 @@ void AstGraphBuilder::VisitCall(Call* expr) {
VisitForValues(args);
// Create node to perform the function call.
- float const frequency = ComputeCallFrequency(expr->CallFeedbackICSlot());
+ CallFrequency frequency = ComputeCallFrequency(expr->CallFeedbackICSlot());
VectorSlotPair feedback = CreateVectorSlotPair(expr->CallFeedbackICSlot());
const Operator* call =
javascript()->Call(args->length() + 2, frequency, feedback, receiver_hint,
@@ -1720,7 +1720,7 @@ void AstGraphBuilder::VisitCallNew(CallNew* expr) {
environment()->Push(environment()->Peek(args->length()));
// Create node to perform the construct call.
- float const frequency = ComputeCallFrequency(expr->CallNewFeedbackSlot());
+ CallFrequency frequency = ComputeCallFrequency(expr->CallNewFeedbackSlot());
VectorSlotPair feedback = CreateVectorSlotPair(expr->CallNewFeedbackSlot());
const Operator* call =
javascript()->Construct(args->length() + 2, frequency, feedback);
@@ -2240,12 +2240,15 @@ void AstGraphBuilder::VisitRewritableExpression(RewritableExpression* node) {
Visit(node->expression());
}
-float AstGraphBuilder::ComputeCallFrequency(FeedbackSlot slot) const {
- if (slot.IsInvalid()) return 0.0f;
+CallFrequency AstGraphBuilder::ComputeCallFrequency(FeedbackSlot slot) const {
+ if (invocation_frequency_.IsUnknown() || slot.IsInvalid()) {
+ return CallFrequency();
+ }
Handle<FeedbackVector> feedback_vector(info()->closure()->feedback_vector(),
isolate());
CallICNexus nexus(feedback_vector, slot);
- return nexus.ComputeCallFrequency() * invocation_frequency_;
+ return CallFrequency(nexus.ComputeCallFrequency() *
+ invocation_frequency_.value());
}
Node* AstGraphBuilder::ProcessArguments(const Operator* op, int arity) {
@@ -3156,7 +3159,7 @@ Node* AstGraphBuilder::MergeValue(Node* value, Node* other, Node* control) {
AstGraphBuilderWithPositions::AstGraphBuilderWithPositions(
Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph,
- float invocation_frequency, LoopAssignmentAnalysis* loop_assignment,
+ CallFrequency invocation_frequency, LoopAssignmentAnalysis* loop_assignment,
SourcePositionTable* source_positions, int inlining_id)
: AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency,
loop_assignment),
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/bytecode-graph-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698