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 94879 : void ThreadLocalTop::Initialize(Isolate* isolate) {
14 94879 : *this = ThreadLocalTop();
15 94879 : isolate_ = isolate;
16 : #ifdef USE_SIMULATOR
17 : simulator_ = Simulator::current(isolate);
18 : #endif
19 94879 : thread_id_ = ThreadId::Current();
20 : thread_in_wasm_flag_address_ = reinterpret_cast<Address>(
21 94879 : trap_handler::GetThreadInWasmThreadLocalAddress());
22 94879 : }
23 :
24 68328 : void ThreadLocalTop::Free() {
25 : // Match unmatched PopPromise calls.
26 68377 : while (promise_on_stack_) isolate_->PopPromise();
27 68328 : }
28 :
29 : } // namespace internal
30 122004 : } // namespace v8
|