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

Unified Diff: src/wasm/wasm-objects.h

Issue 2529573002: Revert of [wasm] WebAssembly.Memory object can be referenced by multiple Instance objects. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | src/wasm/wasm-objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-objects.h
diff --git a/src/wasm/wasm-objects.h b/src/wasm/wasm-objects.h
index 8578dc8b4f8dd90cfb1ecddd667f5e1e487d82c7..0ba5a8dc3f516af9355cf8edf5e69a613b4baa30 100644
--- a/src/wasm/wasm-objects.h
+++ b/src/wasm/wasm-objects.h
@@ -17,7 +17,6 @@
class WasmCompiledModule;
class WasmDebugInfo;
class WasmInstanceObject;
-class WasmInstanceWrapper;
#define DECLARE_CASTS(name) \
static bool Is##name(Object* object); \
@@ -80,14 +79,12 @@
class WasmMemoryObject : public JSObject {
public:
// TODO(titzer): add the brand as an internal field instead of a property.
- enum Fields : uint8_t { kArrayBuffer, kMaximum, kInstancesLink, kFieldCount };
+ enum Fields : uint8_t { kArrayBuffer, kMaximum, kInstance, kFieldCount };
DECLARE_CASTS(WasmMemoryObject);
DECLARE_ACCESSORS(buffer, JSArrayBuffer);
- DECLARE_OPTIONAL_ACCESSORS(instances_link, WasmInstanceWrapper);
-
- void AddInstance(Isolate* isolate, Handle<WasmInstanceObject> object);
- void ResetInstancesLink(Isolate* isolate);
+
+ void AddInstance(WasmInstanceObject* object);
uint32_t current_pages();
int32_t maximum_pages(); // returns < 0 if there is no maximum
@@ -108,7 +105,6 @@
kMemoryArrayBuffer,
kGlobalsArrayBuffer,
kDebugInfo,
- kWasmMemInstanceWrapper,
kFieldCount
};
@@ -119,7 +115,6 @@
DECLARE_OPTIONAL_ACCESSORS(memory_buffer, JSArrayBuffer);
DECLARE_OPTIONAL_ACCESSORS(memory_object, WasmMemoryObject);
DECLARE_OPTIONAL_ACCESSORS(debug_info, WasmDebugInfo);
- DECLARE_OPTIONAL_ACCESSORS(instance_wrapper, WasmInstanceWrapper);
WasmModuleObject* module_object();
wasm::WasmModule* module();
@@ -331,61 +326,6 @@
int func_index, int byte_offset);
};
-class WasmInstanceWrapper : public FixedArray {
- public:
- static Handle<WasmInstanceWrapper> New(Isolate* isolate,
- Handle<WasmInstanceObject> instance);
- static WasmInstanceWrapper* cast(Object* fixed_array) {
- SLOW_DCHECK(IsWasmInstanceWrapper(fixed_array));
- return reinterpret_cast<WasmInstanceWrapper*>(fixed_array);
- }
- static bool IsWasmInstanceWrapper(Object* obj);
- bool has_instance() { return get(kWrapperInstanceObject)->IsWeakCell(); }
- Handle<WasmInstanceObject> instance_object() {
- Object* obj = get(kWrapperInstanceObject);
- DCHECK(obj->IsWeakCell());
- WeakCell* cell = WeakCell::cast(obj);
- DCHECK(cell->value()->IsJSObject());
- return handle(WasmInstanceObject::cast(cell->value()));
- }
- bool has_next() { return IsWasmInstanceWrapper(get(kNextInstanceWrapper)); }
- bool has_previous() {
- return IsWasmInstanceWrapper(get(kPreviousInstanceWrapper));
- }
- void set_instance_object(Handle<JSObject> instance, Isolate* isolate);
- void set_next_wrapper(Object* obj) {
- DCHECK(IsWasmInstanceWrapper(obj));
- set(kNextInstanceWrapper, obj);
- }
- void set_previous_wrapper(Object* obj) {
- DCHECK(IsWasmInstanceWrapper(obj));
- set(kPreviousInstanceWrapper, obj);
- }
- Handle<WasmInstanceWrapper> next_wrapper() {
- Object* obj = get(kNextInstanceWrapper);
- DCHECK(IsWasmInstanceWrapper(obj));
- return handle(WasmInstanceWrapper::cast(obj));
- }
- Handle<WasmInstanceWrapper> previous_wrapper() {
- Object* obj = get(kPreviousInstanceWrapper);
- DCHECK(IsWasmInstanceWrapper(obj));
- return handle(WasmInstanceWrapper::cast(obj));
- }
- void reset_next_wrapper() { set_undefined(kNextInstanceWrapper); }
- void reset_previous_wrapper() { set_undefined(kPreviousInstanceWrapper); }
- void reset() {
- for (int kID = 0; kID < kWrapperPropertyCount; kID++) set_undefined(kID);
- }
-
- private:
- enum {
- kWrapperInstanceObject,
- kNextInstanceWrapper,
- kPreviousInstanceWrapper,
- kWrapperPropertyCount
- };
-};
-
#undef DECLARE_ACCESSORS
#undef DECLARE_OPTIONAL_ACCESSORS
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | src/wasm/wasm-objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698