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

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

Issue 2610813009: [wasm] factor lower level utilties out of WasmFullDecoder (Closed)
Patch Set: harden decl decoding Created 3 years, 11 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-interpreter.cc ('k') | src/wasm/wasm-text.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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 const byte* module_start = module_bytes()->GetChars(); 791 const byte* module_start = module_bytes()->GetChars();
792 792
793 for (uint32_t func_idx = start_func_index; func_idx <= end_func_index; 793 for (uint32_t func_idx = start_func_index; func_idx <= end_func_index;
794 ++func_idx) { 794 ++func_idx) {
795 WasmFunction& func = functions[func_idx]; 795 WasmFunction& func = functions[func_idx];
796 if (func.code_start_offset == func.code_end_offset) continue; 796 if (func.code_start_offset == func.code_end_offset) continue;
797 797
798 BodyLocalDecls locals(&tmp); 798 BodyLocalDecls locals(&tmp);
799 BytecodeIterator iterator(module_start + func.code_start_offset, 799 BytecodeIterator iterator(module_start + func.code_start_offset,
800 module_start + func.code_end_offset, &locals); 800 module_start + func.code_end_offset, &locals);
801 DCHECK_LT(0u, locals.decls_encoded_size); 801 DCHECK_LT(0u, locals.encoded_size);
802 for (uint32_t offset : iterator.offsets()) { 802 for (uint32_t offset : iterator.offsets()) {
803 uint32_t total_offset = func.code_start_offset + offset; 803 uint32_t total_offset = func.code_start_offset + offset;
804 if (total_offset >= end_offset) { 804 if (total_offset >= end_offset) {
805 DCHECK_EQ(end_func_index, func_idx); 805 DCHECK_EQ(end_func_index, func_idx);
806 break; 806 break;
807 } 807 }
808 if (total_offset < start_offset) continue; 808 if (total_offset < start_offset) continue;
809 locations->push_back(v8::debug::Location(func_idx, offset)); 809 locations->push_back(v8::debug::Location(func_idx, offset));
810 } 810 }
811 } 811 }
(...skipping 23 matching lines...) Expand all
835 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) 835 !array->get(kPreviousInstanceWrapper)->IsFixedArray())
836 return false; 836 return false;
837 return true; 837 return true;
838 } 838 }
839 839
840 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, 840 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance,
841 Isolate* isolate) { 841 Isolate* isolate) {
842 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); 842 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance);
843 set(kWrapperInstanceObject, *cell); 843 set(kWrapperInstanceObject, *cell);
844 } 844 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | src/wasm/wasm-text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698