| 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 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 Node* node = NewNode(js_op, left, right); | 1373 Node* node = NewNode(js_op, left, right); |
| 1374 environment()->BindAccumulator(node, &states); | 1374 environment()->BindAccumulator(node, &states); |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 // Helper function to create binary operation hint from the recorded type | 1377 // Helper function to create binary operation hint from the recorded type |
| 1378 // feedback. | 1378 // feedback. |
| 1379 BinaryOperationHint BytecodeGraphBuilder::GetBinaryOperationHint( | 1379 BinaryOperationHint BytecodeGraphBuilder::GetBinaryOperationHint( |
| 1380 int operand_index) { | 1380 int operand_index) { |
| 1381 FeedbackVectorSlot slot = feedback_vector()->ToSlot( | 1381 FeedbackVectorSlot slot = feedback_vector()->ToSlot( |
| 1382 bytecode_iterator().GetIndexOperand(operand_index)); | 1382 bytecode_iterator().GetIndexOperand(operand_index)); |
| 1383 DCHECK_EQ(FeedbackVectorSlotKind::GENERAL, feedback_vector()->GetKind(slot)); | 1383 DCHECK_EQ(FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC, |
| 1384 Object* feedback = feedback_vector()->Get(slot); | 1384 feedback_vector()->GetKind(slot)); |
| 1385 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1385 BinaryOpICNexus nexus(feedback_vector(), slot); |
| 1386 if (feedback->IsSmi()) { | 1386 return nexus.GetBinaryOperationFeedback(); |
| 1387 hint = BinaryOperationHintFromFeedback((Smi::cast(feedback))->value()); | |
| 1388 } | |
| 1389 return hint; | |
| 1390 } | 1387 } |
| 1391 | 1388 |
| 1392 // Helper function to create compare operation hint from the recorded type | 1389 // Helper function to create compare operation hint from the recorded type |
| 1393 // feedback. | 1390 // feedback. |
| 1394 CompareOperationHint BytecodeGraphBuilder::GetCompareOperationHint() { | 1391 CompareOperationHint BytecodeGraphBuilder::GetCompareOperationHint() { |
| 1395 int slot_index = bytecode_iterator().GetIndexOperand(1); | 1392 int slot_index = bytecode_iterator().GetIndexOperand(1); |
| 1396 if (slot_index == 0) { | 1393 if (slot_index == 0) { |
| 1397 return CompareOperationHint::kAny; | 1394 return CompareOperationHint::kAny; |
| 1398 } | 1395 } |
| 1399 FeedbackVectorSlot slot = | 1396 FeedbackVectorSlot slot = |
| 1400 feedback_vector()->ToSlot(bytecode_iterator().GetIndexOperand(1)); | 1397 feedback_vector()->ToSlot(bytecode_iterator().GetIndexOperand(1)); |
| 1401 DCHECK_EQ(FeedbackVectorSlotKind::GENERAL, feedback_vector()->GetKind(slot)); | 1398 DCHECK_EQ(FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC, |
| 1402 Object* feedback = feedback_vector()->Get(slot); | 1399 feedback_vector()->GetKind(slot)); |
| 1403 CompareOperationHint hint = CompareOperationHint::kAny; | 1400 CompareICNexus nexus(feedback_vector(), slot); |
| 1404 if (feedback->IsSmi()) { | 1401 return nexus.GetCompareOperationFeedback(); |
| 1405 hint = CompareOperationHintFromFeedback((Smi::cast(feedback))->value()); | |
| 1406 } | |
| 1407 return hint; | |
| 1408 } | 1402 } |
| 1409 | 1403 |
| 1410 float BytecodeGraphBuilder::ComputeCallFrequency(int slot_id) const { | 1404 float BytecodeGraphBuilder::ComputeCallFrequency(int slot_id) const { |
| 1411 if (slot_id >= TypeFeedbackVector::kReservedIndexCount) { | 1405 if (slot_id >= TypeFeedbackVector::kReservedIndexCount) { |
| 1412 CallICNexus nexus(feedback_vector(), feedback_vector()->ToSlot(slot_id)); | 1406 CallICNexus nexus(feedback_vector(), feedback_vector()->ToSlot(slot_id)); |
| 1413 return nexus.ComputeCallFrequency() * invocation_frequency_; | 1407 return nexus.ComputeCallFrequency() * invocation_frequency_; |
| 1414 } | 1408 } |
| 1415 return 0.0f; | 1409 return 0.0f; |
| 1416 } | 1410 } |
| 1417 | 1411 |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 // Phi does not exist yet, introduce one. | 2138 // Phi does not exist yet, introduce one. |
| 2145 value = NewPhi(inputs, value, control); | 2139 value = NewPhi(inputs, value, control); |
| 2146 value->ReplaceInput(inputs - 1, other); | 2140 value->ReplaceInput(inputs - 1, other); |
| 2147 } | 2141 } |
| 2148 return value; | 2142 return value; |
| 2149 } | 2143 } |
| 2150 | 2144 |
| 2151 } // namespace compiler | 2145 } // namespace compiler |
| 2152 } // namespace internal | 2146 } // namespace internal |
| 2153 } // namespace v8 | 2147 } // namespace v8 |
| OLD | NEW |