| 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/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/debug/interface-types.h" | 9 #include "src/debug/interface-types.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 // Information shared by all WasmCompiledModule objects for the same module. | 159 // Information shared by all WasmCompiledModule objects for the same module. |
| 160 class WasmSharedModuleData : public FixedArray { | 160 class WasmSharedModuleData : public FixedArray { |
| 161 enum Fields { | 161 enum Fields { |
| 162 kModuleWrapper, | 162 kModuleWrapper, |
| 163 kModuleBytes, | 163 kModuleBytes, |
| 164 kScript, | 164 kScript, |
| 165 kAsmJsOffsetTable, | 165 kAsmJsOffsetTable, |
| 166 kBreakPointInfos, | 166 kBreakPointInfos, |
| 167 kLazyCompilationOrchestrator, |
| 167 kFieldCount | 168 kFieldCount |
| 168 }; | 169 }; |
| 169 | 170 |
| 170 public: | 171 public: |
| 171 DECLARE_CASTS(WasmSharedModuleData); | 172 DECLARE_CASTS(WasmSharedModuleData); |
| 172 | 173 |
| 173 DECLARE_GETTER(module, wasm::WasmModule); | 174 DECLARE_GETTER(module, wasm::WasmModule); |
| 174 DECLARE_OPTIONAL_ACCESSORS(module_bytes, SeqOneByteString); | 175 DECLARE_OPTIONAL_ACCESSORS(module_bytes, SeqOneByteString); |
| 175 DECLARE_GETTER(script, Script); | 176 DECLARE_GETTER(script, Script); |
| 176 DECLARE_OPTIONAL_ACCESSORS(asm_js_offset_table, ByteArray); | 177 DECLARE_OPTIONAL_ACCESSORS(asm_js_offset_table, ByteArray); |
| 177 DECLARE_OPTIONAL_GETTER(breakpoint_infos, FixedArray); | 178 DECLARE_OPTIONAL_GETTER(breakpoint_infos, FixedArray); |
| 178 | 179 |
| 179 static Handle<WasmSharedModuleData> New( | 180 static Handle<WasmSharedModuleData> New( |
| 180 Isolate* isolate, Handle<Foreign> module_wrapper, | 181 Isolate* isolate, Handle<Foreign> module_wrapper, |
| 181 Handle<SeqOneByteString> module_bytes, Handle<Script> script, | 182 Handle<SeqOneByteString> module_bytes, Handle<Script> script, |
| 182 Handle<ByteArray> asm_js_offset_table); | 183 Handle<ByteArray> asm_js_offset_table); |
| 183 | 184 |
| 184 // Check whether this module was generated from asm.js source. | 185 // Check whether this module was generated from asm.js source. |
| 185 bool is_asm_js(); | 186 bool is_asm_js(); |
| 186 | 187 |
| 187 static void ReinitializeAfterDeserialization(Isolate*, | 188 static void ReinitializeAfterDeserialization(Isolate*, |
| 188 Handle<WasmSharedModuleData>); | 189 Handle<WasmSharedModuleData>); |
| 189 | 190 |
| 190 static void AddBreakpoint(Handle<WasmSharedModuleData>, int position, | 191 static void AddBreakpoint(Handle<WasmSharedModuleData>, int position, |
| 191 Handle<Object> break_point_object); | 192 Handle<Object> break_point_object); |
| 192 | 193 |
| 193 static void SetBreakpointsOnNewInstance(Handle<WasmSharedModuleData>, | 194 static void SetBreakpointsOnNewInstance(Handle<WasmSharedModuleData>, |
| 194 Handle<WasmInstanceObject>); | 195 Handle<WasmInstanceObject>); |
| 196 |
| 197 static void PrepareForLazyCompilation(Handle<WasmSharedModuleData>); |
| 198 |
| 199 private: |
| 200 DECLARE_OPTIONAL_GETTER(lazy_compilation_orchestrator, Foreign); |
| 201 friend class WasmCompiledModule; |
| 195 }; | 202 }; |
| 196 | 203 |
| 197 class WasmCompiledModule : public FixedArray { | 204 class WasmCompiledModule : public FixedArray { |
| 198 public: | 205 public: |
| 199 enum Fields { kFieldCount }; | 206 enum Fields { kFieldCount }; |
| 200 | 207 |
| 201 static WasmCompiledModule* cast(Object* fixed_array) { | 208 static WasmCompiledModule* cast(Object* fixed_array) { |
| 202 SLOW_DCHECK(IsWasmCompiledModule(fixed_array)); | 209 SLOW_DCHECK(IsWasmCompiledModule(fixed_array)); |
| 203 return reinterpret_cast<WasmCompiledModule*>(fixed_array); | 210 return reinterpret_cast<WasmCompiledModule*>(fixed_array); |
| 204 } | 211 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 // location inside the same function. | 400 // location inside the same function. |
| 394 // If it points outside a function, or behind the last breakable location, | 401 // If it points outside a function, or behind the last breakable location, |
| 395 // this function returns false and does not set any breakpoint. | 402 // this function returns false and does not set any breakpoint. |
| 396 static bool SetBreakPoint(Handle<WasmCompiledModule>, int* position, | 403 static bool SetBreakPoint(Handle<WasmCompiledModule>, int* position, |
| 397 Handle<Object> break_point_object); | 404 Handle<Object> break_point_object); |
| 398 | 405 |
| 399 // Return an empty handle if no breakpoint is hit at that location, or a | 406 // Return an empty handle if no breakpoint is hit at that location, or a |
| 400 // FixedArray with all hit breakpoint objects. | 407 // FixedArray with all hit breakpoint objects. |
| 401 MaybeHandle<FixedArray> CheckBreakPoints(int position); | 408 MaybeHandle<FixedArray> CheckBreakPoints(int position); |
| 402 | 409 |
| 410 // Compile lazily the function called in the given caller code object at the |
| 411 // given offset. |
| 412 // If the called function cannot be termined from the caller (indirect call / |
| 413 // exported function), func_index must be set. |
| 414 // If patch_caller is set, then at least the given all call site in the caller |
| 415 // will be patched, potentially more call sites are updated. |
| 416 // Returns the Code to be called at the given callsite, or an empty Handle if |
| 417 // an error occured during lazy compilation. In this case, an exception has |
| 418 // been set on the isolate. |
| 419 static MaybeHandle<Code> CompileLazy(Isolate*, Handle<WasmInstanceObject>, |
| 420 Handle<Code> caller, int offset, |
| 421 int func_index, bool patch_caller); |
| 422 |
| 403 private: | 423 private: |
| 404 void InitId(); | 424 void InitId(); |
| 405 | 425 |
| 406 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); | 426 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); |
| 407 }; | 427 }; |
| 408 | 428 |
| 409 class WasmDebugInfo : public FixedArray { | 429 class WasmDebugInfo : public FixedArray { |
| 410 public: | 430 public: |
| 411 enum Fields { | 431 enum Fields { |
| 412 kInstance, | 432 kInstance, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 }; | 521 }; |
| 502 }; | 522 }; |
| 503 | 523 |
| 504 #undef DECLARE_ACCESSORS | 524 #undef DECLARE_ACCESSORS |
| 505 #undef DECLARE_OPTIONAL_ACCESSORS | 525 #undef DECLARE_OPTIONAL_ACCESSORS |
| 506 | 526 |
| 507 } // namespace internal | 527 } // namespace internal |
| 508 } // namespace v8 | 528 } // namespace v8 |
| 509 | 529 |
| 510 #endif // V8_WASM_OBJECTS_H_ | 530 #endif // V8_WASM_OBJECTS_H_ |
| OLD | NEW |