Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: src/wasm/wasm-module.h

Issue 2390113003: [wasm] Refactor import handling for 0xC. (Closed)
Patch Set: Add support for importing globals. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef V8_WASM_MODULE_H_ 5 #ifndef V8_WASM_MODULE_H_
6 #define V8_WASM_MODULE_H_ 6 #define V8_WASM_MODULE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/api.h" 10 #include "src/api.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 #define WCM_WEAK_LINK(TYPE, NAME) \ 378 #define WCM_WEAK_LINK(TYPE, NAME) \
379 WCM_OBJECT_OR_WEAK(WeakCell, weak_##NAME, kID_##NAME); \ 379 WCM_OBJECT_OR_WEAK(WeakCell, weak_##NAME, kID_##NAME); \
380 \ 380 \
381 Handle<TYPE> NAME() const { \ 381 Handle<TYPE> NAME() const { \
382 return handle(TYPE::cast(weak_##NAME()->value())); \ 382 return handle(TYPE::cast(weak_##NAME()->value())); \
383 } 383 }
384 384
385 #define WCM_PROPERTY_TABLE(MACRO) \ 385 #define WCM_PROPERTY_TABLE(MACRO) \
386 MACRO(OBJECT, FixedArray, code_table) \ 386 MACRO(OBJECT, FixedArray, code_table) \
387 MACRO(OBJECT, FixedArray, import_data) \ 387 MACRO(OBJECT, FixedArray, imports) \
388 MACRO(OBJECT, FixedArray, exports) \ 388 MACRO(OBJECT, FixedArray, exports) \
389 MACRO(OBJECT, FixedArray, inits) \
389 MACRO(OBJECT, FixedArray, startup_function) \ 390 MACRO(OBJECT, FixedArray, startup_function) \
390 MACRO(OBJECT, FixedArray, indirect_function_tables) \ 391 MACRO(OBJECT, FixedArray, indirect_function_tables) \
391 MACRO(OBJECT, String, module_bytes) \ 392 MACRO(OBJECT, String, module_bytes) \
392 MACRO(OBJECT, ByteArray, function_names) \ 393 MACRO(OBJECT, ByteArray, function_names) \
393 MACRO(SMALL_NUMBER, uint32_t, min_memory_pages) \ 394 MACRO(SMALL_NUMBER, uint32_t, min_memory_pages) \
394 MACRO(OBJECT, FixedArray, data_segments_info) \ 395 MACRO(OBJECT, FixedArray, data_segments_info) \
395 MACRO(OBJECT, ByteArray, data_segments) \ 396 MACRO(OBJECT, ByteArray, data_segments) \
396 MACRO(SMALL_NUMBER, uint32_t, globals_size) \ 397 MACRO(SMALL_NUMBER, uint32_t, globals_size) \
397 MACRO(OBJECT, JSArrayBuffer, heap) \ 398 MACRO(OBJECT, JSArrayBuffer, heap) \
398 MACRO(SMALL_NUMBER, bool, export_memory) \
399 MACRO(SMALL_NUMBER, ModuleOrigin, origin) \ 399 MACRO(SMALL_NUMBER, ModuleOrigin, origin) \
400 MACRO(WEAK_LINK, WasmCompiledModule, next_instance) \ 400 MACRO(WEAK_LINK, WasmCompiledModule, next_instance) \
401 MACRO(WEAK_LINK, WasmCompiledModule, prev_instance) \ 401 MACRO(WEAK_LINK, WasmCompiledModule, prev_instance) \
402 MACRO(WEAK_LINK, JSObject, owning_instance) \ 402 MACRO(WEAK_LINK, JSObject, owning_instance) \
403 MACRO(WEAK_LINK, JSObject, module_object) 403 MACRO(WEAK_LINK, JSObject, module_object)
404 404
405 private: 405 private:
406 enum PropertyIndices { 406 enum PropertyIndices {
407 #define INDICES(IGNORE1, IGNORE2, NAME) kID_##NAME, 407 #define INDICES(IGNORE1, IGNORE2, NAME) kID_##NAME,
408 WCM_PROPERTY_TABLE(INDICES) Count 408 WCM_PROPERTY_TABLE(INDICES) Count
409 #undef INDICES 409 #undef INDICES
410 }; 410 };
411 411
412 public: 412 public:
413 static Handle<WasmCompiledModule> New(Isolate* isolate, 413 static Handle<WasmCompiledModule> New(Isolate* isolate,
414 uint32_t min_memory_pages, 414 uint32_t min_memory_pages,
415 uint32_t globals_size, 415 uint32_t globals_size,
416 bool export_memory,
417 ModuleOrigin origin); 416 ModuleOrigin origin);
418 417
419 static Handle<WasmCompiledModule> Clone(Isolate* isolate, 418 static Handle<WasmCompiledModule> Clone(Isolate* isolate,
420 Handle<WasmCompiledModule> module) { 419 Handle<WasmCompiledModule> module) {
421 Handle<WasmCompiledModule> ret = Handle<WasmCompiledModule>::cast( 420 Handle<WasmCompiledModule> ret = Handle<WasmCompiledModule>::cast(
422 isolate->factory()->CopyFixedArray(module)); 421 isolate->factory()->CopyFixedArray(module));
423 return ret; 422 return ret;
424 } 423 }
425 424
426 uint32_t mem_size() const { 425 uint32_t mem_size() const {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 int instance_count); 521 int instance_count);
523 void ValidateModuleState(Isolate* isolate, Handle<JSObject> module_obj); 522 void ValidateModuleState(Isolate* isolate, Handle<JSObject> module_obj);
524 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); 523 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance);
525 524
526 } // namespace testing 525 } // namespace testing
527 } // namespace wasm 526 } // namespace wasm
528 } // namespace internal 527 } // namespace internal
529 } // namespace v8 528 } // namespace v8
530 529
531 #endif // V8_WASM_MODULE_H_ 530 #endif // V8_WASM_MODULE_H_
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-module.cc » ('j') | src/wasm/wasm-module.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698