| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 339 |
| 340 const CreateClosureParameters& CreateClosureParametersOf(const Operator* op) { | 340 const CreateClosureParameters& CreateClosureParametersOf(const Operator* op) { |
| 341 DCHECK_EQ(IrOpcode::kJSCreateClosure, op->opcode()); | 341 DCHECK_EQ(IrOpcode::kJSCreateClosure, op->opcode()); |
| 342 return OpParameter<CreateClosureParameters>(op); | 342 return OpParameter<CreateClosureParameters>(op); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 bool operator==(CreateLiteralParameters const& lhs, | 346 bool operator==(CreateLiteralParameters const& lhs, |
| 347 CreateLiteralParameters const& rhs) { | 347 CreateLiteralParameters const& rhs) { |
| 348 return lhs.constant().location() == rhs.constant().location() && | 348 return lhs.constant().location() == rhs.constant().location() && |
| 349 lhs.flags() == rhs.flags() && lhs.index() == rhs.index(); | 349 lhs.length() == rhs.length() && lhs.flags() == rhs.flags() && |
| 350 lhs.index() == rhs.index(); |
| 350 } | 351 } |
| 351 | 352 |
| 352 | 353 |
| 353 bool operator!=(CreateLiteralParameters const& lhs, | 354 bool operator!=(CreateLiteralParameters const& lhs, |
| 354 CreateLiteralParameters const& rhs) { | 355 CreateLiteralParameters const& rhs) { |
| 355 return !(lhs == rhs); | 356 return !(lhs == rhs); |
| 356 } | 357 } |
| 357 | 358 |
| 358 | 359 |
| 359 size_t hash_value(CreateLiteralParameters const& p) { | 360 size_t hash_value(CreateLiteralParameters const& p) { |
| 360 return base::hash_combine(p.constant().location(), p.flags(), p.index()); | 361 return base::hash_combine(p.constant().location(), p.length(), p.flags(), |
| 362 p.index()); |
| 361 } | 363 } |
| 362 | 364 |
| 363 | 365 |
| 364 std::ostream& operator<<(std::ostream& os, CreateLiteralParameters const& p) { | 366 std::ostream& operator<<(std::ostream& os, CreateLiteralParameters const& p) { |
| 365 return os << Brief(*p.constant()) << ", " << p.flags() << ", " << p.index(); | 367 return os << Brief(*p.constant()) << ", " << p.length() << ", " << p.flags() |
| 368 << ", " << p.index(); |
| 366 } | 369 } |
| 367 | 370 |
| 368 | 371 |
| 369 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { | 372 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { |
| 370 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || | 373 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || |
| 371 op->opcode() == IrOpcode::kJSCreateLiteralObject || | 374 op->opcode() == IrOpcode::kJSCreateLiteralObject || |
| 372 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); | 375 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); |
| 373 return OpParameter<CreateLiteralParameters>(op); | 376 return OpParameter<CreateLiteralParameters>(op); |
| 374 } | 377 } |
| 375 | 378 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 const Operator* JSOperatorBuilder::CreateClosure( | 729 const Operator* JSOperatorBuilder::CreateClosure( |
| 727 Handle<SharedFunctionInfo> shared_info, PretenureFlag pretenure) { | 730 Handle<SharedFunctionInfo> shared_info, PretenureFlag pretenure) { |
| 728 CreateClosureParameters parameters(shared_info, pretenure); | 731 CreateClosureParameters parameters(shared_info, pretenure); |
| 729 return new (zone()) Operator1<CreateClosureParameters>( // -- | 732 return new (zone()) Operator1<CreateClosureParameters>( // -- |
| 730 IrOpcode::kJSCreateClosure, Operator::kNoThrow, // opcode | 733 IrOpcode::kJSCreateClosure, Operator::kNoThrow, // opcode |
| 731 "JSCreateClosure", // name | 734 "JSCreateClosure", // name |
| 732 0, 1, 1, 1, 1, 0, // counts | 735 0, 1, 1, 1, 1, 0, // counts |
| 733 parameters); // parameter | 736 parameters); // parameter |
| 734 } | 737 } |
| 735 | 738 |
| 736 | |
| 737 const Operator* JSOperatorBuilder::CreateLiteralArray( | 739 const Operator* JSOperatorBuilder::CreateLiteralArray( |
| 738 Handle<FixedArray> constant_elements, int literal_flags, | 740 Handle<FixedArray> constant_elements, int literal_flags, int literal_index, |
| 739 int literal_index) { | 741 int number_of_elements) { |
| 740 CreateLiteralParameters parameters(constant_elements, literal_flags, | 742 CreateLiteralParameters parameters(constant_elements, number_of_elements, |
| 741 literal_index); | 743 literal_flags, literal_index); |
| 742 return new (zone()) Operator1<CreateLiteralParameters>( // -- | 744 return new (zone()) Operator1<CreateLiteralParameters>( // -- |
| 743 IrOpcode::kJSCreateLiteralArray, Operator::kNoProperties, // opcode | 745 IrOpcode::kJSCreateLiteralArray, Operator::kNoProperties, // opcode |
| 744 "JSCreateLiteralArray", // name | 746 "JSCreateLiteralArray", // name |
| 745 1, 1, 1, 1, 1, 2, // counts | 747 1, 1, 1, 1, 1, 2, // counts |
| 746 parameters); // parameter | 748 parameters); // parameter |
| 747 } | 749 } |
| 748 | 750 |
| 749 | |
| 750 const Operator* JSOperatorBuilder::CreateLiteralObject( | 751 const Operator* JSOperatorBuilder::CreateLiteralObject( |
| 751 Handle<FixedArray> constant_properties, int literal_flags, | 752 Handle<FixedArray> constant_properties, int literal_flags, |
| 752 int literal_index) { | 753 int literal_index, int number_of_properties) { |
| 753 CreateLiteralParameters parameters(constant_properties, literal_flags, | 754 CreateLiteralParameters parameters(constant_properties, number_of_properties, |
| 754 literal_index); | 755 literal_flags, literal_index); |
| 755 return new (zone()) Operator1<CreateLiteralParameters>( // -- | 756 return new (zone()) Operator1<CreateLiteralParameters>( // -- |
| 756 IrOpcode::kJSCreateLiteralObject, Operator::kNoProperties, // opcode | 757 IrOpcode::kJSCreateLiteralObject, Operator::kNoProperties, // opcode |
| 757 "JSCreateLiteralObject", // name | 758 "JSCreateLiteralObject", // name |
| 758 1, 1, 1, 1, 1, 2, // counts | 759 1, 1, 1, 1, 1, 2, // counts |
| 759 parameters); // parameter | 760 parameters); // parameter |
| 760 } | 761 } |
| 761 | 762 |
| 762 | 763 |
| 763 const Operator* JSOperatorBuilder::CreateLiteralRegExp( | 764 const Operator* JSOperatorBuilder::CreateLiteralRegExp( |
| 764 Handle<String> constant_pattern, int literal_flags, int literal_index) { | 765 Handle<String> constant_pattern, int literal_flags, int literal_index) { |
| 765 CreateLiteralParameters parameters(constant_pattern, literal_flags, | 766 CreateLiteralParameters parameters(constant_pattern, -1, literal_flags, |
| 766 literal_index); | 767 literal_index); |
| 767 return new (zone()) Operator1<CreateLiteralParameters>( // -- | 768 return new (zone()) Operator1<CreateLiteralParameters>( // -- |
| 768 IrOpcode::kJSCreateLiteralRegExp, Operator::kNoProperties, // opcode | 769 IrOpcode::kJSCreateLiteralRegExp, Operator::kNoProperties, // opcode |
| 769 "JSCreateLiteralRegExp", // name | 770 "JSCreateLiteralRegExp", // name |
| 770 1, 1, 1, 1, 1, 2, // counts | 771 1, 1, 1, 1, 1, 2, // counts |
| 771 parameters); // parameter | 772 parameters); // parameter |
| 772 } | 773 } |
| 773 | 774 |
| 774 | 775 |
| 775 const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count) { | 776 const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 806 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 807 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
| 807 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 808 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
| 808 "JSCreateScriptContext", // name | 809 "JSCreateScriptContext", // name |
| 809 1, 1, 1, 1, 1, 2, // counts | 810 1, 1, 1, 1, 1, 2, // counts |
| 810 scpope_info); // parameter | 811 scpope_info); // parameter |
| 811 } | 812 } |
| 812 | 813 |
| 813 } // namespace compiler | 814 } // namespace compiler |
| 814 } // namespace internal | 815 } // namespace internal |
| 815 } // namespace v8 | 816 } // namespace v8 |
| OLD | NEW |