| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
| 6 | 6 |
| 7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
| 8 #include "src/base/lazy-instance.h" | 8 #include "src/base/lazy-instance.h" |
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 for (MachineType elem : *types) { | 203 for (MachineType elem : *types) { |
| 204 if (!first) { | 204 if (!first) { |
| 205 os << ", "; | 205 os << ", "; |
| 206 } | 206 } |
| 207 first = false; | 207 first = false; |
| 208 os << elem; | 208 os << elem; |
| 209 } | 209 } |
| 210 return os; | 210 return os; |
| 211 } | 211 } |
| 212 | 212 |
| 213 #define CACHED_OP_LIST(V) \ | 213 #define CACHED_OP_LIST(V) \ |
| 214 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ | 214 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ |
| 215 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 215 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
| 216 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 216 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
| 217 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 217 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
| 218 V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1) \ | 218 V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1) \ |
| 219 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 219 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
| 220 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ | 220 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ |
| 221 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ | 221 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ |
| 222 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ | 222 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ |
| 223 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ | 223 V(OsrLoopEntry, Operator::kFoldable | Operator::kNoThrow, 0, 1, 1, 0, 1, 1) \ |
| 224 V(LoopExit, Operator::kKontrol, 0, 0, 2, 0, 0, 1) \ | 224 V(LoopExit, Operator::kKontrol, 0, 0, 2, 0, 0, 1) \ |
| 225 V(LoopExitValue, Operator::kPure, 1, 0, 1, 1, 0, 0) \ | 225 V(LoopExitValue, Operator::kPure, 1, 0, 1, 1, 0, 0) \ |
| 226 V(LoopExitEffect, Operator::kNoThrow, 0, 1, 1, 0, 1, 0) \ | 226 V(LoopExitEffect, Operator::kNoThrow, 0, 1, 1, 0, 1, 0) \ |
| 227 V(Checkpoint, Operator::kKontrol, 0, 1, 1, 0, 1, 0) \ | 227 V(Checkpoint, Operator::kKontrol, 0, 1, 1, 0, 1, 0) \ |
| 228 V(FinishRegion, Operator::kKontrol, 1, 1, 0, 1, 1, 0) \ | 228 V(FinishRegion, Operator::kKontrol, 1, 1, 0, 1, 1, 0) \ |
| 229 V(Retain, Operator::kKontrol, 1, 1, 0, 0, 1, 0) | 229 V(Retain, Operator::kKontrol, 1, 1, 0, 0, 1, 0) |
| 230 | 230 |
| 231 #define CACHED_RETURN_LIST(V) \ | 231 #define CACHED_RETURN_LIST(V) \ |
| 232 V(1) \ | 232 V(1) \ |
| 233 V(2) \ | 233 V(2) \ |
| 234 V(3) | 234 V(3) |
| 235 | 235 |
| 236 | 236 |
| 237 #define CACHED_END_LIST(V) \ | 237 #define CACHED_END_LIST(V) \ |
| 238 V(1) \ | 238 V(1) \ |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 const Operator* CommonOperatorBuilder::IfValue(int32_t index) { | 612 const Operator* CommonOperatorBuilder::IfValue(int32_t index) { |
| 613 return new (zone()) Operator1<int32_t>( // -- | 613 return new (zone()) Operator1<int32_t>( // -- |
| 614 IrOpcode::kIfValue, Operator::kKontrol, // opcode | 614 IrOpcode::kIfValue, Operator::kKontrol, // opcode |
| 615 "IfValue", // name | 615 "IfValue", // name |
| 616 0, 0, 1, 0, 0, 1, // counts | 616 0, 0, 1, 0, 0, 1, // counts |
| 617 index); // parameter | 617 index); // parameter |
| 618 } | 618 } |
| 619 | 619 |
| 620 | 620 |
| 621 const Operator* CommonOperatorBuilder::Start(int value_output_count) { | 621 const Operator* CommonOperatorBuilder::Start(int value_output_count) { |
| 622 return new (zone()) Operator( // -- | 622 return new (zone()) Operator( // -- |
| 623 IrOpcode::kStart, Operator::kFoldable, // opcode | 623 IrOpcode::kStart, Operator::kFoldable | Operator::kNoThrow, // opcode |
| 624 "Start", // name | 624 "Start", // name |
| 625 0, 0, 0, value_output_count, 1, 1); // counts | 625 0, 0, 0, value_output_count, 1, 1); // counts |
| 626 } | 626 } |
| 627 | 627 |
| 628 | 628 |
| 629 const Operator* CommonOperatorBuilder::Loop(int control_input_count) { | 629 const Operator* CommonOperatorBuilder::Loop(int control_input_count) { |
| 630 switch (control_input_count) { | 630 switch (control_input_count) { |
| 631 #define CACHED_LOOP(input_count) \ | 631 #define CACHED_LOOP(input_count) \ |
| 632 case input_count: \ | 632 case input_count: \ |
| 633 return &cache_.kLoop##input_count##Operator; | 633 return &cache_.kLoop##input_count##Operator; |
| 634 CACHED_LOOP_LIST(CACHED_LOOP) | 634 CACHED_LOOP_LIST(CACHED_LOOP) |
| 635 #undef CACHED_LOOP | 635 #undef CACHED_LOOP |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 return new (zone()) CallOperator(descriptor); | 927 return new (zone()) CallOperator(descriptor); |
| 928 } | 928 } |
| 929 | 929 |
| 930 | 930 |
| 931 const Operator* CommonOperatorBuilder::TailCall( | 931 const Operator* CommonOperatorBuilder::TailCall( |
| 932 const CallDescriptor* descriptor) { | 932 const CallDescriptor* descriptor) { |
| 933 class TailCallOperator final : public Operator1<const CallDescriptor*> { | 933 class TailCallOperator final : public Operator1<const CallDescriptor*> { |
| 934 public: | 934 public: |
| 935 explicit TailCallOperator(const CallDescriptor* descriptor) | 935 explicit TailCallOperator(const CallDescriptor* descriptor) |
| 936 : Operator1<const CallDescriptor*>( | 936 : Operator1<const CallDescriptor*>( |
| 937 IrOpcode::kTailCall, descriptor->properties(), "TailCall", | 937 IrOpcode::kTailCall, |
| 938 descriptor->properties() | Operator::kNoThrow, "TailCall", |
| 938 descriptor->InputCount() + descriptor->FrameStateCount(), 1, 1, 0, | 939 descriptor->InputCount() + descriptor->FrameStateCount(), 1, 1, 0, |
| 939 0, 1, descriptor) {} | 940 0, 1, descriptor) {} |
| 940 | 941 |
| 941 void PrintParameter(std::ostream& os, PrintVerbosity verbose) const { | 942 void PrintParameter(std::ostream& os, PrintVerbosity verbose) const { |
| 942 os << "[" << *parameter() << "]"; | 943 os << "[" << *parameter() << "]"; |
| 943 } | 944 } |
| 944 }; | 945 }; |
| 945 return new (zone()) TailCallOperator(descriptor); | 946 return new (zone()) TailCallOperator(descriptor); |
| 946 } | 947 } |
| 947 | 948 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 CommonOperatorBuilder::CreateFrameStateFunctionInfo( | 988 CommonOperatorBuilder::CreateFrameStateFunctionInfo( |
| 988 FrameStateType type, int parameter_count, int local_count, | 989 FrameStateType type, int parameter_count, int local_count, |
| 989 Handle<SharedFunctionInfo> shared_info) { | 990 Handle<SharedFunctionInfo> shared_info) { |
| 990 return new (zone()->New(sizeof(FrameStateFunctionInfo))) | 991 return new (zone()->New(sizeof(FrameStateFunctionInfo))) |
| 991 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); | 992 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); |
| 992 } | 993 } |
| 993 | 994 |
| 994 } // namespace compiler | 995 } // namespace compiler |
| 995 } // namespace internal | 996 } // namespace internal |
| 996 } // namespace v8 | 997 } // namespace v8 |
| OLD | NEW |