Line data Source code
1 : // Copyright 2019 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #include "src/thread-local-top.h"
6 : #include "src/isolate.h"
7 : #include "src/simulator.h"
8 : #include "src/trap-handler/trap-handler.h"
9 :
10 : namespace v8 {
11 : namespace internal {
12 :
13 94885 : void ThreadLocalTop::Initialize(Isolate* isolate) {
14 94885 : *this = ThreadLocalTop();
15 94885 : isolate_ = isolate;
16 : #ifdef USE_SIMULATOR
17 : simulator_ = Simulator::current(isolate);
18 : #endif
19 94885 : thread_id_ = ThreadId::Current();
20 : thread_in_wasm_flag_address_ = reinterpret_cast<Address>(
21 94885 : trap_handler::GetThreadInWasmThreadLocalAddress());
22 94885 : }
23 :
24 68322 : void ThreadLocalTop::Free() {
25 : // Match unmatched PopPromise calls.
26 68372 : while (promise_on_stack_) isolate_->PopPromise();
27 68323 : }
28 :
29 : } // namespace internal
30 121996 : } // namespace v8
|