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

Side by Side Diff: src/isolate-inl.h

Issue 1322883002: Make isolate.h usable without objects-inl.h header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-includes-frames-2
Patch Set: Rebased. Created 5 years, 3 months 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/isolate.cc ('k') | src/lookup.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_ISOLATE_INL_H_
6 #define V8_ISOLATE_INL_H_
7
8 #include "src/isolate.h"
9 #include "src/objects-inl.h"
10
11 namespace v8 {
12 namespace internal {
13
14
15 void Isolate::set_context(Context* context) {
16 DCHECK(context == NULL || context->IsContext());
17 thread_local_top_.context_ = context;
18 }
19
20
21 Object* Isolate::pending_exception() {
22 DCHECK(has_pending_exception());
23 DCHECK(!thread_local_top_.pending_exception_->IsException());
24 return thread_local_top_.pending_exception_;
25 }
26
27
28 void Isolate::set_pending_exception(Object* exception_obj) {
29 DCHECK(!exception_obj->IsException());
30 thread_local_top_.pending_exception_ = exception_obj;
31 }
32
33
34 void Isolate::clear_pending_exception() {
35 DCHECK(!thread_local_top_.pending_exception_->IsException());
36 thread_local_top_.pending_exception_ = heap_.the_hole_value();
37 }
38
39
40 bool Isolate::has_pending_exception() {
41 DCHECK(!thread_local_top_.pending_exception_->IsException());
42 return !thread_local_top_.pending_exception_->IsTheHole();
43 }
44
45
46 void Isolate::clear_pending_message() {
47 thread_local_top_.pending_message_obj_ = heap_.the_hole_value();
48 }
49
50
51 Object* Isolate::scheduled_exception() {
52 DCHECK(has_scheduled_exception());
53 DCHECK(!thread_local_top_.scheduled_exception_->IsException());
54 return thread_local_top_.scheduled_exception_;
55 }
56
57
58 bool Isolate::has_scheduled_exception() {
59 DCHECK(!thread_local_top_.scheduled_exception_->IsException());
60 return thread_local_top_.scheduled_exception_ != heap_.the_hole_value();
61 }
62
63
64 void Isolate::clear_scheduled_exception() {
65 DCHECK(!thread_local_top_.scheduled_exception_->IsException());
66 thread_local_top_.scheduled_exception_ = heap_.the_hole_value();
67 }
68
69
70 bool Isolate::is_catchable_by_javascript(Object* exception) {
71 return exception != heap()->termination_exception();
72 }
73
74
75 Handle<GlobalObject> Isolate::global_object() {
76 return Handle<GlobalObject>(context()->global_object());
77 }
78
79
80 Isolate::ExceptionScope::ExceptionScope(Isolate* isolate)
81 : isolate_(isolate),
82 pending_exception_(isolate_->pending_exception(), isolate_) {}
83
84
85 Isolate::ExceptionScope::~ExceptionScope() {
86 isolate_->set_pending_exception(*pending_exception_);
87 }
88
89
90 #define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \
91 Handle<type> Isolate::name() { \
92 return Handle<type>(native_context()->name(), this); \
93 } \
94 bool Isolate::is_##name(type* value) { \
95 return native_context()->is_##name(value); \
96 }
97 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR)
98 #undef NATIVE_CONTEXT_FIELD_ACCESSOR
99
100
101 } // namespace internal
102 } // namespace v8
103
104 #endif // V8_ISOLATE_INL_H_
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/lookup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698