Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: test/cctest/wasm/wasm-run-utils.h

Issue 1912103002: [wasm] Store function names in the wasm object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-offset-table-2
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 Handle<Code> Compile() { 480 Handle<Code> Compile() {
481 InitializeDescriptor(); 481 InitializeDescriptor();
482 CallDescriptor* desc = descriptor_; 482 CallDescriptor* desc = descriptor_;
483 if (kPointerSize == 4) { 483 if (kPointerSize == 4) {
484 desc = testing_module_->GetI32WasmCallDescriptor(this->zone(), desc); 484 desc = testing_module_->GetI32WasmCallDescriptor(this->zone(), desc);
485 } 485 }
486 CompilationInfo info(debug_name_, this->isolate(), this->zone(), 486 CompilationInfo info(debug_name_, this->isolate(), this->zone(),
487 Code::ComputeFlags(Code::WASM_FUNCTION)); 487 Code::ComputeFlags(Code::WASM_FUNCTION));
488 v8::base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob( 488 v8::base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob(
489 &info, graph(), desc, &source_position_table_)); 489 &info, graph(), desc, &source_position_table_));
490 Handle<Code> code = Handle<Code>::null(); 490 if (job->OptimizeGraph() != CompilationJob::SUCCEEDED ||
491 if (job->OptimizeGraph() == CompilationJob::SUCCEEDED && 491 job->GenerateCode() != CompilationJob::SUCCEEDED)
492 job->GenerateCode() == CompilationJob::SUCCEEDED) { 492 return Handle<Code>::null();
493 code = info.code(); 493
494 Handle<Code> code = info.code();
495
496 // Length is always 2, since usually <wasm_obj, func_index> is stored in the
497 // deopt data. Here, we store <func_name, undef> instead.
498 DCHECK(code->deoptimization_data() == nullptr ||
499 code->deoptimization_data()->length() == 0);
500 Handle<FixedArray> deopt_data =
501 isolate()->factory()->NewFixedArray(2, TENURED);
502 if (debug_name_.start() != nullptr) {
503 MaybeHandle<String> maybe_name =
504 isolate()->factory()->NewStringFromUtf8(debug_name_, TENURED);
505 if (!maybe_name.is_null())
506 deopt_data->set(0, *maybe_name.ToHandleChecked());
494 } 507 }
508 deopt_data->set_length(2);
509 code->set_deoptimization_data(*deopt_data);
510
495 #ifdef ENABLE_DISASSEMBLER 511 #ifdef ENABLE_DISASSEMBLER
496 if (!code.is_null() && FLAG_print_opt_code) { 512 if (FLAG_print_opt_code) {
497 OFStream os(stdout); 513 OFStream os(stdout);
498 code->Disassemble("wasm code", os); 514 code->Disassemble("wasm code", os);
499 } 515 }
500 #endif 516 #endif
501 517
502 return code; 518 return code;
503 } 519 }
504 520
505 uint32_t CompileAndAdd(uint16_t sig_index = 0) { 521 uint32_t CompileAndAdd(uint16_t sig_index = 0) {
506 CHECK(testing_module_); 522 CHECK(testing_module_);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 if (p1 == MachineType::None()) return 1; 658 if (p1 == MachineType::None()) return 1;
643 if (p2 == MachineType::None()) return 2; 659 if (p2 == MachineType::None()) return 2;
644 if (p3 == MachineType::None()) return 3; 660 if (p3 == MachineType::None()) return 3;
645 return 4; 661 return 4;
646 } 662 }
647 }; 663 };
648 664
649 } // namespace 665 } // namespace
650 666
651 #endif 667 #endif
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698