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/compiler/bytecode-branch-analysis.h" | 7 #include "src/compiler/bytecode-branch-analysis.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/operator-properties.h" | 9 #include "src/compiler/operator-properties.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 for (int i = 2; i < static_cast<int>(arity); ++i) { | 940 for (int i = 2; i < static_cast<int>(arity); ++i) { |
941 all[i] = environment()->LookupRegister( | 941 all[i] = environment()->LookupRegister( |
942 interpreter::Register(receiver_index + i - 1)); | 942 interpreter::Register(receiver_index + i - 1)); |
943 } | 943 } |
944 Node* value = MakeNode(call_op, static_cast<int>(arity), all, false); | 944 Node* value = MakeNode(call_op, static_cast<int>(arity), all, false); |
945 return value; | 945 return value; |
946 } | 946 } |
947 | 947 |
948 void BytecodeGraphBuilder::BuildCall(TailCallMode tail_call_mode) { | 948 void BytecodeGraphBuilder::BuildCall(TailCallMode tail_call_mode) { |
949 FrameStateBeforeAndAfter states(this); | 949 FrameStateBeforeAndAfter states(this); |
950 // TODO(rmcilroy): Set receiver_hint correctly based on whether the receiver | |
951 // register has been loaded with null / undefined explicitly or we are sure it | |
952 // is not null / undefined. | |
953 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; | 950 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; |
954 Node* callee = | 951 Node* callee = |
955 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 952 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
956 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1); | 953 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1); |
957 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 954 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
| 955 |
| 956 // Slot index of 0 is used indicate no feedback slot is available. Assert |
| 957 // the assumption that slot index 0 is never a valid feedback slot. |
| 958 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0); |
958 VectorSlotPair feedback = | 959 VectorSlotPair feedback = |
959 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); | 960 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); |
960 | 961 |
961 const Operator* call = javascript()->CallFunction( | 962 const Operator* call = javascript()->CallFunction( |
962 arg_count + 1, feedback, receiver_hint, tail_call_mode); | 963 arg_count + 1, feedback, receiver_hint, tail_call_mode); |
963 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); | 964 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); |
964 environment()->BindAccumulator(value, &states); | 965 environment()->BindAccumulator(value, &states); |
965 } | 966 } |
966 | 967 |
967 void BytecodeGraphBuilder::VisitCall() { BuildCall(TailCallMode::kDisallow); } | 968 void BytecodeGraphBuilder::VisitCall() { BuildCall(TailCallMode::kDisallow); } |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 // Phi does not exist yet, introduce one. | 1784 // Phi does not exist yet, introduce one. |
1784 value = NewPhi(inputs, value, control); | 1785 value = NewPhi(inputs, value, control); |
1785 value->ReplaceInput(inputs - 1, other); | 1786 value->ReplaceInput(inputs - 1, other); |
1786 } | 1787 } |
1787 return value; | 1788 return value; |
1788 } | 1789 } |
1789 | 1790 |
1790 } // namespace compiler | 1791 } // namespace compiler |
1791 } // namespace internal | 1792 } // namespace internal |
1792 } // namespace v8 | 1793 } // namespace v8 |
OLD | NEW |