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

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

Issue 2509053003: [wasm] Refactor interface to WasmCompiledModule (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 unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | src/wasm/wasm-objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 151
152 #define WCM_OBJECT_OR_WEAK(TYPE, NAME, ID) \ 152 #define WCM_OBJECT_OR_WEAK(TYPE, NAME, ID) \
153 Handle<TYPE> NAME() const { return handle(ptr_to_##NAME()); } \ 153 Handle<TYPE> NAME() const { return handle(ptr_to_##NAME()); } \
154 \ 154 \
155 MaybeHandle<TYPE> maybe_##NAME() const { \ 155 MaybeHandle<TYPE> maybe_##NAME() const { \
156 if (has_##NAME()) return NAME(); \ 156 if (has_##NAME()) return NAME(); \
157 return MaybeHandle<TYPE>(); \ 157 return MaybeHandle<TYPE>(); \
158 } \ 158 } \
159 \ 159 \
160 TYPE* maybe_ptr_to_##NAME() const { \
161 Object* obj = get(ID); \
162 if (!obj->Is##TYPE()) return nullptr; \
163 return TYPE::cast(obj); \
164 } \
165 \
160 TYPE* ptr_to_##NAME() const { \ 166 TYPE* ptr_to_##NAME() const { \
161 Object* obj = get(ID); \ 167 Object* obj = get(ID); \
162 if (!obj->Is##TYPE()) return nullptr; \ 168 DCHECK(obj->Is##TYPE()); \
163 return TYPE::cast(obj); \ 169 return TYPE::cast(obj); \
164 } \ 170 } \
165 \ 171 \
166 void set_##NAME(Handle<TYPE> value) { set_ptr_to_##NAME(*value); } \ 172 void set_##NAME(Handle<TYPE> value) { set_ptr_to_##NAME(*value); } \
167 \ 173 \
168 void set_ptr_to_##NAME(TYPE* value) { set(ID, value); } \ 174 void set_ptr_to_##NAME(TYPE* value) { set(ID, value); } \
169 \ 175 \
170 bool has_##NAME() const { return get(ID)->Is##TYPE(); } \ 176 bool has_##NAME() const { return get(ID)->Is##TYPE(); } \
171 \ 177 \
172 void reset_##NAME() { set_undefined(ID); } 178 void reset_##NAME() { set_undefined(ID); }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 int func_index, int byte_offset); 305 int func_index, int byte_offset);
300 }; 306 };
301 307
302 #undef DECLARE_ACCESSORS 308 #undef DECLARE_ACCESSORS
303 #undef DECLARE_OPTIONAL_ACCESSORS 309 #undef DECLARE_OPTIONAL_ACCESSORS
304 310
305 } // namespace internal 311 } // namespace internal
306 } // namespace v8 312 } // namespace v8
307 313
308 #endif // V8_WASM_OBJECTS_H_ 314 #endif // V8_WASM_OBJECTS_H_
OLDNEW
« 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