| 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 Code::ComputeFlags(Code::WASM_FUNCTION)); | 488 Code::ComputeFlags(Code::WASM_FUNCTION)); |
| 489 v8::base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob( | 489 v8::base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob( |
| 490 &info, graph(), desc, &source_position_table_)); | 490 &info, graph(), desc, &source_position_table_)); |
| 491 if (job->OptimizeGraph() != CompilationJob::SUCCEEDED || | 491 if (job->OptimizeGraph() != CompilationJob::SUCCEEDED || |
| 492 job->GenerateCode() != CompilationJob::SUCCEEDED) | 492 job->GenerateCode() != CompilationJob::SUCCEEDED) |
| 493 return Handle<Code>::null(); | 493 return Handle<Code>::null(); |
| 494 | 494 |
| 495 Handle<Code> code = info.code(); | 495 Handle<Code> code = info.code(); |
| 496 | 496 |
| 497 // Length is always 2, since usually <wasm_obj, func_index> is stored in the | 497 // Length is always 2, since usually <wasm_obj, func_index> is stored in the |
| 498 // deopt data. Here, we store <func_name, undef> instead. | 498 // deopt data. Here, we only store the function index. |
| 499 DCHECK(code->deoptimization_data() == nullptr || | 499 DCHECK(code->deoptimization_data() == nullptr || |
| 500 code->deoptimization_data()->length() == 0); | 500 code->deoptimization_data()->length() == 0); |
| 501 Handle<FixedArray> deopt_data = | 501 Handle<FixedArray> deopt_data = |
| 502 isolate()->factory()->NewFixedArray(2, TENURED); | 502 isolate()->factory()->NewFixedArray(2, TENURED); |
| 503 if (debug_name_.start() != nullptr) { | 503 deopt_data->set(1, Smi::FromInt(function_index_)); |
| 504 MaybeHandle<String> maybe_name = | |
| 505 isolate()->factory()->NewStringFromUtf8(debug_name_, TENURED); | |
| 506 if (!maybe_name.is_null()) | |
| 507 deopt_data->set(0, *maybe_name.ToHandleChecked()); | |
| 508 } | |
| 509 deopt_data->set_length(2); | 504 deopt_data->set_length(2); |
| 510 code->set_deoptimization_data(*deopt_data); | 505 code->set_deoptimization_data(*deopt_data); |
| 511 | 506 |
| 512 #ifdef ENABLE_DISASSEMBLER | 507 #ifdef ENABLE_DISASSEMBLER |
| 513 if (FLAG_print_opt_code) { | 508 if (FLAG_print_opt_code) { |
| 514 OFStream os(stdout); | 509 OFStream os(stdout); |
| 515 code->Disassemble("wasm code", os); | 510 code->Disassemble("wasm code", os); |
| 516 } | 511 } |
| 517 #endif | 512 #endif |
| 518 | 513 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 if (p1 == MachineType::None()) return 1; | 654 if (p1 == MachineType::None()) return 1; |
| 660 if (p2 == MachineType::None()) return 2; | 655 if (p2 == MachineType::None()) return 2; |
| 661 if (p3 == MachineType::None()) return 3; | 656 if (p3 == MachineType::None()) return 3; |
| 662 return 4; | 657 return 4; |
| 663 } | 658 } |
| 664 }; | 659 }; |
| 665 | 660 |
| 666 } // namespace | 661 } // namespace |
| 667 | 662 |
| 668 #endif | 663 #endif |
| OLD | NEW |