OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/signature.h" | 5 #include "src/signature.h" |
6 | 6 |
7 #include "src/bit-vector.h" | 7 #include "src/bit-vector.h" |
8 #include "src/flags.h" | 8 #include "src/flags.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/zone/zone-containers.h" | 10 #include "src/zone/zone-containers.h" |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 SetBlockType(&control_.back(), operand); | 691 SetBlockType(&control_.back(), operand); |
692 len = 1 + operand.length; | 692 len = 1 + operand.length; |
693 break; | 693 break; |
694 } | 694 } |
695 case kExprIf: { | 695 case kExprIf: { |
696 // Condition on top of stack. Split environments for branches. | 696 // Condition on top of stack. Split environments for branches. |
697 BlockTypeOperand operand(this, pc_); | 697 BlockTypeOperand operand(this, pc_); |
698 Value cond = Pop(0, kAstI32); | 698 Value cond = Pop(0, kAstI32); |
699 TFNode* if_true = nullptr; | 699 TFNode* if_true = nullptr; |
700 TFNode* if_false = nullptr; | 700 TFNode* if_false = nullptr; |
701 BUILD(Branch, cond.node, &if_true, &if_false); | 701 BUILD(BranchNoHint, cond.node, &if_true, &if_false); |
702 SsaEnv* end_env = ssa_env_; | 702 SsaEnv* end_env = ssa_env_; |
703 SsaEnv* false_env = Split(ssa_env_); | 703 SsaEnv* false_env = Split(ssa_env_); |
704 false_env->control = if_false; | 704 false_env->control = if_false; |
705 SsaEnv* true_env = Steal(ssa_env_); | 705 SsaEnv* true_env = Steal(ssa_env_); |
706 true_env->control = if_true; | 706 true_env->control = if_true; |
707 PushIf(end_env, false_env); | 707 PushIf(end_env, false_env); |
708 SetEnv("if:true", true_env); | 708 SetEnv("if:true", true_env); |
709 SetBlockType(&control_.back(), operand); | 709 SetBlockType(&control_.back(), operand); |
710 len = 1 + operand.length; | 710 len = 1 + operand.length; |
711 break; | 711 break; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 if (tval.type != kAstEnd && fval.type != kAstEnd) { | 809 if (tval.type != kAstEnd && fval.type != kAstEnd) { |
810 error("type mismatch in select"); | 810 error("type mismatch in select"); |
811 break; | 811 break; |
812 } | 812 } |
813 } | 813 } |
814 if (build()) { | 814 if (build()) { |
815 DCHECK(tval.type != kAstEnd); | 815 DCHECK(tval.type != kAstEnd); |
816 DCHECK(fval.type != kAstEnd); | 816 DCHECK(fval.type != kAstEnd); |
817 DCHECK(cond.type != kAstEnd); | 817 DCHECK(cond.type != kAstEnd); |
818 TFNode* controls[2]; | 818 TFNode* controls[2]; |
819 builder_->Branch(cond.node, &controls[0], &controls[1]); | 819 builder_->BranchNoHint(cond.node, &controls[0], &controls[1]); |
820 TFNode* merge = builder_->Merge(2, controls); | 820 TFNode* merge = builder_->Merge(2, controls); |
821 TFNode* vals[2] = {tval.node, fval.node}; | 821 TFNode* vals[2] = {tval.node, fval.node}; |
822 TFNode* phi = builder_->Phi(tval.type, 2, vals, merge); | 822 TFNode* phi = builder_->Phi(tval.type, 2, vals, merge); |
823 Push(tval.type, phi); | 823 Push(tval.type, phi); |
824 ssa_env_->control = merge; | 824 ssa_env_->control = merge; |
825 } else { | 825 } else { |
826 Push(tval.type, nullptr); | 826 Push(tval.type, nullptr); |
827 } | 827 } |
828 break; | 828 break; |
829 } | 829 } |
830 case kExprBr: { | 830 case kExprBr: { |
831 BreakDepthOperand operand(this, pc_); | 831 BreakDepthOperand operand(this, pc_); |
832 if (Validate(pc_, operand, control_)) { | 832 if (Validate(pc_, operand, control_)) { |
833 BreakTo(operand.depth); | 833 BreakTo(operand.depth); |
834 } | 834 } |
835 len = 1 + operand.length; | 835 len = 1 + operand.length; |
836 EndControl(); | 836 EndControl(); |
837 break; | 837 break; |
838 } | 838 } |
839 case kExprBrIf: { | 839 case kExprBrIf: { |
840 BreakDepthOperand operand(this, pc_); | 840 BreakDepthOperand operand(this, pc_); |
841 Value cond = Pop(0, kAstI32); | 841 Value cond = Pop(0, kAstI32); |
842 if (ok() && Validate(pc_, operand, control_)) { | 842 if (ok() && Validate(pc_, operand, control_)) { |
843 SsaEnv* fenv = ssa_env_; | 843 SsaEnv* fenv = ssa_env_; |
844 SsaEnv* tenv = Split(fenv); | 844 SsaEnv* tenv = Split(fenv); |
845 fenv->SetNotMerged(); | 845 fenv->SetNotMerged(); |
846 BUILD(Branch, cond.node, &tenv->control, &fenv->control); | 846 BUILD(BranchNoHint, cond.node, &tenv->control, &fenv->control); |
847 ssa_env_ = tenv; | 847 ssa_env_ = tenv; |
848 BreakTo(operand.depth); | 848 BreakTo(operand.depth); |
849 ssa_env_ = fenv; | 849 ssa_env_ = fenv; |
850 } | 850 } |
851 len = 1 + operand.length; | 851 len = 1 + operand.length; |
852 break; | 852 break; |
853 } | 853 } |
854 case kExprBrTable: { | 854 case kExprBrTable: { |
855 BranchTableOperand operand(this, pc_); | 855 BranchTableOperand operand(this, pc_); |
856 BranchTableIterator iterator(this, operand); | 856 BranchTableIterator iterator(this, operand); |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1951 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
1952 const byte* start, const byte* end) { | 1952 const byte* start, const byte* end) { |
1953 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1953 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
1954 WasmFullDecoder decoder(zone, nullptr, body); | 1954 WasmFullDecoder decoder(zone, nullptr, body); |
1955 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1955 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
1956 } | 1956 } |
1957 | 1957 |
1958 } // namespace wasm | 1958 } // namespace wasm |
1959 } // namespace internal | 1959 } // namespace internal |
1960 } // namespace v8 | 1960 } // namespace v8 |
OLD | NEW |