| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/wasm/wasm-objects.h" | 5 #include "src/wasm/wasm-objects.h" |
| 6 | 6 |
| 7 #include "src/wasm/module-decoder.h" | 7 #include "src/wasm/module-decoder.h" |
| 8 #include "src/wasm/wasm-module.h" | 8 #include "src/wasm/wasm-module.h" |
| 9 #include "src/wasm/wasm-text.h" | 9 #include "src/wasm/wasm-text.h" |
| 10 | 10 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 right = mid; | 533 right = mid; |
| 534 } | 534 } |
| 535 } | 535 } |
| 536 // There should be an entry for each position that could show up on the stack | 536 // There should be an entry for each position that could show up on the stack |
| 537 // trace: | 537 // trace: |
| 538 DCHECK_EQ(total_offset, | 538 DCHECK_EQ(total_offset, |
| 539 static_cast<uint32_t>(offset_table->get_int(2 * left))); | 539 static_cast<uint32_t>(offset_table->get_int(2 * left))); |
| 540 return offset_table->get_int(2 * left + 1); | 540 return offset_table->get_int(2 * left + 1); |
| 541 } | 541 } |
| 542 | 542 |
| 543 std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>> | 543 v8::debug::WasmDisassembly WasmCompiledModule::DisassembleFunction( |
| 544 WasmCompiledModule::DisassembleFunction(int func_index) { | 544 int func_index) { |
| 545 DisallowHeapAllocation no_gc; | 545 DisallowHeapAllocation no_gc; |
| 546 | 546 |
| 547 if (func_index < 0 || | 547 if (func_index < 0 || |
| 548 static_cast<uint32_t>(func_index) >= module()->functions.size()) | 548 static_cast<uint32_t>(func_index) >= module()->functions.size()) |
| 549 return {}; | 549 return {}; |
| 550 | 550 |
| 551 SeqOneByteString* module_bytes_str = ptr_to_module_bytes(); | 551 SeqOneByteString* module_bytes_str = ptr_to_module_bytes(); |
| 552 Vector<const byte> module_bytes(module_bytes_str->GetChars(), | 552 Vector<const byte> module_bytes(module_bytes_str->GetChars(), |
| 553 module_bytes_str->length()); | 553 module_bytes_str->length()); |
| 554 | 554 |
| 555 std::ostringstream disassembly_os; | 555 std::ostringstream disassembly_os; |
| 556 std::vector<std::tuple<uint32_t, int, int>> offset_table; | 556 v8::debug::WasmDisassembly::OffsetTable offset_table; |
| 557 | 557 |
| 558 PrintWasmText(module(), module_bytes, static_cast<uint32_t>(func_index), | 558 PrintWasmText(module(), module_bytes, static_cast<uint32_t>(func_index), |
| 559 disassembly_os, &offset_table); | 559 disassembly_os, &offset_table); |
| 560 | 560 |
| 561 return {disassembly_os.str(), std::move(offset_table)}; | 561 return {disassembly_os.str(), std::move(offset_table)}; |
| 562 } | 562 } |
| 563 | 563 |
| 564 Handle<WasmInstanceWrapper> WasmInstanceWrapper::New( | 564 Handle<WasmInstanceWrapper> WasmInstanceWrapper::New( |
| 565 Isolate* isolate, Handle<WasmInstanceObject> instance) { | 565 Isolate* isolate, Handle<WasmInstanceObject> instance) { |
| 566 Handle<FixedArray> array = | 566 Handle<FixedArray> array = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 584 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) | 584 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) |
| 585 return false; | 585 return false; |
| 586 return true; | 586 return true; |
| 587 } | 587 } |
| 588 | 588 |
| 589 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, | 589 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, |
| 590 Isolate* isolate) { | 590 Isolate* isolate) { |
| 591 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); | 591 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); |
| 592 set(kWrapperInstanceObject, *cell); | 592 set(kWrapperInstanceObject, *cell); |
| 593 } | 593 } |
| OLD | NEW |