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

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

Issue 1480003002: [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add patch from Orion for interpreter cementation test. Disable obsolete/invalid tests. Created 5 years 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/contexts.cc ('k') | src/crankshaft/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CONTEXTS_INL_H_ 5 #ifndef V8_CONTEXTS_INL_H_
6 #define V8_CONTEXTS_INL_H_ 6 #define V8_CONTEXTS_INL_H_
7 7
8 #include "src/contexts.h" 8 #include "src/contexts.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 bool Context::has_extension() { return extension() != nullptr; } 59 bool Context::has_extension() { return extension() != nullptr; }
60 Object* Context::extension() { return get(EXTENSION_INDEX); } 60 Object* Context::extension() { return get(EXTENSION_INDEX); }
61 void Context::set_extension(Object* object) { set(EXTENSION_INDEX, object); } 61 void Context::set_extension(Object* object) { set(EXTENSION_INDEX, object); }
62 62
63 63
64 JSModule* Context::module() { return JSModule::cast(get(EXTENSION_INDEX)); } 64 JSModule* Context::module() { return JSModule::cast(get(EXTENSION_INDEX)); }
65 void Context::set_module(JSModule* module) { set(EXTENSION_INDEX, module); } 65 void Context::set_module(JSModule* module) { set(EXTENSION_INDEX, module); }
66 66
67 67
68 JSGlobalObject* Context::global_object() { 68 Context* Context::native_context() {
69 Object* result = get(GLOBAL_OBJECT_INDEX); 69 Object* result = get(NATIVE_CONTEXT_INDEX);
70 DCHECK(IsBootstrappingOrGlobalObject(this->GetIsolate(), result)); 70 DCHECK(IsBootstrappingOrNativeContext(this->GetIsolate(), result));
71 return reinterpret_cast<JSGlobalObject*>(result); 71 return reinterpret_cast<Context*>(result);
72 } 72 }
73 73
74 74
75 void Context::set_global_object(JSGlobalObject* object) { 75 void Context::set_native_context(Context* context) {
76 set(GLOBAL_OBJECT_INDEX, object); 76 set(NATIVE_CONTEXT_INDEX, context);
77 } 77 }
78 78
79 79
80 bool Context::IsNativeContext() { 80 bool Context::IsNativeContext() {
81 Map* map = this->map(); 81 Map* map = this->map();
82 return map == map->GetHeap()->native_context_map(); 82 return map == map->GetHeap()->native_context_map();
83 } 83 }
84 84
85 85
86 bool Context::IsFunctionContext() { 86 bool Context::IsFunctionContext() {
(...skipping 26 matching lines...) Expand all
113 } 113 }
114 114
115 115
116 bool Context::IsScriptContext() { 116 bool Context::IsScriptContext() {
117 Map* map = this->map(); 117 Map* map = this->map();
118 return map == map->GetHeap()->script_context_map(); 118 return map == map->GetHeap()->script_context_map();
119 } 119 }
120 120
121 121
122 bool Context::HasSameSecurityTokenAs(Context* that) { 122 bool Context::HasSameSecurityTokenAs(Context* that) {
123 return this->global_object()->native_context()->security_token() == 123 return this->native_context()->security_token() ==
124 that->global_object()->native_context()->security_token(); 124 that->native_context()->security_token();
125 } 125 }
126 126
127 127
128 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \ 128 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \
129 void Context::set_##name(type* value) { \ 129 void Context::set_##name(type* value) { \
130 DCHECK(IsNativeContext()); \ 130 DCHECK(IsNativeContext()); \
131 set(index, value); \ 131 set(index, value); \
132 } \ 132 } \
133 bool Context::is_##name(type* value) { \ 133 bool Context::is_##name(type* value) { \
134 DCHECK(IsNativeContext()); \ 134 DCHECK(IsNativeContext()); \
135 return type::cast(get(index)) == value; \ 135 return type::cast(get(index)) == value; \
136 } \ 136 } \
137 type* Context::name() { \ 137 type* Context::name() { \
138 DCHECK(IsNativeContext()); \ 138 DCHECK(IsNativeContext()); \
139 return type::cast(get(index)); \ 139 return type::cast(get(index)); \
140 } 140 }
141 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSORS) 141 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSORS)
142 #undef NATIVE_CONTEXT_FIELD_ACCESSORS 142 #undef NATIVE_CONTEXT_FIELD_ACCESSORS
143 143
144 144
145 } // namespace internal 145 } // namespace internal
146 } // namespace v8 146 } // namespace v8
147 147
148 #endif // V8_CONTEXTS_INL_H_ 148 #endif // V8_CONTEXTS_INL_H_
OLDNEW
« no previous file with comments | « src/contexts.cc ('k') | src/crankshaft/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698