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

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

Issue 2424623002: [wasm] Use a Managed<WasmModule> to hold metadata about modules. (Closed)
Patch Set: 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
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 arr->set(kWasmDebugInfoWasmBytesHash, *hash_obj); 151 arr->set(kWasmDebugInfoWasmBytesHash, *hash_obj);
152 152
153 return Handle<WasmDebugInfo>::cast(arr); 153 return Handle<WasmDebugInfo>::cast(arr);
154 } 154 }
155 155
156 bool WasmDebugInfo::IsDebugInfo(Object *object) { 156 bool WasmDebugInfo::IsDebugInfo(Object *object) {
157 if (!object->IsFixedArray()) return false; 157 if (!object->IsFixedArray()) return false;
158 FixedArray *arr = FixedArray::cast(object); 158 FixedArray *arr = FixedArray::cast(object);
159 Isolate *isolate = arr->GetIsolate(); 159 Isolate *isolate = arr->GetIsolate();
160 return arr->length() == kWasmDebugInfoNumEntries && 160 return arr->length() == kWasmDebugInfoNumEntries &&
161 IsWasmObject(arr->get(kWasmDebugInfoWasmObj)) && 161 IsWasmModule(arr->get(kWasmDebugInfoWasmObj)) &&
162 arr->get(kWasmDebugInfoWasmBytesHash)->IsNumber() && 162 arr->get(kWasmDebugInfoWasmBytesHash)->IsNumber() &&
163 (arr->get(kWasmDebugInfoFunctionByteOffsets)->IsUndefined(isolate) || 163 (arr->get(kWasmDebugInfoFunctionByteOffsets)->IsUndefined(isolate) ||
164 arr->get(kWasmDebugInfoFunctionByteOffsets)->IsByteArray()) && 164 arr->get(kWasmDebugInfoFunctionByteOffsets)->IsByteArray()) &&
165 (arr->get(kWasmDebugInfoFunctionScripts)->IsUndefined(isolate) || 165 (arr->get(kWasmDebugInfoFunctionScripts)->IsUndefined(isolate) ||
166 arr->get(kWasmDebugInfoFunctionScripts)->IsFixedArray()); 166 arr->get(kWasmDebugInfoFunctionScripts)->IsFixedArray());
167 } 167 }
168 168
169 WasmDebugInfo *WasmDebugInfo::cast(Object *object) { 169 WasmDebugInfo *WasmDebugInfo::cast(Object *object) {
170 DCHECK(IsDebugInfo(object)); 170 DCHECK(IsDebugInfo(object));
171 return reinterpret_cast<WasmDebugInfo *>(object); 171 return reinterpret_cast<WasmDebugInfo *>(object);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 left = mid; 307 left = mid;
308 } else { 308 } else {
309 right = mid; 309 right = mid;
310 } 310 }
311 } 311 }
312 // There should be an entry for each position that could show up on the stack 312 // There should be an entry for each position that could show up on the stack
313 // trace: 313 // trace:
314 DCHECK_EQ(byte_offset, offset_table->get_int(2 * left)); 314 DCHECK_EQ(byte_offset, offset_table->get_int(2 * left));
315 return offset_table->get_int(2 * left + 1); 315 return offset_table->get_int(2 * left + 1);
316 } 316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698