Bug 813328 - Add initialize() method to IonCompartment. r=dvander
authorKannan Vijayan <kvijayan@mozilla.com>
Mon, 19 Nov 2012 17:43:13 -0500
changeset 119295 bd4d746598fd8a07b8df8e89d10c6cce75f6c346
parent 119294 ce7456dc02bd2a4cd0c17830213cdc0cb513c891
child 119296 452ecece0b175266f88d678f191386bfb9810411
push idunknown
push userunknown
push dateunknown
reviewersdvander
bugs813328
milestone20.0a1
Bug 813328 - Add initialize() method to IonCompartment. r=dvander
js/src/ion/Ion.cpp
js/src/ion/IonCompartment.h
js/src/jscompartment.cpp
--- a/js/src/ion/Ion.cpp
+++ b/js/src/ion/Ion.cpp
@@ -199,16 +199,22 @@ IonRuntime::initialize(JSContext *cx)
 }
 
 IonCompartment::IonCompartment(IonRuntime *rt)
   : rt(rt),
     flusher_(NULL)
 {
 }
 
+bool
+IonCompartment::initialize(JSContext *cx)
+{
+    return true;
+}
+
 void
 ion::FinishOffThreadBuilder(IonBuilder *builder)
 {
     // Clean up if compilation did not succeed.
     if (builder->script()->isIonCompilingOffThread()) {
         types::TypeCompartment &types = builder->script()->compartment()->types;
         builder->recompileInfo.compilerOutput(types)->invalidate();
         builder->script()->ion = NULL;
--- a/js/src/ion/IonCompartment.h
+++ b/js/src/ion/IonCompartment.h
@@ -95,16 +95,18 @@ class IonCompartment
 
     OffThreadCompilationVector &finishedOffThreadCompilations() {
         return finishedOffThreadCompilations_;
     }
 
   public:
     IonCompartment(IonRuntime *rt);
 
+    bool initialize(JSContext *cx);
+
     void mark(JSTracer *trc, JSCompartment *compartment);
     void sweep(FreeOp *fop);
 
     JSC::ExecutableAllocator *execAlloc() {
         return rt->execAlloc_;
     }
 
     IonCode *getGenericBailoutHandler() {
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -191,16 +191,22 @@ JSCompartment::ensureIonCompartmentExist
         return false;
 
     /* Set the compartment early, so linking works. */
     ionCompartment_ = cx->new_<IonCompartment>(ionRuntime);
 
     if (!ionCompartment_)
         return false;
 
+    if (!ionCompartment_->initialize(cx)) {
+        js_delete(ionCompartment_);
+        ionCompartment_ = NULL;
+        return false;
+    }
+
     return true;
 }
 #endif
 
 static bool
 WrapForSameCompartment(JSContext *cx, HandleObject obj, Value *vp)
 {
     JS_ASSERT(cx->compartment == obj->compartment());