| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 std::vector<WasmGlobal> globals; // globals in this module. | 171 std::vector<WasmGlobal> globals; // globals in this module. |
| 172 uint32_t globals_size; // size of globals table. | 172 uint32_t globals_size; // size of globals table. |
| 173 uint32_t indirect_table_size; // size of indirect function | 173 uint32_t indirect_table_size; // size of indirect function |
| 174 // table (includes padding). | 174 // table (includes padding). |
| 175 std::vector<FunctionSig*> signatures; // signatures in this module. | 175 std::vector<FunctionSig*> signatures; // signatures in this module. |
| 176 std::vector<WasmFunction> functions; // functions in this module. | 176 std::vector<WasmFunction> functions; // functions in this module. |
| 177 std::vector<WasmDataSegment> data_segments; // data segments in this module. | 177 std::vector<WasmDataSegment> data_segments; // data segments in this module. |
| 178 std::vector<uint16_t> function_table; // function table. | 178 std::vector<uint16_t> function_table; // function table. |
| 179 std::vector<WasmImport> import_table; // import table. | 179 std::vector<WasmImport> import_table; // import table. |
| 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 |
| 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 |
| 184 // up right after semaphore::Wait() returns, then this can cause an |
| 185 // invalid-semaphore error in the compilation tasks. |
| 186 // TODO(wasm): Move this semaphore back to CompileInParallel when the try bots |
| 187 // switch to libc-2.21 or higher. |
| 188 base::SmartPointer<base::Semaphore> pending_tasks; |
| 181 | 189 |
| 182 WasmModule(); | 190 WasmModule(); |
| 183 | 191 |
| 184 // Get a string stored in the module bytes representing a name. | 192 // Get a string stored in the module bytes representing a name. |
| 185 WasmName GetName(uint32_t offset, uint32_t length) const { | 193 WasmName GetName(uint32_t offset, uint32_t length) const { |
| 186 if (length == 0) return {"<?>", 3}; // no name. | 194 if (length == 0) return {"<?>", 3}; // no name. |
| 187 CHECK(BoundsCheck(offset, offset + length)); | 195 CHECK(BoundsCheck(offset, offset + length)); |
| 188 DCHECK_GE(static_cast<int>(length), 0); | 196 DCHECK_GE(static_cast<int>(length), 0); |
| 189 return {reinterpret_cast<const char*>(module_start + offset), | 197 return {reinterpret_cast<const char*>(module_start + offset), |
| 190 static_cast<int>(length)}; | 198 static_cast<int>(length)}; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // secure. If it turns out that we need more complete checks, we could add a | 368 // secure. If it turns out that we need more complete checks, we could add a |
| 361 // special marker as internal field, which will definitely never occur anywhere | 369 // special marker as internal field, which will definitely never occur anywhere |
| 362 // else. | 370 // else. |
| 363 bool IsWasmObject(Object* object); | 371 bool IsWasmObject(Object* object); |
| 364 | 372 |
| 365 } // namespace wasm | 373 } // namespace wasm |
| 366 } // namespace internal | 374 } // namespace internal |
| 367 } // namespace v8 | 375 } // namespace v8 |
| 368 | 376 |
| 369 #endif // V8_WASM_MODULE_H_ | 377 #endif // V8_WASM_MODULE_H_ |
| OLD | NEW |