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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 base_(body.base), | 374 base_(body.base), |
375 local_type_vec_(zone), | 375 local_type_vec_(zone), |
376 stack_(zone), | 376 stack_(zone), |
377 control_(zone), | 377 control_(zone), |
378 last_end_found_(false), | 378 last_end_found_(false), |
379 current_catch_(kNullCatch) { | 379 current_catch_(kNullCatch) { |
380 local_types_ = &local_type_vec_; | 380 local_types_ = &local_type_vec_; |
381 } | 381 } |
382 | 382 |
383 bool Decode() { | 383 bool Decode() { |
| 384 if (FLAG_wasm_code_generate_test) { |
| 385 PrintAstForDebugging(start_, end_); |
| 386 } |
384 base::ElapsedTimer decode_timer; | 387 base::ElapsedTimer decode_timer; |
385 if (FLAG_trace_wasm_decode_time) { | 388 if (FLAG_trace_wasm_decode_time) { |
386 decode_timer.Start(); | 389 decode_timer.Start(); |
387 } | 390 } |
388 stack_.clear(); | 391 stack_.clear(); |
389 control_.clear(); | 392 control_.clear(); |
390 | 393 |
391 if (end_ < pc_) { | 394 if (end_ < pc_) { |
392 error("function body end < start"); | 395 error("function body end < start"); |
393 return false; | 396 return false; |
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 | 1924 |
1922 // Print the function signature. | 1925 // Print the function signature. |
1923 if (body.sig) { | 1926 if (body.sig) { |
1924 os << "// signature: " << *body.sig << std::endl; | 1927 os << "// signature: " << *body.sig << std::endl; |
1925 ++line_nr; | 1928 ++line_nr; |
1926 } | 1929 } |
1927 | 1930 |
1928 // Print the local declarations. | 1931 // Print the local declarations. |
1929 AstLocalDecls decls(&zone); | 1932 AstLocalDecls decls(&zone); |
1930 BytecodeIterator i(body.start, body.end, &decls); | 1933 BytecodeIterator i(body.start, body.end, &decls); |
1931 if (body.start != i.pc()) { | 1934 if (body.start != i.pc() && !FLAG_wasm_code_generate_test) { |
1932 os << "// locals: "; | 1935 os << "// locals: "; |
1933 for (auto p : decls.local_types) { | 1936 for (auto p : decls.local_types) { |
1934 LocalType type = p.first; | 1937 LocalType type = p.first; |
1935 uint32_t count = p.second; | 1938 uint32_t count = p.second; |
1936 os << " " << count << " " << WasmOpcodes::TypeName(type); | 1939 os << " " << count << " " << WasmOpcodes::TypeName(type); |
1937 } | 1940 } |
1938 os << std::endl; | 1941 os << std::endl; |
1939 ++line_nr; | 1942 ++line_nr; |
1940 | 1943 |
1941 for (const byte* locals = body.start; locals < i.pc(); locals++) { | 1944 for (const byte* locals = body.start; locals < i.pc(); locals++) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 2038 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
2036 const byte* start, const byte* end) { | 2039 const byte* start, const byte* end) { |
2037 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 2040 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
2038 WasmFullDecoder decoder(zone, nullptr, body); | 2041 WasmFullDecoder decoder(zone, nullptr, body); |
2039 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 2042 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
2040 } | 2043 } |
2041 | 2044 |
2042 } // namespace wasm | 2045 } // namespace wasm |
2043 } // namespace internal | 2046 } // namespace internal |
2044 } // namespace v8 | 2047 } // namespace v8 |
OLD | NEW |