Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(655)

Side by Side Diff: src/compiler/js-operator.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 } 483 }
484 484
485 485
486 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { 486 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) {
487 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || 487 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray ||
488 op->opcode() == IrOpcode::kJSCreateLiteralObject || 488 op->opcode() == IrOpcode::kJSCreateLiteralObject ||
489 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); 489 op->opcode() == IrOpcode::kJSCreateLiteralRegExp);
490 return OpParameter<CreateLiteralParameters>(op); 490 return OpParameter<CreateLiteralParameters>(op);
491 } 491 }
492 492
493 bool operator==(GeneratorStoreParameters const& lhs,
494 GeneratorStoreParameters const& rhs) {
495 return lhs.register_count() == rhs.register_count() &&
496 lhs.suspend_type() == rhs.suspend_type();
497 }
498 bool operator!=(GeneratorStoreParameters const& lhs,
499 GeneratorStoreParameters const& rhs) {
500 return !(lhs == rhs);
501 }
502
503 size_t hash_value(GeneratorStoreParameters const& p) {
504 return base::hash_combine(p.register_count(),
505 static_cast<int>(p.suspend_type()));
506 }
507
508 std::ostream& operator<<(std::ostream& os, GeneratorStoreParameters const& p) {
509 const char* suspend_type =
510 p.suspend_type() == SuspendType::kYield ? "yield" : "await";
511 return os << p.register_count() << " (" << suspend_type << ")";
512 }
513
514 const GeneratorStoreParameters& GeneratorStoreParametersOf(const Operator* op) {
515 DCHECK_EQ(op->opcode(), IrOpcode::kJSGeneratorStore);
516 return OpParameter<GeneratorStoreParameters>(op);
517 }
518
493 BinaryOperationHint BinaryOperationHintOf(const Operator* op) { 519 BinaryOperationHint BinaryOperationHintOf(const Operator* op) {
494 DCHECK(op->opcode() == IrOpcode::kJSBitwiseOr || 520 DCHECK(op->opcode() == IrOpcode::kJSBitwiseOr ||
495 op->opcode() == IrOpcode::kJSBitwiseXor || 521 op->opcode() == IrOpcode::kJSBitwiseXor ||
496 op->opcode() == IrOpcode::kJSBitwiseAnd || 522 op->opcode() == IrOpcode::kJSBitwiseAnd ||
497 op->opcode() == IrOpcode::kJSShiftLeft || 523 op->opcode() == IrOpcode::kJSShiftLeft ||
498 op->opcode() == IrOpcode::kJSShiftRight || 524 op->opcode() == IrOpcode::kJSShiftRight ||
499 op->opcode() == IrOpcode::kJSShiftRightLogical || 525 op->opcode() == IrOpcode::kJSShiftRightLogical ||
500 op->opcode() == IrOpcode::kJSAdd || 526 op->opcode() == IrOpcode::kJSAdd ||
501 op->opcode() == IrOpcode::kJSSubtract || 527 op->opcode() == IrOpcode::kJSSubtract ||
502 op->opcode() == IrOpcode::kJSMultiply || 528 op->opcode() == IrOpcode::kJSMultiply ||
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 const Operator* JSOperatorBuilder::LoadProperty( 800 const Operator* JSOperatorBuilder::LoadProperty(
775 VectorSlotPair const& feedback) { 801 VectorSlotPair const& feedback) {
776 PropertyAccess access(SLOPPY, feedback); 802 PropertyAccess access(SLOPPY, feedback);
777 return new (zone()) Operator1<PropertyAccess>( // -- 803 return new (zone()) Operator1<PropertyAccess>( // --
778 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode 804 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode
779 "JSLoadProperty", // name 805 "JSLoadProperty", // name
780 2, 1, 1, 1, 1, 2, // counts 806 2, 1, 1, 1, 1, 2, // counts
781 access); // parameter 807 access); // parameter
782 } 808 }
783 809
784 const Operator* JSOperatorBuilder::GeneratorStore(int register_count) { 810 const Operator* JSOperatorBuilder::GeneratorStore(int register_count,
785 return new (zone()) Operator1<int>( // -- 811 SuspendType suspend_type) {
786 IrOpcode::kJSGeneratorStore, Operator::kNoThrow, // opcode 812 GeneratorStoreParameters parameters(register_count, suspend_type);
787 "JSGeneratorStore", // name 813 return new (zone()) Operator1<GeneratorStoreParameters>( // --
788 3 + register_count, 1, 1, 0, 1, 0, // counts 814 IrOpcode::kJSGeneratorStore, Operator::kNoThrow, // opcode
789 register_count); // parameter 815 "JSGeneratorStore", // name
816 3 + register_count, 1, 1, 0, 1, 0, // counts
817 parameters); // parameter
790 } 818 }
791 819
792 const Operator* JSOperatorBuilder::GeneratorRestoreRegister(int index) { 820 const Operator* JSOperatorBuilder::GeneratorRestoreRegister(int index) {
793 return new (zone()) Operator1<int>( // -- 821 return new (zone()) Operator1<int>( // --
794 IrOpcode::kJSGeneratorRestoreRegister, Operator::kNoThrow, // opcode 822 IrOpcode::kJSGeneratorRestoreRegister, Operator::kNoThrow, // opcode
795 "JSGeneratorRestoreRegister", // name 823 "JSGeneratorRestoreRegister", // name
796 1, 1, 1, 1, 1, 0, // counts 824 1, 1, 1, 1, 1, 0, // counts
797 index); // parameter 825 index); // parameter
798 } 826 }
799 827
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- 1032 return new (zone()) Operator1<Handle<ScopeInfo>>( // --
1005 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode 1033 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode
1006 "JSCreateScriptContext", // name 1034 "JSCreateScriptContext", // name
1007 1, 1, 1, 1, 1, 2, // counts 1035 1, 1, 1, 1, 1, 2, // counts
1008 scope_info); // parameter 1036 scope_info); // parameter
1009 } 1037 }
1010 1038
1011 } // namespace compiler 1039 } // namespace compiler
1012 } // namespace internal 1040 } // namespace internal
1013 } // namespace v8 1041 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698