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/js-operator.h" | 5 #include "src/compiler/js-operator.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/lazy-instance.h" | 9 #include "src/base/lazy-instance.h" |
10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 398 |
399 const CreateArrayParameters& CreateArrayParametersOf(const Operator* op) { | 399 const CreateArrayParameters& CreateArrayParametersOf(const Operator* op) { |
400 DCHECK_EQ(IrOpcode::kJSCreateArray, op->opcode()); | 400 DCHECK_EQ(IrOpcode::kJSCreateArray, op->opcode()); |
401 return OpParameter<CreateArrayParameters>(op); | 401 return OpParameter<CreateArrayParameters>(op); |
402 } | 402 } |
403 | 403 |
404 | 404 |
405 bool operator==(CreateClosureParameters const& lhs, | 405 bool operator==(CreateClosureParameters const& lhs, |
406 CreateClosureParameters const& rhs) { | 406 CreateClosureParameters const& rhs) { |
407 return lhs.pretenure() == rhs.pretenure() && | 407 return lhs.pretenure() == rhs.pretenure() && |
408 lhs.feedback() == rhs.feedback() && | |
409 lhs.shared_info().location() == rhs.shared_info().location(); | 408 lhs.shared_info().location() == rhs.shared_info().location(); |
410 } | 409 } |
411 | 410 |
412 | 411 |
413 bool operator!=(CreateClosureParameters const& lhs, | 412 bool operator!=(CreateClosureParameters const& lhs, |
414 CreateClosureParameters const& rhs) { | 413 CreateClosureParameters const& rhs) { |
415 return !(lhs == rhs); | 414 return !(lhs == rhs); |
416 } | 415 } |
417 | 416 |
418 | 417 |
419 size_t hash_value(CreateClosureParameters const& p) { | 418 size_t hash_value(CreateClosureParameters const& p) { |
420 return base::hash_combine(p.pretenure(), p.shared_info().location(), | 419 return base::hash_combine(p.pretenure(), p.shared_info().location()); |
421 p.feedback()); | |
422 } | 420 } |
423 | 421 |
424 | 422 |
425 std::ostream& operator<<(std::ostream& os, CreateClosureParameters const& p) { | 423 std::ostream& operator<<(std::ostream& os, CreateClosureParameters const& p) { |
426 return os << p.pretenure() << ", " << Brief(*p.shared_info()); | 424 return os << p.pretenure() << ", " << Brief(*p.shared_info()); |
427 } | 425 } |
428 | 426 |
429 | 427 |
430 const CreateClosureParameters& CreateClosureParametersOf(const Operator* op) { | 428 const CreateClosureParameters& CreateClosureParametersOf(const Operator* op) { |
431 DCHECK_EQ(IrOpcode::kJSCreateClosure, op->opcode()); | 429 DCHECK_EQ(IrOpcode::kJSCreateClosure, op->opcode()); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 // constructor, new_target, arg1, ..., argN | 867 // constructor, new_target, arg1, ..., argN |
870 int const value_input_count = static_cast<int>(arity) + 2; | 868 int const value_input_count = static_cast<int>(arity) + 2; |
871 CreateArrayParameters parameters(arity, site); | 869 CreateArrayParameters parameters(arity, site); |
872 return new (zone()) Operator1<CreateArrayParameters>( // -- | 870 return new (zone()) Operator1<CreateArrayParameters>( // -- |
873 IrOpcode::kJSCreateArray, Operator::kNoProperties, // opcode | 871 IrOpcode::kJSCreateArray, Operator::kNoProperties, // opcode |
874 "JSCreateArray", // name | 872 "JSCreateArray", // name |
875 value_input_count, 1, 1, 1, 1, 2, // counts | 873 value_input_count, 1, 1, 1, 1, 2, // counts |
876 parameters); // parameter | 874 parameters); // parameter |
877 } | 875 } |
878 | 876 |
| 877 |
879 const Operator* JSOperatorBuilder::CreateClosure( | 878 const Operator* JSOperatorBuilder::CreateClosure( |
880 Handle<SharedFunctionInfo> shared_info, VectorSlotPair const& feedback, | 879 Handle<SharedFunctionInfo> shared_info, PretenureFlag pretenure) { |
881 PretenureFlag pretenure) { | 880 CreateClosureParameters parameters(shared_info, pretenure); |
882 CreateClosureParameters parameters(shared_info, feedback, pretenure); | |
883 return new (zone()) Operator1<CreateClosureParameters>( // -- | 881 return new (zone()) Operator1<CreateClosureParameters>( // -- |
884 IrOpcode::kJSCreateClosure, Operator::kNoThrow, // opcode | 882 IrOpcode::kJSCreateClosure, Operator::kNoThrow, // opcode |
885 "JSCreateClosure", // name | 883 "JSCreateClosure", // name |
886 0, 1, 1, 1, 1, 0, // counts | 884 0, 1, 1, 1, 1, 0, // counts |
887 parameters); // parameter | 885 parameters); // parameter |
888 } | 886 } |
889 | 887 |
890 const Operator* JSOperatorBuilder::CreateLiteralArray( | 888 const Operator* JSOperatorBuilder::CreateLiteralArray( |
891 Handle<ConstantElementsPair> constant_elements, int literal_flags, | 889 Handle<ConstantElementsPair> constant_elements, int literal_flags, |
892 int literal_index, int number_of_elements) { | 890 int literal_index, int number_of_elements) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 964 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
967 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 965 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
968 "JSCreateScriptContext", // name | 966 "JSCreateScriptContext", // name |
969 1, 1, 1, 1, 1, 2, // counts | 967 1, 1, 1, 1, 1, 2, // counts |
970 scope_info); // parameter | 968 scope_info); // parameter |
971 } | 969 } |
972 | 970 |
973 } // namespace compiler | 971 } // namespace compiler |
974 } // namespace internal | 972 } // namespace internal |
975 } // namespace v8 | 973 } // namespace v8 |
OLD | NEW |