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

Side by Side Diff: src/wasm/wasm-objects.cc

Issue 2587143002: [wasm] Add iterators for opcodes or offsets of one function (Closed)
Patch Set: Created 4 years 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/ast-decoder.h ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/utils.h" 6 #include "src/utils.h"
7 7
8 #include "src/debug/debug-interface.h" 8 #include "src/debug/debug-interface.h"
9 #include "src/wasm/module-decoder.h" 9 #include "src/wasm/module-decoder.h"
10 #include "src/wasm/wasm-module.h" 10 #include "src/wasm/wasm-module.h"
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 704
705 for (uint32_t func_idx = start_func_index; func_idx <= end_func_index; 705 for (uint32_t func_idx = start_func_index; func_idx <= end_func_index;
706 ++func_idx) { 706 ++func_idx) {
707 WasmFunction& func = functions[func_idx]; 707 WasmFunction& func = functions[func_idx];
708 if (func.code_start_offset == func.code_end_offset) continue; 708 if (func.code_start_offset == func.code_end_offset) continue;
709 709
710 AstLocalDecls locals(&tmp); 710 AstLocalDecls locals(&tmp);
711 BytecodeIterator iterator(module_start + func.code_start_offset, 711 BytecodeIterator iterator(module_start + func.code_start_offset,
712 module_start + func.code_end_offset, &locals); 712 module_start + func.code_end_offset, &locals);
713 DCHECK_LT(0u, locals.decls_encoded_size); 713 DCHECK_LT(0u, locals.decls_encoded_size);
714 for (; iterator.has_next(); iterator.next()) { 714 for (uint32_t offset : iterator.offsets()) {
715 uint32_t offset = func.code_start_offset + iterator.pc_offset(); 715 uint32_t total_offset = func.code_start_offset + offset;
716 if (offset >= end_offset) { 716 if (total_offset >= end_offset) {
717 DCHECK_EQ(end_func_index, func_idx); 717 DCHECK_EQ(end_func_index, func_idx);
718 break; 718 break;
719 } 719 }
720 if (offset < start_offset) continue; 720 if (total_offset < start_offset) continue;
721 locations->push_back(v8::debug::Location(func_idx, iterator.pc_offset())); 721 locations->push_back(v8::debug::Location(func_idx, offset));
722 } 722 }
723 } 723 }
724 return true; 724 return true;
725 } 725 }
726 726
727 Handle<WasmInstanceWrapper> WasmInstanceWrapper::New( 727 Handle<WasmInstanceWrapper> WasmInstanceWrapper::New(
728 Isolate* isolate, Handle<WasmInstanceObject> instance) { 728 Isolate* isolate, Handle<WasmInstanceObject> instance) {
729 Handle<FixedArray> array = 729 Handle<FixedArray> array =
730 isolate->factory()->NewFixedArray(kWrapperPropertyCount, TENURED); 730 isolate->factory()->NewFixedArray(kWrapperPropertyCount, TENURED);
731 Handle<WasmInstanceWrapper> instance_wrapper( 731 Handle<WasmInstanceWrapper> instance_wrapper(
(...skipping 15 matching lines...) Expand all
747 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) 747 !array->get(kPreviousInstanceWrapper)->IsFixedArray())
748 return false; 748 return false;
749 return true; 749 return true;
750 } 750 }
751 751
752 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, 752 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance,
753 Isolate* isolate) { 753 Isolate* isolate) {
754 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); 754 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance);
755 set(kWrapperInstanceObject, *cell); 755 set(kWrapperInstanceObject, *cell);
756 } 756 }
OLDNEW
« no previous file with comments | « src/wasm/ast-decoder.h ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698