| 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/debug/interface-types.h" | 8 #include "src/debug/interface-types.h" |
| 9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
| 10 #include "src/trap-handler/trap-handler.h" | 10 #include "src/trap-handler/trap-handler.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 WCM_OBJECT_OR_WEAK(WeakCell, weak_##NAME, kID_##NAME, obj->IsWeakCell()); \ | 232 WCM_OBJECT_OR_WEAK(WeakCell, weak_##NAME, kID_##NAME, obj->IsWeakCell()); \ |
| 233 \ | 233 \ |
| 234 Handle<TYPE> NAME() const { \ | 234 Handle<TYPE> NAME() const { \ |
| 235 return handle(TYPE::cast(weak_##NAME()->value())); \ | 235 return handle(TYPE::cast(weak_##NAME()->value())); \ |
| 236 } | 236 } |
| 237 | 237 |
| 238 #define CORE_WCM_PROPERTY_TABLE(MACRO) \ | 238 #define CORE_WCM_PROPERTY_TABLE(MACRO) \ |
| 239 MACRO(WASM_OBJECT, WasmSharedModuleData, shared) \ | 239 MACRO(WASM_OBJECT, WasmSharedModuleData, shared) \ |
| 240 MACRO(OBJECT, Context, native_context) \ | 240 MACRO(OBJECT, Context, native_context) \ |
| 241 MACRO(OBJECT, FixedArray, code_table) \ | 241 MACRO(OBJECT, FixedArray, code_table) \ |
| 242 MACRO(OBJECT, FixedArray, weak_exported_functions) \ |
| 242 MACRO(OBJECT, FixedArray, function_tables) \ | 243 MACRO(OBJECT, FixedArray, function_tables) \ |
| 243 MACRO(OBJECT, FixedArray, signature_tables) \ | 244 MACRO(OBJECT, FixedArray, signature_tables) \ |
| 244 MACRO(OBJECT, FixedArray, empty_function_tables) \ | 245 MACRO(OBJECT, FixedArray, empty_function_tables) \ |
| 245 MACRO(OBJECT, JSArrayBuffer, memory) \ | 246 MACRO(OBJECT, JSArrayBuffer, memory) \ |
| 246 MACRO(SMALL_NUMBER, uint32_t, min_mem_pages) \ | 247 MACRO(SMALL_NUMBER, uint32_t, min_mem_pages) \ |
| 247 MACRO(SMALL_NUMBER, uint32_t, max_mem_pages) \ | 248 MACRO(SMALL_NUMBER, uint32_t, max_mem_pages) \ |
| 248 MACRO(WEAK_LINK, WasmCompiledModule, next_instance) \ | 249 MACRO(WEAK_LINK, WasmCompiledModule, next_instance) \ |
| 249 MACRO(WEAK_LINK, WasmCompiledModule, prev_instance) \ | 250 MACRO(WEAK_LINK, WasmCompiledModule, prev_instance) \ |
| 250 MACRO(WEAK_LINK, JSObject, owning_instance) \ | 251 MACRO(WEAK_LINK, JSObject, owning_instance) \ |
| 251 MACRO(WEAK_LINK, WasmModuleObject, wasm_module) | 252 MACRO(WEAK_LINK, WasmModuleObject, wasm_module) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 273 Handle<WasmSharedModuleData> shared); | 274 Handle<WasmSharedModuleData> shared); |
| 274 | 275 |
| 275 static Handle<WasmCompiledModule> Clone(Isolate* isolate, | 276 static Handle<WasmCompiledModule> Clone(Isolate* isolate, |
| 276 Handle<WasmCompiledModule> module) { | 277 Handle<WasmCompiledModule> module) { |
| 277 Handle<WasmCompiledModule> ret = Handle<WasmCompiledModule>::cast( | 278 Handle<WasmCompiledModule> ret = Handle<WasmCompiledModule>::cast( |
| 278 isolate->factory()->CopyFixedArray(module)); | 279 isolate->factory()->CopyFixedArray(module)); |
| 279 ret->InitId(); | 280 ret->InitId(); |
| 280 ret->reset_weak_owning_instance(); | 281 ret->reset_weak_owning_instance(); |
| 281 ret->reset_weak_next_instance(); | 282 ret->reset_weak_next_instance(); |
| 282 ret->reset_weak_prev_instance(); | 283 ret->reset_weak_prev_instance(); |
| 284 ret->reset_weak_exported_functions(); |
| 283 return ret; | 285 return ret; |
| 284 } | 286 } |
| 285 | 287 |
| 286 uint32_t mem_size() const; | 288 uint32_t mem_size() const; |
| 287 uint32_t default_mem_size() const; | 289 uint32_t default_mem_size() const; |
| 288 | 290 |
| 289 #define DECLARATION(KIND, TYPE, NAME) WCM_##KIND(TYPE, NAME) | 291 #define DECLARATION(KIND, TYPE, NAME) WCM_##KIND(TYPE, NAME) |
| 290 WCM_PROPERTY_TABLE(DECLARATION) | 292 WCM_PROPERTY_TABLE(DECLARATION) |
| 291 #undef DECLARATION | 293 #undef DECLARATION |
| 292 | 294 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 bool GetPossibleBreakpoints(const debug::Location& start, | 368 bool GetPossibleBreakpoints(const debug::Location& start, |
| 367 const debug::Location& end, | 369 const debug::Location& end, |
| 368 std::vector<debug::Location>* locations); | 370 std::vector<debug::Location>* locations); |
| 369 | 371 |
| 370 private: | 372 private: |
| 371 void InitId(); | 373 void InitId(); |
| 372 | 374 |
| 373 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); | 375 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); |
| 374 }; | 376 }; |
| 375 | 377 |
| 376 // TODO(clemensh): Extend this object for breakpoint support, or remove it. | |
| 377 // TODO(clemensh): Exclude this object from serialization. | |
| 378 class WasmDebugInfo : public FixedArray { | 378 class WasmDebugInfo : public FixedArray { |
| 379 enum Fields { kInstance, kFieldCount }; | 379 public: |
| 380 enum Fields { |
| 381 kInstance, |
| 382 kInterpreterHandle, |
| 383 kInterpretedFunctions, |
| 384 kFieldCount |
| 385 }; |
| 380 | 386 |
| 381 public: | |
| 382 static Handle<WasmDebugInfo> New(Handle<WasmInstanceObject>); | 387 static Handle<WasmDebugInfo> New(Handle<WasmInstanceObject>); |
| 383 | 388 |
| 384 static bool IsDebugInfo(Object*); | 389 static bool IsDebugInfo(Object*); |
| 385 static WasmDebugInfo* cast(Object*); | 390 static WasmDebugInfo* cast(Object*); |
| 386 | 391 |
| 392 static void SetBreakpoint(Handle<WasmDebugInfo>, int func_index, int offset); |
| 393 |
| 387 static void RunInterpreter(Handle<WasmDebugInfo>, int func_index, | 394 static void RunInterpreter(Handle<WasmDebugInfo>, int func_index, |
| 388 uint8_t* arg_buffer); | 395 uint8_t* arg_buffer); |
| 389 | 396 |
| 390 DECLARE_GETTER(wasm_instance, WasmInstanceObject); | 397 DECLARE_GETTER(wasm_instance, WasmInstanceObject); |
| 391 }; | 398 }; |
| 392 | 399 |
| 393 class WasmInstanceWrapper : public FixedArray { | 400 class WasmInstanceWrapper : public FixedArray { |
| 394 public: | 401 public: |
| 395 static Handle<WasmInstanceWrapper> New(Isolate* isolate, | 402 static Handle<WasmInstanceWrapper> New(Isolate* isolate, |
| 396 Handle<WasmInstanceObject> instance); | 403 Handle<WasmInstanceObject> instance); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 }; | 452 }; |
| 446 }; | 453 }; |
| 447 | 454 |
| 448 #undef DECLARE_ACCESSORS | 455 #undef DECLARE_ACCESSORS |
| 449 #undef DECLARE_OPTIONAL_ACCESSORS | 456 #undef DECLARE_OPTIONAL_ACCESSORS |
| 450 | 457 |
| 451 } // namespace internal | 458 } // namespace internal |
| 452 } // namespace v8 | 459 } // namespace v8 |
| 453 | 460 |
| 454 #endif // V8_WASM_OBJECTS_H_ | 461 #endif // V8_WASM_OBJECTS_H_ |
| OLD | NEW |