OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |