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/macro-assembler.h" | 5 #include "src/macro-assembler.h" |
6 #include "src/objects.h" | 6 #include "src/objects.h" |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/simulator.h" | 9 #include "src/simulator.h" |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 os << (1 << module.min_mem_size_log2) << " min mem"; | 24 os << (1 << module.min_mem_size_log2) << " min mem"; |
25 os << (1 << module.max_mem_size_log2) << " max mem"; | 25 os << (1 << module.max_mem_size_log2) << " max mem"; |
26 if (module.functions) os << module.functions->size() << " functions"; | 26 if (module.functions) os << module.functions->size() << " functions"; |
27 if (module.globals) os << module.functions->size() << " globals"; | 27 if (module.globals) os << module.functions->size() << " globals"; |
28 if (module.data_segments) os << module.functions->size() << " data segments"; | 28 if (module.data_segments) os << module.functions->size() << " data segments"; |
29 return os; | 29 return os; |
30 } | 30 } |
31 | 31 |
32 | 32 |
33 std::ostream& operator<<(std::ostream& os, const WasmFunction& function) { | 33 std::ostream& operator<<(std::ostream& os, const WasmFunction& function) { |
34 os << "WASM function with signature "; | 34 os << "WASM function with signature " << *function.sig; |
35 | 35 |
36 // TODO(titzer): factor out rendering of signatures. | |
37 if (function.sig->return_count() == 0) os << "v"; | |
38 for (size_t i = 0; i < function.sig->return_count(); i++) { | |
39 os << WasmOpcodes::ShortNameOf(function.sig->GetReturn(i)); | |
40 } | |
41 os << "_"; | |
42 if (function.sig->parameter_count() == 0) os << "v"; | |
43 for (size_t i = 0; i < function.sig->parameter_count(); i++) { | |
44 os << WasmOpcodes::ShortNameOf(function.sig->GetParam(i)); | |
45 } | |
46 os << " locals: "; | 36 os << " locals: "; |
47 if (function.local_int32_count) | 37 if (function.local_int32_count) |
48 os << function.local_int32_count << " int32s "; | 38 os << function.local_int32_count << " int32s "; |
49 if (function.local_int64_count) | 39 if (function.local_int64_count) |
50 os << function.local_int64_count << " int64s "; | 40 os << function.local_int64_count << " int64s "; |
51 if (function.local_float32_count) | 41 if (function.local_float32_count) |
52 os << function.local_float32_count << " float32s "; | 42 os << function.local_float32_count << " float32s "; |
53 if (function.local_float64_count) | 43 if (function.local_float64_count) |
54 os << function.local_float64_count << " float64s "; | 44 os << function.local_float64_count << " float64s "; |
55 | 45 |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 } | 503 } |
514 if (result->IsHeapNumber()) { | 504 if (result->IsHeapNumber()) { |
515 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); | 505 return static_cast<int32_t>(HeapNumber::cast(*result)->value()); |
516 } | 506 } |
517 thrower.Error("WASM.compileRun() failed: Return value should be number"); | 507 thrower.Error("WASM.compileRun() failed: Return value should be number"); |
518 return -1; | 508 return -1; |
519 } | 509 } |
520 } // namespace wasm | 510 } // namespace wasm |
521 } // namespace internal | 511 } // namespace internal |
522 } // namespace v8 | 512 } // namespace v8 |
OLD | NEW |