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.constant().location() == rhs.constant().location() && | 415 return lhs.constants().location() == rhs.constants().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.constant().location(), p.flags(), p.index()); | 427 return base::hash_combine(p.constants().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.constant()) << ", " << p.flags() << ", " << p.index(); | 432 return os << Brief(*p.constants()) << ", " << 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); | |
440 return OpParameter<CreateLiteralParameters>(op); | 439 return OpParameter<CreateLiteralParameters>(op); |
441 } | 440 } |
442 | 441 |
443 | 442 |
444 #define CACHED_OP_LIST(V) \ | 443 #define CACHED_OP_LIST(V) \ |
445 V(Equal, Operator::kNoProperties, 2, 1) \ | 444 V(Equal, Operator::kNoProperties, 2, 1) \ |
446 V(NotEqual, Operator::kNoProperties, 2, 1) \ | 445 V(NotEqual, Operator::kNoProperties, 2, 1) \ |
447 V(StrictEqual, Operator::kNoThrow, 2, 1) \ | 446 V(StrictEqual, Operator::kNoThrow, 2, 1) \ |
448 V(StrictNotEqual, Operator::kNoThrow, 2, 1) \ | 447 V(StrictNotEqual, Operator::kNoThrow, 2, 1) \ |
449 V(UnaryNot, Operator::kEliminatable, 1, 1) \ | 448 V(UnaryNot, Operator::kEliminatable, 1, 1) \ |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 CreateLiteralParameters parameters(constant_properties, literal_flags, | 772 CreateLiteralParameters parameters(constant_properties, literal_flags, |
774 literal_index); | 773 literal_index); |
775 return new (zone()) Operator1<CreateLiteralParameters>( // -- | 774 return new (zone()) Operator1<CreateLiteralParameters>( // -- |
776 IrOpcode::kJSCreateLiteralObject, Operator::kNoProperties, // opcode | 775 IrOpcode::kJSCreateLiteralObject, Operator::kNoProperties, // opcode |
777 "JSCreateLiteralObject", // name | 776 "JSCreateLiteralObject", // name |
778 1, 1, 1, 1, 1, 2, // counts | 777 1, 1, 1, 1, 1, 2, // counts |
779 parameters); // parameter | 778 parameters); // parameter |
780 } | 779 } |
781 | 780 |
782 | 781 |
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 | |
795 const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count) { | 782 const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count) { |
796 return new (zone()) Operator1<int>( // -- | 783 return new (zone()) Operator1<int>( // -- |
797 IrOpcode::kJSCreateFunctionContext, Operator::kNoProperties, // opcode | 784 IrOpcode::kJSCreateFunctionContext, Operator::kNoProperties, // opcode |
798 "JSCreateFunctionContext", // name | 785 "JSCreateFunctionContext", // name |
799 1, 1, 1, 1, 1, 2, // counts | 786 1, 1, 1, 1, 1, 2, // counts |
800 slot_count); // parameter | 787 slot_count); // parameter |
801 } | 788 } |
802 | 789 |
803 | 790 |
804 const Operator* JSOperatorBuilder::CreateCatchContext( | 791 const Operator* JSOperatorBuilder::CreateCatchContext( |
(...skipping 21 matching lines...) Expand all Loading... |
826 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 813 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
827 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 814 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
828 "JSCreateScriptContext", // name | 815 "JSCreateScriptContext", // name |
829 1, 1, 1, 1, 1, 2, // counts | 816 1, 1, 1, 1, 1, 2, // counts |
830 scpope_info); // parameter | 817 scpope_info); // parameter |
831 } | 818 } |
832 | 819 |
833 } // namespace compiler | 820 } // namespace compiler |
834 } // namespace internal | 821 } // namespace internal |
835 } // namespace v8 | 822 } // namespace v8 |
OLD | NEW |