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

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

Issue 2345593003: [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures and TSAN races. Created 4 years, 2 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/module-decoder.cc ('k') | src/wasm/wasm-interpreter.h » ('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 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 #include "src/wasm/wasm-debug.h" 5 #include "src/wasm/wasm-debug.h"
6 6
7 #include "src/assert-scope.h" 7 #include "src/assert-scope.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 14 matching lines...) Expand all
25 }; 25 };
26 26
27 ByteArray *GetOrCreateFunctionOffsetTable(Handle<WasmDebugInfo> debug_info) { 27 ByteArray *GetOrCreateFunctionOffsetTable(Handle<WasmDebugInfo> debug_info) {
28 Object *offset_table = debug_info->get(kWasmDebugInfoFunctionByteOffsets); 28 Object *offset_table = debug_info->get(kWasmDebugInfoFunctionByteOffsets);
29 Isolate *isolate = debug_info->GetIsolate(); 29 Isolate *isolate = debug_info->GetIsolate();
30 if (!offset_table->IsUndefined(isolate)) return ByteArray::cast(offset_table); 30 if (!offset_table->IsUndefined(isolate)) return ByteArray::cast(offset_table);
31 31
32 FunctionOffsetsResult function_offsets; 32 FunctionOffsetsResult function_offsets;
33 { 33 {
34 DisallowHeapAllocation no_gc; 34 DisallowHeapAllocation no_gc;
35 Handle<JSObject> wasm_object(debug_info->wasm_object(), isolate);
36 uint32_t num_imported_functions =
37 wasm::GetNumImportedFunctions(wasm_object);
35 SeqOneByteString *wasm_bytes = 38 SeqOneByteString *wasm_bytes =
36 wasm::GetWasmBytes(debug_info->wasm_object()); 39 wasm::GetWasmBytes(debug_info->wasm_object());
37 const byte *bytes_start = wasm_bytes->GetChars(); 40 const byte *bytes_start = wasm_bytes->GetChars();
38 const byte *bytes_end = bytes_start + wasm_bytes->length(); 41 const byte *bytes_end = bytes_start + wasm_bytes->length();
39 function_offsets = wasm::DecodeWasmFunctionOffsets(bytes_start, bytes_end); 42 function_offsets = wasm::DecodeWasmFunctionOffsets(bytes_start, bytes_end,
43 num_imported_functions);
40 } 44 }
41 DCHECK(function_offsets.ok()); 45 DCHECK(function_offsets.ok());
42 size_t array_size = 2 * kIntSize * function_offsets.val.size(); 46 size_t array_size = 2 * kIntSize * function_offsets.val.size();
43 CHECK_LE(array_size, static_cast<size_t>(kMaxInt)); 47 CHECK_LE(array_size, static_cast<size_t>(kMaxInt));
44 ByteArray *arr = 48 ByteArray *arr =
45 *isolate->factory()->NewByteArray(static_cast<int>(array_size)); 49 *isolate->factory()->NewByteArray(static_cast<int>(array_size));
46 int idx = 0; 50 int idx = 0;
47 for (std::pair<int, int> p : function_offsets.val) { 51 for (std::pair<int, int> p : function_offsets.val) {
48 arr->set_int(idx++, p.first); 52 arr->set_int(idx++, p.first);
49 arr->set_int(idx++, p.second); 53 arr->set_int(idx++, p.second);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 int idx = 0; 229 int idx = 0;
226 for (std::tuple<uint32_t, int, int> elem : offset_table_vec) { 230 for (std::tuple<uint32_t, int, int> elem : offset_table_vec) {
227 offset_table->set(idx++, Smi::FromInt(std::get<0>(elem))); 231 offset_table->set(idx++, Smi::FromInt(std::get<0>(elem)));
228 offset_table->set(idx++, Smi::FromInt(std::get<1>(elem))); 232 offset_table->set(idx++, Smi::FromInt(std::get<1>(elem)));
229 offset_table->set(idx++, Smi::FromInt(std::get<2>(elem))); 233 offset_table->set(idx++, Smi::FromInt(std::get<2>(elem)));
230 } 234 }
231 DCHECK_EQ(idx, offset_table->length()); 235 DCHECK_EQ(idx, offset_table->length());
232 236
233 return offset_table; 237 return offset_table;
234 } 238 }
OLDNEW
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | src/wasm/wasm-interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698