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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
938 all[1] = environment()->LookupRegister(receiver); | 938 all[1] = environment()->LookupRegister(receiver); |
939 int receiver_index = receiver.index(); | 939 int receiver_index = receiver.index(); |
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::BuildCallWithFeedback(TailCallMode tail_call_mode) { |
949 FrameStateBeforeAndAfter states(this); | 949 FrameStateBeforeAndAfter states(this); |
950 // TODO(rmcilroy): Set receiver_hint correctly based on whether the receiver | 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 | 951 // register has been loaded with null / undefined explicitly or we are sure it |
952 // is not null / undefined. | 952 // is not null / undefined. |
953 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; | 953 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; |
954 Node* callee = | 954 Node* callee = |
955 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 955 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
956 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1); | 956 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1); |
957 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 957 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
958 VectorSlotPair feedback = | 958 VectorSlotPair feedback = |
959 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); | 959 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); |
960 | 960 |
961 const Operator* call = javascript()->CallFunction( | 961 const Operator* call = javascript()->CallFunction( |
962 arg_count + 1, feedback, receiver_hint, tail_call_mode); | 962 arg_count + 1, feedback, receiver_hint, tail_call_mode); |
963 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); | 963 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); |
964 environment()->BindAccumulator(value, &states); | 964 environment()->BindAccumulator(value, &states); |
965 } | 965 } |
966 | 966 |
967 void BytecodeGraphBuilder::VisitCallWithFeedback() { | |
968 BuildCallWithFeedback(TailCallMode::kDisallow); | |
969 } | |
970 | |
971 void BytecodeGraphBuilder::VisitTailCallWithFeedback() { | |
972 TailCallMode tail_call_mode = | |
973 bytecode_array_->GetIsolate()->is_tail_call_elimination_enabled() | |
974 ? TailCallMode::kAllow | |
975 : TailCallMode::kDisallow; | |
976 BuildCallWithFeedback(tail_call_mode); | |
977 } | |
978 | |
979 void BytecodeGraphBuilder::BuildCall(TailCallMode tail_call_mode) { | |
980 FrameStateBeforeAndAfter states(this); | |
981 // TODO(rmcilroy): Set receiver_hint correctly based on whether the receiver | |
Benedikt Meurer
2016/07/09 18:19:22
The JSTypedLowering will figure it out based on ty
rmcilroy
2016/07/11 09:28:27
This was based on the ASTGraphBuilder where it pas
mythria
2016/07/11 15:25:24
I removed the TODO. I will reintroduce it back if
| |
982 // register has been loaded with null / undefined explicitly or we are sure it | |
983 // is not null / undefined. | |
984 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; | |
985 Node* callee = | |
986 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | |
987 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1); | |
988 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | |
989 | |
990 const Operator* call = javascript()->CallFunction( | |
991 arg_count + 1, VectorSlotPair(), receiver_hint, tail_call_mode); | |
992 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); | |
993 environment()->BindAccumulator(value, &states); | |
994 } | |
995 | |
967 void BytecodeGraphBuilder::VisitCall() { BuildCall(TailCallMode::kDisallow); } | 996 void BytecodeGraphBuilder::VisitCall() { BuildCall(TailCallMode::kDisallow); } |
968 | 997 |
969 void BytecodeGraphBuilder::VisitTailCall() { | 998 void BytecodeGraphBuilder::VisitTailCall() { |
970 TailCallMode tail_call_mode = | 999 TailCallMode tail_call_mode = |
971 bytecode_array_->GetIsolate()->is_tail_call_elimination_enabled() | 1000 bytecode_array_->GetIsolate()->is_tail_call_elimination_enabled() |
972 ? TailCallMode::kAllow | 1001 ? TailCallMode::kAllow |
973 : TailCallMode::kDisallow; | 1002 : TailCallMode::kDisallow; |
974 BuildCall(tail_call_mode); | 1003 BuildCall(tail_call_mode); |
975 } | 1004 } |
976 | 1005 |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1783 // Phi does not exist yet, introduce one. | 1812 // Phi does not exist yet, introduce one. |
1784 value = NewPhi(inputs, value, control); | 1813 value = NewPhi(inputs, value, control); |
1785 value->ReplaceInput(inputs - 1, other); | 1814 value->ReplaceInput(inputs - 1, other); |
1786 } | 1815 } |
1787 return value; | 1816 return value; |
1788 } | 1817 } |
1789 | 1818 |
1790 } // namespace compiler | 1819 } // namespace compiler |
1791 } // namespace internal | 1820 } // namespace internal |
1792 } // namespace v8 | 1821 } // namespace v8 |
OLD | NEW |