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 #ifndef V8_WASM_OBJECTS_H_ | 5 #ifndef V8_WASM_OBJECTS_H_ |
6 #define V8_WASM_OBJECTS_H_ | 6 #define V8_WASM_OBJECTS_H_ |
7 | 7 |
8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
9 #include "src/wasm/managed.h" | 9 #include "src/wasm/managed.h" |
10 | 10 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 #define WCM_WEAK_LINK(TYPE, NAME) \ | 182 #define WCM_WEAK_LINK(TYPE, NAME) \ |
183 WCM_OBJECT_OR_WEAK(WeakCell, weak_##NAME, kID_##NAME); \ | 183 WCM_OBJECT_OR_WEAK(WeakCell, weak_##NAME, kID_##NAME); \ |
184 \ | 184 \ |
185 Handle<TYPE> NAME() const { \ | 185 Handle<TYPE> NAME() const { \ |
186 return handle(TYPE::cast(weak_##NAME()->value())); \ | 186 return handle(TYPE::cast(weak_##NAME()->value())); \ |
187 } | 187 } |
188 | 188 |
189 #define CORE_WCM_PROPERTY_TABLE(MACRO) \ | 189 #define CORE_WCM_PROPERTY_TABLE(MACRO) \ |
190 MACRO(OBJECT, FixedArray, code_table) \ | 190 MACRO(OBJECT, FixedArray, code_table) \ |
191 MACRO(OBJECT, Foreign, module_wrapper) \ | 191 MACRO(OBJECT, Foreign, module_wrapper) \ |
| 192 /* For debugging: */ \ |
192 MACRO(OBJECT, SeqOneByteString, module_bytes) \ | 193 MACRO(OBJECT, SeqOneByteString, module_bytes) \ |
193 MACRO(OBJECT, Script, asm_js_script) \ | 194 MACRO(OBJECT, Script, script) \ |
| 195 MACRO(OBJECT, ByteArray, asm_js_offset_tables) \ |
| 196 /* End of debugging stuff */ \ |
194 MACRO(OBJECT, FixedArray, function_tables) \ | 197 MACRO(OBJECT, FixedArray, function_tables) \ |
195 MACRO(OBJECT, FixedArray, empty_function_tables) \ | 198 MACRO(OBJECT, FixedArray, empty_function_tables) \ |
196 MACRO(OBJECT, ByteArray, asm_js_offset_tables) \ | |
197 MACRO(OBJECT, JSArrayBuffer, memory) \ | 199 MACRO(OBJECT, JSArrayBuffer, memory) \ |
198 MACRO(SMALL_NUMBER, uint32_t, min_mem_pages) \ | 200 MACRO(SMALL_NUMBER, uint32_t, min_mem_pages) \ |
199 MACRO(SMALL_NUMBER, uint32_t, max_mem_pages) \ | 201 MACRO(SMALL_NUMBER, uint32_t, max_mem_pages) \ |
200 MACRO(WEAK_LINK, WasmCompiledModule, next_instance) \ | 202 MACRO(WEAK_LINK, WasmCompiledModule, next_instance) \ |
201 MACRO(WEAK_LINK, WasmCompiledModule, prev_instance) \ | 203 MACRO(WEAK_LINK, WasmCompiledModule, prev_instance) \ |
202 MACRO(WEAK_LINK, JSObject, owning_instance) \ | 204 MACRO(WEAK_LINK, JSObject, owning_instance) \ |
203 MACRO(WEAK_LINK, JSObject, wasm_module) | 205 MACRO(WEAK_LINK, JSObject, wasm_module) |
204 | 206 |
205 #if DEBUG | 207 #if DEBUG |
206 #define DEBUG_ONLY_TABLE(MACRO) MACRO(SMALL_NUMBER, uint32_t, instance_id) | 208 #define DEBUG_ONLY_TABLE(MACRO) MACRO(SMALL_NUMBER, uint32_t, instance_id) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 WCM_PROPERTY_TABLE(DECLARATION) | 246 WCM_PROPERTY_TABLE(DECLARATION) |
245 #undef DECLARATION | 247 #undef DECLARATION |
246 | 248 |
247 static bool IsWasmCompiledModule(Object* obj); | 249 static bool IsWasmCompiledModule(Object* obj); |
248 | 250 |
249 void PrintInstancesChain(); | 251 void PrintInstancesChain(); |
250 | 252 |
251 static void RecreateModuleWrapper(Isolate* isolate, | 253 static void RecreateModuleWrapper(Isolate* isolate, |
252 Handle<FixedArray> compiled_module); | 254 Handle<FixedArray> compiled_module); |
253 | 255 |
| 256 // Extract a function name from the given wasm instance. |
| 257 // Returns a null handle if the function is unnamed or the name is not a valid |
| 258 // UTF-8 string. |
| 259 static MaybeHandle<String> GetFunctionName( |
| 260 Handle<WasmCompiledModule> compiled_module, uint32_t func_index); |
| 261 |
254 private: | 262 private: |
255 void InitId(); | 263 void InitId(); |
256 | 264 |
257 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); | 265 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); |
258 }; | 266 }; |
259 | 267 |
260 class WasmDebugInfo : public FixedArray { | 268 class WasmDebugInfo : public FixedArray { |
261 public: | 269 public: |
262 enum class Fields { kFieldCount }; | 270 enum class Fields { kFieldCount }; |
263 | 271 |
(...skipping 27 matching lines...) Expand all Loading... |
291 int func_index, int byte_offset); | 299 int func_index, int byte_offset); |
292 }; | 300 }; |
293 | 301 |
294 #undef DECLARE_ACCESSORS | 302 #undef DECLARE_ACCESSORS |
295 #undef DECLARE_OPTIONAL_ACCESSORS | 303 #undef DECLARE_OPTIONAL_ACCESSORS |
296 | 304 |
297 } // namespace internal | 305 } // namespace internal |
298 } // namespace v8 | 306 } // namespace v8 |
299 | 307 |
300 #endif // V8_WASM_OBJECTS_H_ | 308 #endif // V8_WASM_OBJECTS_H_ |
OLD | NEW |