OLD | NEW |
---|---|
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 "src/api.h" | 8 #include "src/api.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/wasm/wasm-opcodes.h" | 10 #include "src/wasm/wasm-opcodes.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 std::vector<WasmExport> export_table; // export table. | 180 std::vector<WasmExport> export_table; // export table. |
181 // We store the semaphore here to extend its lifetime. In <libc-2.21, which we | 181 // We store the semaphore here to extend its lifetime. In <libc-2.21, which we |
182 // use on the try bots, semaphore::Wait() can return while some compilation | 182 // use on the try bots, semaphore::Wait() can return while some compilation |
183 // tasks are still executing semaphore::Signal(). If the semaphore is cleaned | 183 // tasks are still executing semaphore::Signal(). If the semaphore is cleaned |
184 // up right after semaphore::Wait() returns, then this can cause an | 184 // up right after semaphore::Wait() returns, then this can cause an |
185 // invalid-semaphore error in the compilation tasks. | 185 // invalid-semaphore error in the compilation tasks. |
186 // TODO(wasm): Move this semaphore back to CompileInParallel when the try bots | 186 // TODO(wasm): Move this semaphore back to CompileInParallel when the try bots |
187 // switch to libc-2.21 or higher. | 187 // switch to libc-2.21 or higher. |
188 base::SmartPointer<base::Semaphore> pending_tasks; | 188 base::SmartPointer<base::Semaphore> pending_tasks; |
189 | 189 |
190 WasmModule(); | 190 explicit WasmModule(byte* module_start = nullptr); |
John
2016/07/13 19:56:59
optional: It probably does not matter, but what do
ritesht
2016/07/13 23:58:45
Done.
| |
191 | 191 |
192 // Get a string stored in the module bytes representing a name. | 192 // Get a string stored in the module bytes representing a name. |
193 WasmName GetName(uint32_t offset, uint32_t length) const { | 193 WasmName GetName(uint32_t offset, uint32_t length) const { |
194 if (length == 0) return {"<?>", 3}; // no name. | 194 if (length == 0) return {"<?>", 3}; // no name. |
195 CHECK(BoundsCheck(offset, offset + length)); | 195 CHECK(BoundsCheck(offset, offset + length)); |
196 DCHECK_GE(static_cast<int>(length), 0); | 196 DCHECK_GE(static_cast<int>(length), 0); |
197 return {reinterpret_cast<const char*>(module_start + offset), | 197 return {reinterpret_cast<const char*>(module_start + offset), |
198 static_cast<int>(length)}; | 198 static_cast<int>(length)}; |
199 } | 199 } |
200 | 200 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 // given encoded module. The module should have no imports. | 377 // given encoded module. The module should have no imports. |
378 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 378 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
379 const byte* module_end, bool asm_js = false); | 379 const byte* module_end, bool asm_js = false); |
380 | 380 |
381 } // namespace testing | 381 } // namespace testing |
382 } // namespace wasm | 382 } // namespace wasm |
383 } // namespace internal | 383 } // namespace internal |
384 } // namespace v8 | 384 } // namespace v8 |
385 | 385 |
386 #endif // V8_WASM_MODULE_H_ | 386 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |