| 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 <setjmp.h> | 8 #include <setjmp.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // Build the TurboFan graph. | 557 // Build the TurboFan graph. |
| 558 TestBuildingGraph(zone(), &jsgraph, testing_module_, sig, | 558 TestBuildingGraph(zone(), &jsgraph, testing_module_, sig, |
| 559 &source_position_table_, start, end); | 559 &source_position_table_, start, end); |
| 560 Handle<Code> code = Compile(); | 560 Handle<Code> code = Compile(); |
| 561 testing_module_->SetFunctionCode(function_index(), code); | 561 testing_module_->SetFunctionCode(function_index(), code); |
| 562 | 562 |
| 563 // Add to code table. | 563 // Add to code table. |
| 564 Handle<WasmCompiledModule> compiled_module( | 564 Handle<WasmCompiledModule> compiled_module( |
| 565 testing_module_->instance_object()->compiled_module(), isolate()); | 565 testing_module_->instance_object()->compiled_module(), isolate()); |
| 566 Handle<FixedArray> code_table = compiled_module->code_table(); | 566 Handle<FixedArray> code_table = compiled_module->code_table(); |
| 567 code_table = FixedArray::SetAndGrow(code_table, function_index(), code); | 567 if (static_cast<int>(function_index()) >= code_table->length()) { |
| 568 compiled_module->set_code_table(code_table); | 568 Handle<FixedArray> new_arr = isolate()->factory()->NewFixedArray( |
| 569 static_cast<int>(function_index()) + 1); |
| 570 code_table->CopyTo(0, *new_arr, 0, code_table->length()); |
| 571 code_table = new_arr; |
| 572 compiled_module->set_code_table(code_table); |
| 573 } |
| 574 DCHECK(code_table->get(static_cast<int>(function_index())) |
| 575 ->IsUndefined(isolate())); |
| 576 code_table->set(static_cast<int>(function_index()), *code); |
| 569 } | 577 } |
| 570 | 578 |
| 571 byte AllocateLocal(ValueType type) { | 579 byte AllocateLocal(ValueType type) { |
| 572 uint32_t index = local_decls.AddLocals(1, type); | 580 uint32_t index = local_decls.AddLocals(1, type); |
| 573 byte result = static_cast<byte>(index); | 581 byte result = static_cast<byte>(index); |
| 574 DCHECK_EQ(index, result); | 582 DCHECK_EQ(index, result); |
| 575 return result; | 583 return result; |
| 576 } | 584 } |
| 577 | 585 |
| 578 void SetSigIndex(int sig_index) { function_->sig_index = sig_index; } | 586 void SetSigIndex(int sig_index) { function_->sig_index = sig_index; } |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 void RunWasm_##name(WasmExecutionMode execution_mode) | 836 void RunWasm_##name(WasmExecutionMode execution_mode) |
| 829 | 837 |
| 830 #define WASM_EXEC_COMPILED_TEST(name) \ | 838 #define WASM_EXEC_COMPILED_TEST(name) \ |
| 831 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 839 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
| 832 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 840 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
| 833 void RunWasm_##name(WasmExecutionMode execution_mode) | 841 void RunWasm_##name(WasmExecutionMode execution_mode) |
| 834 | 842 |
| 835 } // namespace | 843 } // namespace |
| 836 | 844 |
| 837 #endif | 845 #endif |
| OLD | NEW |