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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 370 |
371 | 371 |
372 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { | 372 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { |
373 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || | 373 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || |
374 op->opcode() == IrOpcode::kJSCreateLiteralObject || | 374 op->opcode() == IrOpcode::kJSCreateLiteralObject || |
375 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); | 375 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); |
376 return OpParameter<CreateLiteralParameters>(op); | 376 return OpParameter<CreateLiteralParameters>(op); |
377 } | 377 } |
378 | 378 |
379 const BinaryOperationHints& BinaryOperationHintsOf(const Operator* op) { | 379 const BinaryOperationHints& BinaryOperationHintsOf(const Operator* op) { |
380 DCHECK(op->opcode() == IrOpcode::kJSAdd || | 380 DCHECK(op->opcode() == IrOpcode::kJSBitwiseOr || |
381 op->opcode() == IrOpcode::kJSSubtract); | 381 op->opcode() == IrOpcode::kJSBitwiseXor || |
| 382 op->opcode() == IrOpcode::kJSBitwiseAnd || |
| 383 op->opcode() == IrOpcode::kJSShiftLeft || |
| 384 op->opcode() == IrOpcode::kJSShiftRight || |
| 385 op->opcode() == IrOpcode::kJSShiftRightLogical || |
| 386 op->opcode() == IrOpcode::kJSAdd || |
| 387 op->opcode() == IrOpcode::kJSSubtract || |
| 388 op->opcode() == IrOpcode::kJSMultiply || |
| 389 op->opcode() == IrOpcode::kJSDivide || |
| 390 op->opcode() == IrOpcode::kJSModulus); |
382 return OpParameter<BinaryOperationHints>(op); | 391 return OpParameter<BinaryOperationHints>(op); |
383 } | 392 } |
384 | 393 |
| 394 const CompareOperationHints& CompareOperationHintsOf(const Operator* op) { |
| 395 DCHECK(op->opcode() == IrOpcode::kJSEqual || |
| 396 op->opcode() == IrOpcode::kJSNotEqual || |
| 397 op->opcode() == IrOpcode::kJSStrictEqual || |
| 398 op->opcode() == IrOpcode::kJSStrictNotEqual || |
| 399 op->opcode() == IrOpcode::kJSLessThan || |
| 400 op->opcode() == IrOpcode::kJSGreaterThan || |
| 401 op->opcode() == IrOpcode::kJSLessThanOrEqual || |
| 402 op->opcode() == IrOpcode::kJSGreaterThanOrEqual); |
| 403 return OpParameter<CompareOperationHints>(op); |
| 404 } |
| 405 |
385 #define CACHED_OP_LIST(V) \ | 406 #define CACHED_OP_LIST(V) \ |
386 V(Equal, Operator::kNoProperties, 2, 1) \ | |
387 V(NotEqual, Operator::kNoProperties, 2, 1) \ | |
388 V(StrictEqual, Operator::kPure, 2, 1) \ | |
389 V(StrictNotEqual, Operator::kPure, 2, 1) \ | |
390 V(LessThan, Operator::kNoProperties, 2, 1) \ | |
391 V(GreaterThan, Operator::kNoProperties, 2, 1) \ | |
392 V(LessThanOrEqual, Operator::kNoProperties, 2, 1) \ | |
393 V(GreaterThanOrEqual, Operator::kNoProperties, 2, 1) \ | |
394 V(ToInteger, Operator::kNoProperties, 1, 1) \ | 407 V(ToInteger, Operator::kNoProperties, 1, 1) \ |
395 V(ToLength, Operator::kNoProperties, 1, 1) \ | 408 V(ToLength, Operator::kNoProperties, 1, 1) \ |
396 V(ToName, Operator::kNoProperties, 1, 1) \ | 409 V(ToName, Operator::kNoProperties, 1, 1) \ |
397 V(ToNumber, Operator::kNoProperties, 1, 1) \ | 410 V(ToNumber, Operator::kNoProperties, 1, 1) \ |
398 V(ToObject, Operator::kFoldable, 1, 1) \ | 411 V(ToObject, Operator::kFoldable, 1, 1) \ |
399 V(ToString, Operator::kNoProperties, 1, 1) \ | 412 V(ToString, Operator::kNoProperties, 1, 1) \ |
400 V(Create, Operator::kEliminatable, 2, 1) \ | 413 V(Create, Operator::kEliminatable, 2, 1) \ |
401 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ | 414 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ |
402 V(HasProperty, Operator::kNoProperties, 2, 1) \ | 415 V(HasProperty, Operator::kNoProperties, 2, 1) \ |
403 V(TypeOf, Operator::kPure, 1, 1) \ | 416 V(TypeOf, Operator::kPure, 1, 1) \ |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 | 550 |
538 const Operator* JSOperatorBuilder::Modulus(BinaryOperationHints hints) { | 551 const Operator* JSOperatorBuilder::Modulus(BinaryOperationHints hints) { |
539 // TODO(turbofan): Cache most important versions of this operator. | 552 // TODO(turbofan): Cache most important versions of this operator. |
540 return new (zone()) Operator1<BinaryOperationHints>( //-- | 553 return new (zone()) Operator1<BinaryOperationHints>( //-- |
541 IrOpcode::kJSModulus, Operator::kNoProperties, // opcode | 554 IrOpcode::kJSModulus, Operator::kNoProperties, // opcode |
542 "JSModulus", // name | 555 "JSModulus", // name |
543 2, 1, 1, 1, 1, 2, // inputs/outputs | 556 2, 1, 1, 1, 1, 2, // inputs/outputs |
544 hints); // parameter | 557 hints); // parameter |
545 } | 558 } |
546 | 559 |
| 560 const Operator* JSOperatorBuilder::Equal(CompareOperationHints hints) { |
| 561 // TODO(turbofan): Cache most important versions of this operator. |
| 562 return new (zone()) Operator1<CompareOperationHints>( //-- |
| 563 IrOpcode::kJSEqual, Operator::kNoProperties, // opcode |
| 564 "JSEqual", // name |
| 565 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 566 hints); // parameter |
| 567 } |
| 568 |
| 569 const Operator* JSOperatorBuilder::NotEqual(CompareOperationHints hints) { |
| 570 // TODO(turbofan): Cache most important versions of this operator. |
| 571 return new (zone()) Operator1<CompareOperationHints>( //-- |
| 572 IrOpcode::kJSNotEqual, Operator::kNoProperties, // opcode |
| 573 "JSNotEqual", // name |
| 574 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 575 hints); // parameter |
| 576 } |
| 577 |
| 578 const Operator* JSOperatorBuilder::StrictEqual(CompareOperationHints hints) { |
| 579 // TODO(turbofan): Cache most important versions of this operator. |
| 580 return new (zone()) Operator1<CompareOperationHints>( //-- |
| 581 IrOpcode::kJSStrictEqual, Operator::kPure, // opcode |
| 582 "JSStrictEqual", // name |
| 583 2, 0, 0, 1, 0, 0, // inputs/outputs |
| 584 hints); // parameter |
| 585 } |
| 586 |
| 587 const Operator* JSOperatorBuilder::StrictNotEqual(CompareOperationHints hints) { |
| 588 // TODO(turbofan): Cache most important versions of this operator. |
| 589 return new (zone()) Operator1<CompareOperationHints>( //-- |
| 590 IrOpcode::kJSStrictNotEqual, Operator::kPure, // opcode |
| 591 "JSStrictNotEqual", // name |
| 592 2, 0, 0, 1, 0, 0, // inputs/outputs |
| 593 hints); // parameter |
| 594 } |
| 595 |
| 596 const Operator* JSOperatorBuilder::LessThan(CompareOperationHints hints) { |
| 597 // TODO(turbofan): Cache most important versions of this operator. |
| 598 return new (zone()) Operator1<CompareOperationHints>( //-- |
| 599 IrOpcode::kJSLessThan, Operator::kNoProperties, // opcode |
| 600 "JSLessThan", // name |
| 601 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 602 hints); // parameter |
| 603 } |
| 604 |
| 605 const Operator* JSOperatorBuilder::GreaterThan(CompareOperationHints hints) { |
| 606 // TODO(turbofan): Cache most important versions of this operator. |
| 607 return new (zone()) Operator1<CompareOperationHints>( //-- |
| 608 IrOpcode::kJSGreaterThan, Operator::kNoProperties, // opcode |
| 609 "JSGreaterThan", // name |
| 610 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 611 hints); // parameter |
| 612 } |
| 613 |
| 614 const Operator* JSOperatorBuilder::LessThanOrEqual( |
| 615 CompareOperationHints hints) { |
| 616 // TODO(turbofan): Cache most important versions of this operator. |
| 617 return new (zone()) Operator1<CompareOperationHints>( //-- |
| 618 IrOpcode::kJSLessThanOrEqual, Operator::kNoProperties, // opcode |
| 619 "JSLessThanOrEqual", // name |
| 620 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 621 hints); // parameter |
| 622 } |
| 623 |
| 624 const Operator* JSOperatorBuilder::GreaterThanOrEqual( |
| 625 CompareOperationHints hints) { |
| 626 // TODO(turbofan): Cache most important versions of this operator. |
| 627 return new (zone()) Operator1<CompareOperationHints>( //-- |
| 628 IrOpcode::kJSGreaterThanOrEqual, Operator::kNoProperties, // opcode |
| 629 "JSGreaterThanOrEqual", // name |
| 630 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 631 hints); // parameter |
| 632 } |
547 | 633 |
548 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { | 634 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { |
549 // TODO(turbofan): Cache most important versions of this operator. | 635 // TODO(turbofan): Cache most important versions of this operator. |
550 return new (zone()) Operator1<ToBooleanHints>( //-- | 636 return new (zone()) Operator1<ToBooleanHints>( //-- |
551 IrOpcode::kJSToBoolean, Operator::kPure, // opcode | 637 IrOpcode::kJSToBoolean, Operator::kPure, // opcode |
552 "JSToBoolean", // name | 638 "JSToBoolean", // name |
553 1, 0, 0, 1, 0, 0, // inputs/outputs | 639 1, 0, 0, 1, 0, 0, // inputs/outputs |
554 hints); // parameter | 640 hints); // parameter |
555 } | 641 } |
556 | 642 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 916 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
831 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 917 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
832 "JSCreateScriptContext", // name | 918 "JSCreateScriptContext", // name |
833 1, 1, 1, 1, 1, 2, // counts | 919 1, 1, 1, 1, 1, 2, // counts |
834 scpope_info); // parameter | 920 scpope_info); // parameter |
835 } | 921 } |
836 | 922 |
837 } // namespace compiler | 923 } // namespace compiler |
838 } // namespace internal | 924 } // namespace internal |
839 } // namespace v8 | 925 } // namespace v8 |
OLD | NEW |