OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/bytecode-branch-analysis.h" | 10 #include "src/compiler/bytecode-branch-analysis.h" |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
564 output_poke_start, output_poke_end) && | 564 output_poke_start, output_poke_end) && |
565 StateValuesAreUpToDate(®isters_state_values_, register_base(), | 565 StateValuesAreUpToDate(®isters_state_values_, register_base(), |
566 register_count(), output_poke_start, | 566 register_count(), output_poke_start, |
567 output_poke_end, kCached) && | 567 output_poke_end, kCached) && |
568 StateValuesAreUpToDate(&accumulator_state_values_, accumulator_base(), | 568 StateValuesAreUpToDate(&accumulator_state_values_, accumulator_base(), |
569 1, output_poke_start, output_poke_end); | 569 1, output_poke_start, output_poke_end); |
570 } | 570 } |
571 | 571 |
572 BytecodeGraphBuilder::BytecodeGraphBuilder(Zone* local_zone, | 572 BytecodeGraphBuilder::BytecodeGraphBuilder(Zone* local_zone, |
573 CompilationInfo* info, | 573 CompilationInfo* info, |
574 JSGraph* jsgraph) | 574 JSGraph* jsgraph, |
575 float invocation_frequency) | |
575 : local_zone_(local_zone), | 576 : local_zone_(local_zone), |
576 jsgraph_(jsgraph), | 577 jsgraph_(jsgraph), |
578 invocation_frequency_(invocation_frequency), | |
577 bytecode_array_(handle(info->shared_info()->bytecode_array())), | 579 bytecode_array_(handle(info->shared_info()->bytecode_array())), |
578 exception_handler_table_( | 580 exception_handler_table_( |
579 handle(HandlerTable::cast(bytecode_array()->handler_table()))), | 581 handle(HandlerTable::cast(bytecode_array()->handler_table()))), |
580 feedback_vector_(handle(info->closure()->feedback_vector())), | 582 feedback_vector_(handle(info->closure()->feedback_vector())), |
581 frame_state_function_info_(common()->CreateFrameStateFunctionInfo( | 583 frame_state_function_info_(common()->CreateFrameStateFunctionInfo( |
582 FrameStateType::kInterpretedFunction, | 584 FrameStateType::kInterpretedFunction, |
583 bytecode_array()->parameter_count(), | 585 bytecode_array()->parameter_count(), |
584 bytecode_array()->register_count(), info->shared_info())), | 586 bytecode_array()->register_count(), info->shared_info())), |
585 osr_ast_id_(info->osr_ast_id()), | 587 osr_ast_id_(info->osr_ast_id()), |
586 merge_environments_(local_zone), | 588 merge_environments_(local_zone), |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1347 CompareOperationHint hint = CompareOperationHint::kAny; | 1349 CompareOperationHint hint = CompareOperationHint::kAny; |
1348 if (feedback->IsSmi()) { | 1350 if (feedback->IsSmi()) { |
1349 hint = CompareOperationHintFromFeedback((Smi::cast(feedback))->value()); | 1351 hint = CompareOperationHintFromFeedback((Smi::cast(feedback))->value()); |
1350 } | 1352 } |
1351 return hint; | 1353 return hint; |
1352 } | 1354 } |
1353 | 1355 |
1354 float BytecodeGraphBuilder::ComputeCallFrequency(int slot_id) const { | 1356 float BytecodeGraphBuilder::ComputeCallFrequency(int slot_id) const { |
1355 if (slot_id >= TypeFeedbackVector::kReservedIndexCount) { | 1357 if (slot_id >= TypeFeedbackVector::kReservedIndexCount) { |
1356 CallICNexus nexus(feedback_vector(), feedback_vector()->ToSlot(slot_id)); | 1358 CallICNexus nexus(feedback_vector(), feedback_vector()->ToSlot(slot_id)); |
1357 return nexus.ExtractCallCount(); | 1359 double const call_count = nexus.ExtractCallCount(); |
1360 double const invocation_count = feedback_vector()->invocation_count(); | |
1361 return static_cast<float>(call_count / invocation_count) * | |
mvstanton
2016/09/14 09:26:09
Here too.
Benedikt Meurer
2016/09/14 10:55:44
Done.
| |
1362 invocation_frequency_; | |
1358 } | 1363 } |
1359 return 0.0f; | 1364 return 0.0f; |
1360 } | 1365 } |
1361 | 1366 |
1362 void BytecodeGraphBuilder::VisitAdd() { | 1367 void BytecodeGraphBuilder::VisitAdd() { |
1363 BuildBinaryOp( | 1368 BuildBinaryOp( |
1364 javascript()->Add(GetBinaryOperationHint(kBinaryOperationHintIndex))); | 1369 javascript()->Add(GetBinaryOperationHint(kBinaryOperationHintIndex))); |
1365 } | 1370 } |
1366 | 1371 |
1367 void BytecodeGraphBuilder::VisitSub() { | 1372 void BytecodeGraphBuilder::VisitSub() { |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2088 // Phi does not exist yet, introduce one. | 2093 // Phi does not exist yet, introduce one. |
2089 value = NewPhi(inputs, value, control); | 2094 value = NewPhi(inputs, value, control); |
2090 value->ReplaceInput(inputs - 1, other); | 2095 value->ReplaceInput(inputs - 1, other); |
2091 } | 2096 } |
2092 return value; | 2097 return value; |
2093 } | 2098 } |
2094 | 2099 |
2095 } // namespace compiler | 2100 } // namespace compiler |
2096 } // namespace internal | 2101 } // namespace internal |
2097 } // namespace v8 | 2102 } // namespace v8 |
OLD | NEW |