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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 405 |
406 | 406 |
407 const CreateClosureParameters& CreateClosureParametersOf(const Operator* op) { | 407 const CreateClosureParameters& CreateClosureParametersOf(const Operator* op) { |
408 DCHECK_EQ(IrOpcode::kJSCreateClosure, op->opcode()); | 408 DCHECK_EQ(IrOpcode::kJSCreateClosure, op->opcode()); |
409 return OpParameter<CreateClosureParameters>(op); | 409 return OpParameter<CreateClosureParameters>(op); |
410 } | 410 } |
411 | 411 |
412 | 412 |
413 bool operator==(CreateLiteralParameters const& lhs, | 413 bool operator==(CreateLiteralParameters const& lhs, |
414 CreateLiteralParameters const& rhs) { | 414 CreateLiteralParameters const& rhs) { |
415 return lhs.constants().location() == rhs.constants().location() && | 415 return lhs.constant().location() == rhs.constant().location() && |
416 lhs.flags() == rhs.flags() && lhs.index() == rhs.index(); | 416 lhs.flags() == rhs.flags() && lhs.index() == rhs.index(); |
417 } | 417 } |
418 | 418 |
419 | 419 |
420 bool operator!=(CreateLiteralParameters const& lhs, | 420 bool operator!=(CreateLiteralParameters const& lhs, |
421 CreateLiteralParameters const& rhs) { | 421 CreateLiteralParameters const& rhs) { |
422 return !(lhs == rhs); | 422 return !(lhs == rhs); |
423 } | 423 } |
424 | 424 |
425 | 425 |
426 size_t hash_value(CreateLiteralParameters const& p) { | 426 size_t hash_value(CreateLiteralParameters const& p) { |
427 return base::hash_combine(p.constants().location(), p.flags(), p.index()); | 427 return base::hash_combine(p.constant().location(), p.flags(), p.index()); |
428 } | 428 } |
429 | 429 |
430 | 430 |
431 std::ostream& operator<<(std::ostream& os, CreateLiteralParameters const& p) { | 431 std::ostream& operator<<(std::ostream& os, CreateLiteralParameters const& p) { |
432 return os << Brief(*p.constants()) << ", " << p.flags() << ", " << p.index(); | 432 return os << Brief(*p.constant()) << ", " << p.flags() << ", " << p.index(); |
433 } | 433 } |
434 | 434 |
435 | 435 |
436 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { | 436 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { |
437 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || | 437 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || |
438 op->opcode() == IrOpcode::kJSCreateLiteralObject); | 438 op->opcode() == IrOpcode::kJSCreateLiteralObject || |
| 439 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); |
439 return OpParameter<CreateLiteralParameters>(op); | 440 return OpParameter<CreateLiteralParameters>(op); |
440 } | 441 } |
441 | 442 |
442 | 443 |
443 #define CACHED_OP_LIST(V) \ | 444 #define CACHED_OP_LIST(V) \ |
444 V(Equal, Operator::kNoProperties, 2, 1) \ | 445 V(Equal, Operator::kNoProperties, 2, 1) \ |
445 V(NotEqual, Operator::kNoProperties, 2, 1) \ | 446 V(NotEqual, Operator::kNoProperties, 2, 1) \ |
446 V(StrictEqual, Operator::kNoThrow, 2, 1) \ | 447 V(StrictEqual, Operator::kNoThrow, 2, 1) \ |
447 V(StrictNotEqual, Operator::kNoThrow, 2, 1) \ | 448 V(StrictNotEqual, Operator::kNoThrow, 2, 1) \ |
448 V(UnaryNot, Operator::kEliminatable, 1, 1) \ | 449 V(UnaryNot, Operator::kEliminatable, 1, 1) \ |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 CreateLiteralParameters parameters(constant_properties, literal_flags, | 773 CreateLiteralParameters parameters(constant_properties, literal_flags, |
773 literal_index); | 774 literal_index); |
774 return new (zone()) Operator1<CreateLiteralParameters>( // -- | 775 return new (zone()) Operator1<CreateLiteralParameters>( // -- |
775 IrOpcode::kJSCreateLiteralObject, Operator::kNoProperties, // opcode | 776 IrOpcode::kJSCreateLiteralObject, Operator::kNoProperties, // opcode |
776 "JSCreateLiteralObject", // name | 777 "JSCreateLiteralObject", // name |
777 1, 1, 1, 1, 1, 2, // counts | 778 1, 1, 1, 1, 1, 2, // counts |
778 parameters); // parameter | 779 parameters); // parameter |
779 } | 780 } |
780 | 781 |
781 | 782 |
| 783 const Operator* JSOperatorBuilder::CreateLiteralRegExp( |
| 784 Handle<String> constant_pattern, int literal_flags, int literal_index) { |
| 785 CreateLiteralParameters parameters(constant_pattern, literal_flags, |
| 786 literal_index); |
| 787 return new (zone()) Operator1<CreateLiteralParameters>( // -- |
| 788 IrOpcode::kJSCreateLiteralRegExp, Operator::kNoProperties, // opcode |
| 789 "JSCreateLiteralRegExp", // name |
| 790 1, 1, 1, 1, 1, 2, // counts |
| 791 parameters); // parameter |
| 792 } |
| 793 |
| 794 |
782 const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count) { | 795 const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count) { |
783 return new (zone()) Operator1<int>( // -- | 796 return new (zone()) Operator1<int>( // -- |
784 IrOpcode::kJSCreateFunctionContext, Operator::kNoProperties, // opcode | 797 IrOpcode::kJSCreateFunctionContext, Operator::kNoProperties, // opcode |
785 "JSCreateFunctionContext", // name | 798 "JSCreateFunctionContext", // name |
786 1, 1, 1, 1, 1, 2, // counts | 799 1, 1, 1, 1, 1, 2, // counts |
787 slot_count); // parameter | 800 slot_count); // parameter |
788 } | 801 } |
789 | 802 |
790 | 803 |
791 const Operator* JSOperatorBuilder::CreateCatchContext( | 804 const Operator* JSOperatorBuilder::CreateCatchContext( |
(...skipping 21 matching lines...) Expand all Loading... |
813 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 826 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
814 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 827 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
815 "JSCreateScriptContext", // name | 828 "JSCreateScriptContext", // name |
816 1, 1, 1, 1, 1, 2, // counts | 829 1, 1, 1, 1, 1, 2, // counts |
817 scpope_info); // parameter | 830 scpope_info); // parameter |
818 } | 831 } |
819 | 832 |
820 } // namespace compiler | 833 } // namespace compiler |
821 } // namespace internal | 834 } // namespace internal |
822 } // namespace v8 | 835 } // namespace v8 |
OLD | NEW |