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

Unified Diff: src/hydrogen.cc

Issue 961283002: CpuProfiler: do not calculate positions if it is not necessary (BuildCompareInstruction part). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index e37a1cee9a48534007617df4bb11b93b01f6bd2e..6e103684c8c4b71f5f75988563a4564b8223d36a 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4818,10 +4818,13 @@ void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
HControlInstruction* compare = BuildCompareInstruction(
Token::EQ_STRICT, tag_value, label_value, tag_type, label_type,
combined_type,
- ScriptPositionToSourcePosition(stmt->tag()->position()),
- ScriptPositionToSourcePosition(clause->label()->position()),
PUSH_BEFORE_SIMULATE, clause->id());
+ if (FLAG_hydrogen_track_positions) {
+ compare->SetOperandPositions(
+ zone(), ScriptPositionToSourcePosition(stmt->tag()->position()),
+ ScriptPositionToSourcePosition(clause->label()->position()));
+ }
HBasicBlock* next_test_block = graph()->CreateBasicBlock();
HBasicBlock* body_block = graph()->CreateBasicBlock();
body_blocks.Add(body_block, zone());
@@ -10923,19 +10926,21 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
: PUSH_BEFORE_SIMULATE;
HControlInstruction* compare = BuildCompareInstruction(
op, left, right, left_type, right_type, combined_type,
- ScriptPositionToSourcePosition(expr->left()->position()),
- ScriptPositionToSourcePosition(expr->right()->position()),
push_behavior, expr->id());
if (compare == NULL) return; // Bailed out.
+ if (FLAG_hydrogen_track_positions) {
+ compare->SetOperandPositions(
+ zone(), ScriptPositionToSourcePosition(expr->left()->position()),
+ ScriptPositionToSourcePosition(expr->right()->position()));
+ }
return ast_context()->ReturnControl(compare, expr->id());
}
HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction(
Token::Value op, HValue* left, HValue* right, Type* left_type,
- Type* right_type, Type* combined_type, SourcePosition left_position,
- SourcePosition right_position, PushBeforeSimulateBehavior push_sim_result,
- BailoutId bailout_id) {
+ Type* right_type, Type* combined_type,
+ PushBeforeSimulateBehavior push_sim_result, BailoutId bailout_id) {
// Cases handled below depend on collected type feedback. They should
// soft deoptimize when there is no type feedback.
if (!combined_type->IsInhabited()) {
@@ -10970,10 +10975,6 @@ HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction(
AddCheckMap(operand_to_check, map);
HCompareObjectEqAndBranch* result =
New<HCompareObjectEqAndBranch>(left, right);
- if (FLAG_hydrogen_track_positions) {
- result->set_operand_position(zone(), 0, left_position);
- result->set_operand_position(zone(), 1, right_position);
- }
return result;
} else {
BuildCheckHeapObject(operand_to_check);
@@ -11036,9 +11037,6 @@ HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction(
HCompareNumericAndBranch* result =
New<HCompareNumericAndBranch>(left, right, op);
result->set_observed_input_representation(left_rep, right_rep);
- if (FLAG_hydrogen_track_positions) {
- result->SetOperandPositions(zone(), left_position, right_position);
- }
return result;
}
}
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698