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

Unified Diff: src/contexts.cc

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, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/contexts.h ('k') | src/contexts-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index f769b9bb7e9fd6ce5e874d7dde741aa2de382c45..206f4a2e73d17015a17238610b63b92d7553c98b 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -118,6 +118,11 @@ String* Context::catch_name() {
}
+JSGlobalObject* Context::global_object() {
+ return JSGlobalObject::cast(native_context()->extension());
+}
+
+
Context* Context::script_context() {
Context* current = this;
while (!current->IsScriptContext()) {
@@ -127,17 +132,6 @@ Context* Context::script_context() {
}
-Context* Context::native_context() {
- // Fast case: the receiver context is already a native context.
- if (IsNativeContext()) return this;
- // The global object has a direct pointer to the native context. If the
- // following DCHECK fails, the native context is probably being accessed
- // indirectly during bootstrapping. This is unsupported.
- DCHECK(global_object()->IsJSGlobalObject());
- return global_object()->native_context();
-}
-
-
JSObject* Context::global_proxy() {
return native_context()->global_proxy_object();
}
@@ -557,6 +551,15 @@ bool Context::IsJSBuiltin(Handle<Context> native_context,
#ifdef DEBUG
+
+bool Context::IsBootstrappingOrNativeContext(Isolate* isolate, Object* object) {
+ // During bootstrapping we allow all objects to pass as global
+ // objects. This is necessary to fix circular dependencies.
+ return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
+ isolate->bootstrapper()->IsActive() || object->IsNativeContext();
+}
+
+
bool Context::IsBootstrappingOrValidParentContext(
Object* object, Context* child) {
// During bootstrapping we allow all objects to pass as
@@ -568,13 +571,6 @@ bool Context::IsBootstrappingOrValidParentContext(
context->IsModuleContext() || !child->IsModuleContext();
}
-
-bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
- // During bootstrapping we allow all objects to pass as global
- // objects. This is necessary to fix circular dependencies.
- return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
- isolate->bootstrapper()->IsActive() || object->IsJSGlobalObject();
-}
#endif
« no previous file with comments | « src/contexts.h ('k') | src/contexts-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698