Chromium Code Reviews| 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 op->opcode() == IrOpcode::kJSHasProperty || | |
|
Benedikt Meurer
2016/06/07 04:11:00
HasProperty and InstanceOf don't have CompareOpera
Jarin
2016/06/09 13:37:31
Done.
| |
| 404 op->opcode() == IrOpcode::kJSInstanceOf); | |
| 405 return OpParameter<CompareOperationHints>(op); | |
| 406 } | |
| 407 | |
| 385 #define CACHED_OP_LIST(V) \ | 408 #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) \ | 409 V(ToInteger, Operator::kNoProperties, 1, 1) \ |
| 395 V(ToLength, Operator::kNoProperties, 1, 1) \ | 410 V(ToLength, Operator::kNoProperties, 1, 1) \ |
| 396 V(ToName, Operator::kNoProperties, 1, 1) \ | 411 V(ToName, Operator::kNoProperties, 1, 1) \ |
| 397 V(ToNumber, Operator::kNoProperties, 1, 1) \ | 412 V(ToNumber, Operator::kNoProperties, 1, 1) \ |
| 398 V(ToObject, Operator::kFoldable, 1, 1) \ | 413 V(ToObject, Operator::kFoldable, 1, 1) \ |
| 399 V(ToString, Operator::kNoProperties, 1, 1) \ | 414 V(ToString, Operator::kNoProperties, 1, 1) \ |
| 400 V(Create, Operator::kEliminatable, 2, 1) \ | 415 V(Create, Operator::kEliminatable, 2, 1) \ |
| 401 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ | 416 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ |
| 402 V(HasProperty, Operator::kNoProperties, 2, 1) \ | |
|
Benedikt Meurer
2016/06/07 04:11:00
See comment above.
Jarin
2016/06/09 13:37:31
Done.
| |
| 403 V(TypeOf, Operator::kPure, 1, 1) \ | 417 V(TypeOf, Operator::kPure, 1, 1) \ |
| 404 V(InstanceOf, Operator::kNoProperties, 2, 1) \ | |
|
Benedikt Meurer
2016/06/07 04:11:00
See comment above.
Jarin
2016/06/09 13:37:31
Done.
| |
| 405 V(ForInDone, Operator::kPure, 2, 1) \ | 418 V(ForInDone, Operator::kPure, 2, 1) \ |
| 406 V(ForInNext, Operator::kNoProperties, 4, 1) \ | 419 V(ForInNext, Operator::kNoProperties, 4, 1) \ |
| 407 V(ForInPrepare, Operator::kNoProperties, 1, 3) \ | 420 V(ForInPrepare, Operator::kNoProperties, 1, 3) \ |
| 408 V(ForInStep, Operator::kPure, 1, 1) \ | 421 V(ForInStep, Operator::kPure, 1, 1) \ |
| 409 V(LoadMessage, Operator::kNoThrow, 0, 1) \ | 422 V(LoadMessage, Operator::kNoThrow, 0, 1) \ |
| 410 V(StoreMessage, Operator::kNoThrow, 1, 0) \ | 423 V(StoreMessage, Operator::kNoThrow, 1, 0) \ |
| 411 V(GeneratorRestoreContinuation, Operator::kNoThrow, 1, 1) \ | 424 V(GeneratorRestoreContinuation, Operator::kNoThrow, 1, 1) \ |
| 412 V(StackCheck, Operator::kNoProperties, 0, 0) \ | 425 V(StackCheck, Operator::kNoProperties, 0, 0) \ |
| 413 V(CreateWithContext, Operator::kNoProperties, 2, 1) \ | 426 V(CreateWithContext, Operator::kNoProperties, 2, 1) \ |
| 414 V(CreateModuleContext, Operator::kNoProperties, 2, 1) | 427 V(CreateModuleContext, Operator::kNoProperties, 2, 1) |
| (...skipping 122 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 } | |
| 633 | |
| 634 const Operator* JSOperatorBuilder::HasProperty(CompareOperationHints hints) { | |
| 635 // TODO(turbofan): Cache most important versions of this operator. | |
| 636 return new (zone()) Operator1<CompareOperationHints>( //-- | |
| 637 IrOpcode::kJSHasProperty, Operator::kNoProperties, // opcode | |
| 638 "JSHasProperty", // name | |
| 639 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 640 hints); // parameter | |
| 641 } | |
| 642 | |
| 643 const Operator* JSOperatorBuilder::InstanceOf(CompareOperationHints hints) { | |
| 644 // TODO(turbofan): Cache most important versions of this operator. | |
| 645 return new (zone()) Operator1<CompareOperationHints>( //-- | |
| 646 IrOpcode::kJSInstanceOf, Operator::kNoProperties, // opcode | |
| 647 "JSInstanceOf", // name | |
| 648 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 649 hints); // parameter | |
| 650 } | |
| 651 | |
| 547 | 652 |
| 548 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { | 653 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { |
| 549 // TODO(turbofan): Cache most important versions of this operator. | 654 // TODO(turbofan): Cache most important versions of this operator. |
| 550 return new (zone()) Operator1<ToBooleanHints>( //-- | 655 return new (zone()) Operator1<ToBooleanHints>( //-- |
| 551 IrOpcode::kJSToBoolean, Operator::kPure, // opcode | 656 IrOpcode::kJSToBoolean, Operator::kPure, // opcode |
| 552 "JSToBoolean", // name | 657 "JSToBoolean", // name |
| 553 1, 0, 0, 1, 0, 0, // inputs/outputs | 658 1, 0, 0, 1, 0, 0, // inputs/outputs |
| 554 hints); // parameter | 659 hints); // parameter |
| 555 } | 660 } |
| 556 | 661 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 935 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
| 831 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 936 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
| 832 "JSCreateScriptContext", // name | 937 "JSCreateScriptContext", // name |
| 833 1, 1, 1, 1, 1, 2, // counts | 938 1, 1, 1, 1, 1, 2, // counts |
| 834 scpope_info); // parameter | 939 scpope_info); // parameter |
| 835 } | 940 } |
| 836 | 941 |
| 837 } // namespace compiler | 942 } // namespace compiler |
| 838 } // namespace internal | 943 } // namespace internal |
| 839 } // namespace v8 | 944 } // namespace v8 |
| OLD | NEW |