OLD | NEW |
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/base/iterator.h" | 8 #include "src/base/iterator.h" |
9 #include "src/debug/debug-interface.h" | 9 #include "src/debug/debug-interface.h" |
10 #include "src/wasm/module-decoder.h" | 10 #include "src/wasm/module-decoder.h" |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 for (Handle<WasmInstanceObject> instance : | 1126 for (Handle<WasmInstanceObject> instance : |
1127 iterate_compiled_module_instance_chain(isolate, compiled_module)) { | 1127 iterate_compiled_module_instance_chain(isolate, compiled_module)) { |
1128 Handle<WasmDebugInfo> debug_info = | 1128 Handle<WasmDebugInfo> debug_info = |
1129 WasmInstanceObject::GetOrCreateDebugInfo(instance); | 1129 WasmInstanceObject::GetOrCreateDebugInfo(instance); |
1130 WasmDebugInfo::SetBreakpoint(debug_info, func_index, offset_in_func); | 1130 WasmDebugInfo::SetBreakpoint(debug_info, func_index, offset_in_func); |
1131 } | 1131 } |
1132 | 1132 |
1133 return true; | 1133 return true; |
1134 } | 1134 } |
1135 | 1135 |
| 1136 MaybeHandle<FixedArray> WasmCompiledModule::CheckBreakPoints(int position) { |
| 1137 Isolate* isolate = GetIsolate(); |
| 1138 if (!shared()->has_breakpoint_infos()) return {}; |
| 1139 |
| 1140 Handle<FixedArray> breakpoint_infos(shared()->breakpoint_infos(), isolate); |
| 1141 int insert_pos = |
| 1142 FindBreakpointInfoInsertPos(isolate, breakpoint_infos, position); |
| 1143 if (insert_pos >= breakpoint_infos->length()) return {}; |
| 1144 |
| 1145 Handle<Object> maybe_breakpoint_info(breakpoint_infos->get(insert_pos), |
| 1146 isolate); |
| 1147 if (maybe_breakpoint_info->IsUndefined(isolate)) return {}; |
| 1148 Handle<BreakPointInfo> breakpoint_info = |
| 1149 Handle<BreakPointInfo>::cast(maybe_breakpoint_info); |
| 1150 if (breakpoint_info->source_position() != position) return {}; |
| 1151 |
| 1152 Handle<Object> breakpoint_objects(breakpoint_info->break_point_objects(), |
| 1153 isolate); |
| 1154 return isolate->debug()->GetHitBreakPointObjects(breakpoint_objects); |
| 1155 } |
| 1156 |
1136 Handle<WasmInstanceWrapper> WasmInstanceWrapper::New( | 1157 Handle<WasmInstanceWrapper> WasmInstanceWrapper::New( |
1137 Isolate* isolate, Handle<WasmInstanceObject> instance) { | 1158 Isolate* isolate, Handle<WasmInstanceObject> instance) { |
1138 Handle<FixedArray> array = | 1159 Handle<FixedArray> array = |
1139 isolate->factory()->NewFixedArray(kWrapperPropertyCount, TENURED); | 1160 isolate->factory()->NewFixedArray(kWrapperPropertyCount, TENURED); |
1140 Handle<WasmInstanceWrapper> instance_wrapper( | 1161 Handle<WasmInstanceWrapper> instance_wrapper( |
1141 reinterpret_cast<WasmInstanceWrapper*>(*array), isolate); | 1162 reinterpret_cast<WasmInstanceWrapper*>(*array), isolate); |
1142 instance_wrapper->set_instance_object(instance, isolate); | 1163 instance_wrapper->set_instance_object(instance, isolate); |
1143 return instance_wrapper; | 1164 return instance_wrapper; |
1144 } | 1165 } |
1145 | 1166 |
(...skipping 10 matching lines...) Expand all Loading... |
1156 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) | 1177 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) |
1157 return false; | 1178 return false; |
1158 return true; | 1179 return true; |
1159 } | 1180 } |
1160 | 1181 |
1161 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, | 1182 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, |
1162 Isolate* isolate) { | 1183 Isolate* isolate) { |
1163 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); | 1184 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); |
1164 set(kWrapperInstanceObject, *cell); | 1185 set(kWrapperInstanceObject, *cell); |
1165 } | 1186 } |
OLD | NEW |