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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 }; | 81 }; |
82 | 82 |
83 struct MergeValues { | 83 struct MergeValues { |
84 uint32_t arity; | 84 uint32_t arity; |
85 union { | 85 union { |
86 Value* array; | 86 Value* array; |
87 Value first; | 87 Value first; |
88 } vals; // Either multiple values or a single value. | 88 } vals; // Either multiple values or a single value. |
89 | 89 |
90 Value& first() { | 90 Value& first() { |
91 DCHECK_GT(arity, 0); | 91 DCHECK_GT(arity, 0u); |
92 return arity == 1 ? vals.first : vals.array[0]; | 92 return arity == 1 ? vals.first : vals.array[0]; |
93 } | 93 } |
94 }; | 94 }; |
95 | 95 |
96 static Value* NO_VALUE = nullptr; | 96 static Value* NO_VALUE = nullptr; |
97 | 97 |
98 enum ControlKind { kControlIf, kControlBlock, kControlLoop, kControlTry }; | 98 enum ControlKind { kControlIf, kControlBlock, kControlLoop, kControlTry }; |
99 | 99 |
100 // An entry on the control stack (i.e. if, block, loop). | 100 // An entry on the control stack (i.e. if, block, loop). |
101 struct Control { | 101 struct Control { |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 for (int i = 0; i < kMaxIndent; ++i) bytes[i] = ' '; | 570 for (int i = 0; i < kMaxIndent; ++i) bytes[i] = ' '; |
571 bytes[kMaxIndent] = 0; | 571 bytes[kMaxIndent] = 0; |
572 if (stack_.size() < kMaxIndent / 2) { | 572 if (stack_.size() < kMaxIndent / 2) { |
573 bytes[stack_.size() * 2] = 0; | 573 bytes[stack_.size() * 2] = 0; |
574 } | 574 } |
575 return bytes; | 575 return bytes; |
576 } | 576 } |
577 | 577 |
578 // Decodes the locals declarations, if any, populating {local_type_vec_}. | 578 // Decodes the locals declarations, if any, populating {local_type_vec_}. |
579 void DecodeLocalDecls() { | 579 void DecodeLocalDecls() { |
580 DCHECK_EQ(0, local_type_vec_.size()); | 580 DCHECK_EQ(0u, local_type_vec_.size()); |
581 // Initialize {local_type_vec} from signature. | 581 // Initialize {local_type_vec} from signature. |
582 if (sig_) { | 582 if (sig_) { |
583 local_type_vec_.reserve(sig_->parameter_count()); | 583 local_type_vec_.reserve(sig_->parameter_count()); |
584 for (size_t i = 0; i < sig_->parameter_count(); ++i) { | 584 for (size_t i = 0; i < sig_->parameter_count(); ++i) { |
585 local_type_vec_.push_back(sig_->GetParam(i)); | 585 local_type_vec_.push_back(sig_->GetParam(i)); |
586 } | 586 } |
587 } | 587 } |
588 // Decode local declarations, if any. | 588 // Decode local declarations, if any. |
589 uint32_t entries = consume_u32v("local decls count"); | 589 uint32_t entries = consume_u32v("local decls count"); |
590 TRACE("local decls count: %u\n", entries); | 590 TRACE("local decls count: %u\n", entries); |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 | 1436 |
1437 Value PopUpTo(int stack_depth) { | 1437 Value PopUpTo(int stack_depth) { |
1438 if (!ssa_env_->go()) { | 1438 if (!ssa_env_->go()) { |
1439 // Unreachable code is essentially not typechecked. | 1439 // Unreachable code is essentially not typechecked. |
1440 return {pc_, nullptr, kAstEnd}; | 1440 return {pc_, nullptr, kAstEnd}; |
1441 } | 1441 } |
1442 if (stack_depth == static_cast<int>(stack_.size())) { | 1442 if (stack_depth == static_cast<int>(stack_.size())) { |
1443 Value val = {pc_, nullptr, kAstStmt}; | 1443 Value val = {pc_, nullptr, kAstStmt}; |
1444 return val; | 1444 return val; |
1445 } else { | 1445 } else { |
1446 DCHECK_LE(stack_depth, stack_.size()); | 1446 DCHECK_LE(stack_depth, static_cast<int>(stack_.size())); |
1447 Value val = Pop(); | 1447 Value val = Pop(); |
1448 stack_.resize(stack_depth); | 1448 stack_.resize(stack_depth); |
1449 return val; | 1449 return val; |
1450 } | 1450 } |
1451 } | 1451 } |
1452 | 1452 |
1453 int baserel(const byte* ptr) { | 1453 int baserel(const byte* ptr) { |
1454 return base_ ? static_cast<int>(ptr - base_) : 0; | 1454 return base_ ? static_cast<int>(ptr - base_) : 0; |
1455 } | 1455 } |
1456 | 1456 |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 2038 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
2039 const byte* start, const byte* end) { | 2039 const byte* start, const byte* end) { |
2040 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 2040 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
2041 WasmFullDecoder decoder(zone, nullptr, body); | 2041 WasmFullDecoder decoder(zone, nullptr, body); |
2042 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 2042 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
2043 } | 2043 } |
2044 | 2044 |
2045 } // namespace wasm | 2045 } // namespace wasm |
2046 } // namespace internal | 2046 } // namespace internal |
2047 } // namespace v8 | 2047 } // namespace v8 |
OLD | NEW |