| 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> |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 explicit WasmFunctionCompiler( | 415 explicit WasmFunctionCompiler( |
| 416 FunctionSig* sig, TestingModule* module, | 416 FunctionSig* sig, TestingModule* module, |
| 417 Vector<const char> debug_name = ArrayVector("<WASM UNNAMED>")) | 417 Vector<const char> debug_name = ArrayVector("<WASM UNNAMED>")) |
| 418 : GraphAndBuilders(main_zone()), | 418 : GraphAndBuilders(main_zone()), |
| 419 jsgraph(this->isolate(), this->graph(), this->common(), nullptr, | 419 jsgraph(this->isolate(), this->graph(), this->common(), nullptr, |
| 420 nullptr, this->machine()), | 420 nullptr, this->machine()), |
| 421 sig(sig), | 421 sig(sig), |
| 422 descriptor_(nullptr), | 422 descriptor_(nullptr), |
| 423 testing_module_(module), | 423 testing_module_(module), |
| 424 debug_name_(debug_name), | 424 debug_name_(debug_name), |
| 425 local_decls(main_zone(), sig), |
| 425 source_position_table_(this->graph()) { | 426 source_position_table_(this->graph()) { |
| 426 if (module) { | 427 if (module) { |
| 427 // Get a new function from the testing module. | 428 // Get a new function from the testing module. |
| 428 function_ = nullptr; | 429 function_ = nullptr; |
| 429 function_index_ = module->AddFunction(sig, Handle<Code>::null()); | 430 function_index_ = module->AddFunction(sig, Handle<Code>::null()); |
| 430 } else { | 431 } else { |
| 431 // Create our own function. | 432 // Create our own function. |
| 432 function_ = new WasmFunction(); | 433 function_ = new WasmFunction(); |
| 433 function_->sig = sig; | 434 function_->sig = sig; |
| 434 function_index_ = 0; | 435 function_index_ = 0; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 464 | 465 |
| 465 void Build(const byte* start, const byte* end) { | 466 void Build(const byte* start, const byte* end) { |
| 466 // Build the TurboFan graph. | 467 // Build the TurboFan graph. |
| 467 local_decls.Prepend(&start, &end); | 468 local_decls.Prepend(&start, &end); |
| 468 TestBuildingGraph(main_zone(), &jsgraph, testing_module_, sig, | 469 TestBuildingGraph(main_zone(), &jsgraph, testing_module_, sig, |
| 469 &source_position_table_, start, end); | 470 &source_position_table_, start, end); |
| 470 delete[] start; | 471 delete[] start; |
| 471 } | 472 } |
| 472 | 473 |
| 473 byte AllocateLocal(LocalType type) { | 474 byte AllocateLocal(LocalType type) { |
| 474 uint32_t index = local_decls.AddLocals(1, type, sig); | 475 uint32_t index = local_decls.AddLocals(1, type); |
| 475 byte result = static_cast<byte>(index); | 476 byte result = static_cast<byte>(index); |
| 476 DCHECK_EQ(index, result); | 477 DCHECK_EQ(index, result); |
| 477 return result; | 478 return result; |
| 478 } | 479 } |
| 479 | 480 |
| 480 Handle<Code> Compile() { | 481 Handle<Code> Compile() { |
| 481 InitializeDescriptor(); | 482 InitializeDescriptor(); |
| 482 CallDescriptor* desc = descriptor_; | 483 CallDescriptor* desc = descriptor_; |
| 483 if (kPointerSize == 4) { | 484 if (kPointerSize == 4) { |
| 484 desc = testing_module_->GetI32WasmCallDescriptor(this->zone(), desc); | 485 desc = testing_module_->GetI32WasmCallDescriptor(this->zone(), desc); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 if (p1 == MachineType::None()) return 1; | 654 if (p1 == MachineType::None()) return 1; |
| 654 if (p2 == MachineType::None()) return 2; | 655 if (p2 == MachineType::None()) return 2; |
| 655 if (p3 == MachineType::None()) return 3; | 656 if (p3 == MachineType::None()) return 3; |
| 656 return 4; | 657 return 4; |
| 657 } | 658 } |
| 658 }; | 659 }; |
| 659 | 660 |
| 660 } // namespace | 661 } // namespace |
| 661 | 662 |
| 662 #endif | 663 #endif |
| OLD | NEW |