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

Unified Diff: src/bootstrapper.cc

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/atomicops_internals_x86_msvc.h ('k') | src/builtins.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 987e2290e5b74565e93282bd650e236d1b18c8d8..3758f4313d28790048474f6bec0bbc534d45128a 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -457,15 +457,34 @@ Handle<JSFunction> Genesis::CreateEmptyFunction() {
}
+static void AddToWeakGlobalContextList(Context* context) {
+ ASSERT(context->IsGlobalContext());
+ Heap* heap = Isolate::Current()->heap();
+#ifdef DEBUG
+ { // NOLINT
+ ASSERT(context->get(Context::NEXT_CONTEXT_LINK)->IsUndefined());
+ // Check that context is not in the list yet.
+ for (Object* current = heap->global_contexts_list();
+ !current->IsUndefined();
+ current = Context::cast(current)->get(Context::NEXT_CONTEXT_LINK)) {
+ ASSERT(current != context);
+ }
+ }
+#endif
+ context->set(Context::NEXT_CONTEXT_LINK, heap->global_contexts_list());
+ heap->set_global_contexts_list(context);
+}
+
+
void Genesis::CreateRoots() {
Isolate* isolate = Isolate::Current();
// Allocate the global context FixedArray first and then patch the
// closure and extension object later (we need the empty function
// and the global object, but in order to create those, we need the
// global context).
- global_context_ =
- Handle<Context>::cast(
- isolate->global_handles()->Create(*FACTORY->NewGlobalContext()));
+ global_context_ = Handle<Context>::cast(isolate->global_handles()->Create(
+ *isolate->factory()->NewGlobalContext()));
+ AddToWeakGlobalContextList(*global_context_);
isolate->set_context(*global_context());
// Allocate the message listeners object.
@@ -1572,7 +1591,7 @@ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
= Handle<SharedFunctionInfo>(function->shared());
if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false;
// Set the code object on the function object.
- function->set_code(function->shared()->code());
+ function->ReplaceCode(function->shared()->code());
builtins->set_javascript_builtin_code(id, shared->code());
}
return true;
@@ -1761,7 +1780,8 @@ Genesis::Genesis(Handle<Object> global_object,
Handle<Context> new_context = Snapshot::NewContextFromSnapshot();
if (!new_context.is_null()) {
global_context_ =
- Handle<Context>::cast(isolate->global_handles()->Create(*new_context));
+ Handle<Context>::cast(isolate->global_handles()->Create(*new_context));
+ AddToWeakGlobalContextList(*global_context_);
isolate->set_context(*global_context_);
isolate->counters()->contexts_created_by_snapshot()->Increment();
result_ = global_context_;
@@ -1797,11 +1817,6 @@ Genesis::Genesis(Handle<Object> global_object,
isolate->counters()->contexts_created_from_scratch()->Increment();
}
- // Add this context to the weak list of global contexts.
- (*global_context_)->set(Context::NEXT_CONTEXT_LINK,
- isolate->heap()->global_contexts_list());
- isolate->heap()->set_global_contexts_list(*global_context_);
-
result_ = global_context_;
}
« no previous file with comments | « src/atomicops_internals_x86_msvc.h ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698