| 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 return nexus.ComputeCallFrequency() * invocation_frequency_; |
| 1358 } | 1360 } |
| 1359 return 0.0f; | 1361 return 0.0f; |
| 1360 } | 1362 } |
| 1361 | 1363 |
| 1362 void BytecodeGraphBuilder::VisitAdd() { | 1364 void BytecodeGraphBuilder::VisitAdd() { |
| 1363 BuildBinaryOp( | 1365 BuildBinaryOp( |
| 1364 javascript()->Add(GetBinaryOperationHint(kBinaryOperationHintIndex))); | 1366 javascript()->Add(GetBinaryOperationHint(kBinaryOperationHintIndex))); |
| 1365 } | 1367 } |
| 1366 | 1368 |
| 1367 void BytecodeGraphBuilder::VisitSub() { | 1369 void BytecodeGraphBuilder::VisitSub() { |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2088 // Phi does not exist yet, introduce one. | 2090 // Phi does not exist yet, introduce one. |
| 2089 value = NewPhi(inputs, value, control); | 2091 value = NewPhi(inputs, value, control); |
| 2090 value->ReplaceInput(inputs - 1, other); | 2092 value->ReplaceInput(inputs - 1, other); |
| 2091 } | 2093 } |
| 2092 return value; | 2094 return value; |
| 2093 } | 2095 } |
| 2094 | 2096 |
| 2095 } // namespace compiler | 2097 } // namespace compiler |
| 2096 } // namespace internal | 2098 } // namespace internal |
| 2097 } // namespace v8 | 2099 } // namespace v8 |
| OLD | NEW |