OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef WASM_RUN_UTILS_H | 5 #ifndef WASM_RUN_UTILS_H |
6 #define WASM_RUN_UTILS_H | 6 #define WASM_RUN_UTILS_H |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
11 | 11 |
| 12 #include <memory> |
| 13 |
12 #include "src/base/accounting-allocator.h" | 14 #include "src/base/accounting-allocator.h" |
13 #include "src/base/utils/random-number-generator.h" | 15 #include "src/base/utils/random-number-generator.h" |
14 | 16 |
15 #include "src/compiler/graph-visualizer.h" | 17 #include "src/compiler/graph-visualizer.h" |
16 #include "src/compiler/int64-lowering.h" | 18 #include "src/compiler/int64-lowering.h" |
17 #include "src/compiler/js-graph.h" | 19 #include "src/compiler/js-graph.h" |
18 #include "src/compiler/node.h" | 20 #include "src/compiler/node.h" |
19 #include "src/compiler/pipeline.h" | 21 #include "src/compiler/pipeline.h" |
20 #include "src/compiler/wasm-compiler.h" | 22 #include "src/compiler/wasm-compiler.h" |
21 #include "src/compiler/zone-pool.h" | 23 #include "src/compiler/zone-pool.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 } | 535 } |
534 | 536 |
535 Handle<Code> Compile() { | 537 Handle<Code> Compile() { |
536 InitializeDescriptor(); | 538 InitializeDescriptor(); |
537 CallDescriptor* desc = descriptor_; | 539 CallDescriptor* desc = descriptor_; |
538 if (kPointerSize == 4) { | 540 if (kPointerSize == 4) { |
539 desc = testing_module_->GetI32WasmCallDescriptor(this->zone(), desc); | 541 desc = testing_module_->GetI32WasmCallDescriptor(this->zone(), desc); |
540 } | 542 } |
541 CompilationInfo info(debug_name_, this->isolate(), this->zone(), | 543 CompilationInfo info(debug_name_, this->isolate(), this->zone(), |
542 Code::ComputeFlags(Code::WASM_FUNCTION)); | 544 Code::ComputeFlags(Code::WASM_FUNCTION)); |
543 v8::base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob( | 545 std::unique_ptr<CompilationJob> job(Pipeline::NewWasmCompilationJob( |
544 &info, graph(), desc, &source_position_table_)); | 546 &info, graph(), desc, &source_position_table_)); |
545 if (job->OptimizeGraph() != CompilationJob::SUCCEEDED || | 547 if (job->OptimizeGraph() != CompilationJob::SUCCEEDED || |
546 job->GenerateCode() != CompilationJob::SUCCEEDED) | 548 job->GenerateCode() != CompilationJob::SUCCEEDED) |
547 return Handle<Code>::null(); | 549 return Handle<Code>::null(); |
548 | 550 |
549 Handle<Code> code = info.code(); | 551 Handle<Code> code = info.code(); |
550 | 552 |
551 // Length is always 2, since usually <wasm_obj, func_index> is stored in | 553 // Length is always 2, since usually <wasm_obj, func_index> is stored in |
552 // the deopt data. Here, we only store the function index. | 554 // the deopt data. Here, we only store the function index. |
553 DCHECK(code->deoptimization_data() == nullptr || | 555 DCHECK(code->deoptimization_data() == nullptr || |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 // interpreter. | 769 // interpreter. |
768 #define WASM_EXEC_TEST(name) \ | 770 #define WASM_EXEC_TEST(name) \ |
769 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 771 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
770 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 772 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
771 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 773 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
772 void RunWasm_##name(WasmExecutionMode execution_mode) | 774 void RunWasm_##name(WasmExecutionMode execution_mode) |
773 | 775 |
774 } // namespace | 776 } // namespace |
775 | 777 |
776 #endif | 778 #endif |
OLD | NEW |