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

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

Issue 2531533003: Revert of [base] Define CHECK comparison for signed vs. unsigned (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.cc ('k') | src/wasm/wasm-interpreter.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 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/assert-scope.h" 5 #include "src/assert-scope.h"
6 #include "src/debug/debug.h" 6 #include "src/debug/debug.h"
7 #include "src/factory.h" 7 #include "src/factory.h"
8 #include "src/isolate.h" 8 #include "src/isolate.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 29 matching lines...) Expand all
40 { 40 {
41 Handle<ByteArray> asm_offset_tables = 41 Handle<ByteArray> asm_offset_tables =
42 compiled_module->asm_js_offset_tables(); 42 compiled_module->asm_js_offset_tables();
43 DisallowHeapAllocation no_gc; 43 DisallowHeapAllocation no_gc;
44 const byte *bytes_start = asm_offset_tables->GetDataStartAddress(); 44 const byte *bytes_start = asm_offset_tables->GetDataStartAddress();
45 const byte *bytes_end = bytes_start + asm_offset_tables->length(); 45 const byte *bytes_end = bytes_start + asm_offset_tables->length();
46 asm_offsets = wasm::DecodeAsmJsOffsets(bytes_start, bytes_end); 46 asm_offsets = wasm::DecodeAsmJsOffsets(bytes_start, bytes_end);
47 } 47 }
48 // Wasm bytes must be valid and must contain asm.js offset table. 48 // Wasm bytes must be valid and must contain asm.js offset table.
49 DCHECK(asm_offsets.ok()); 49 DCHECK(asm_offsets.ok());
50 DCHECK_GE(kMaxInt, asm_offsets.val.size()); 50 DCHECK_GE(static_cast<size_t>(kMaxInt), asm_offsets.val.size());
51 int num_functions = static_cast<int>(asm_offsets.val.size()); 51 int num_functions = static_cast<int>(asm_offsets.val.size());
52 DCHECK_EQ(wasm::GetNumberOfFunctions(handle(debug_info->wasm_instance())), 52 DCHECK_EQ(
53 num_functions + compiled_module->module()->num_imported_functions); 53 wasm::GetNumberOfFunctions(handle(debug_info->wasm_instance())),
54 static_cast<int>(num_functions +
55 compiled_module->module()->num_imported_functions));
54 Handle<FixedArray> all_tables = 56 Handle<FixedArray> all_tables =
55 isolate->factory()->NewFixedArray(num_functions); 57 isolate->factory()->NewFixedArray(num_functions);
56 debug_info->set(kWasmDebugInfoAsmJsOffsets, *all_tables); 58 debug_info->set(kWasmDebugInfoAsmJsOffsets, *all_tables);
57 for (int func = 0; func < num_functions; ++func) { 59 for (int func = 0; func < num_functions; ++func) {
58 std::vector<std::pair<int, int>> &func_asm_offsets = asm_offsets.val[func]; 60 std::vector<std::pair<int, int>> &func_asm_offsets = asm_offsets.val[func];
59 if (func_asm_offsets.empty()) continue; 61 if (func_asm_offsets.empty()) continue;
60 size_t array_size = 2 * kIntSize * func_asm_offsets.size(); 62 size_t array_size = 2 * kIntSize * func_asm_offsets.size();
61 CHECK_LE(array_size, kMaxInt); 63 CHECK_LE(array_size, static_cast<size_t>(kMaxInt));
62 ByteArray *arr = 64 ByteArray *arr =
63 *isolate->factory()->NewByteArray(static_cast<int>(array_size)); 65 *isolate->factory()->NewByteArray(static_cast<int>(array_size));
64 all_tables->set(func, arr); 66 all_tables->set(func, arr);
65 int idx = 0; 67 int idx = 0;
66 for (std::pair<int, int> p : func_asm_offsets) { 68 for (std::pair<int, int> p : func_asm_offsets) {
67 // Byte offsets must be strictly monotonously increasing: 69 // Byte offsets must be strictly monotonously increasing:
68 DCHECK(idx == 0 || p.first > arr->get_int(idx - 2)); 70 DCHECK(idx == 0 || p.first > arr->get_int(idx - 2));
69 arr->set_int(idx++, p.first); 71 arr->set_int(idx++, p.first);
70 arr->set_int(idx++, p.second); 72 arr->set_int(idx++, p.second);
71 } 73 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 left = mid; 138 left = mid;
137 } else { 139 } else {
138 right = mid; 140 right = mid;
139 } 141 }
140 } 142 }
141 // There should be an entry for each position that could show up on the stack 143 // There should be an entry for each position that could show up on the stack
142 // trace: 144 // trace:
143 DCHECK_EQ(byte_offset, offset_table->get_int(2 * left)); 145 DCHECK_EQ(byte_offset, offset_table->get_int(2 * left));
144 return offset_table->get_int(2 * left + 1); 146 return offset_table->get_int(2 * left + 1);
145 } 147 }
OLDNEW
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | src/wasm/wasm-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698