Bug 1377007 - GC for binjs-ref parser;r?jorendorff,arai draft
authorDavid Teller <dteller@mozilla.com>
Tue, 05 Sep 2017 14:51:30 +0200
changeset 663863 664572bb0e3f7bae3965dd6f3b49895873eb9aee
parent 663862 4c912c2bd0e8cc941e6bdd6a94f785e5b6e51ac6
child 663864 8f25ff1e3ca636b8c1f33a6ce7c13b4d250d4063
push id79549
push userdteller@mozilla.com
push dateWed, 13 Sep 2017 13:20:37 +0000
reviewersjorendorff, arai
bugs1377007
milestone57.0a1
Bug 1377007 - GC for binjs-ref parser;r?jorendorff,arai MozReview-Commit-ID: EjZZ1ofm52t
js/src/frontend/BytecodeCompiler.h
js/src/gc/RootMarking.cpp
js/src/jspubtd.h
--- a/js/src/frontend/BytecodeCompiler.h
+++ b/js/src/frontend/BytecodeCompiler.h
@@ -124,16 +124,21 @@ IsIdentifier(const char16_t* chars, size
 /* True if str is a keyword. Defined in TokenStream.cpp. */
 bool
 IsKeyword(JSLinearString* str);
 
 /* Trace all GC things reachable from parser. Defined in Parser.cpp. */
 void
 TraceParser(JSTracer* trc, JS::AutoGCRooter* parser);
 
+/* Trace all GC things reachable from binjs parser. Defined in BinSource.cpp. */
+void
+TraceBinParser(JSTracer* trc, JS::AutoGCRooter* parser);
+
+
 class MOZ_STACK_CLASS AutoFrontendTraceLog
 {
 #ifdef JS_TRACE_LOGGING
     TraceLoggerThread* logger_;
     mozilla::Maybe<TraceLoggerEvent> frontendEvent_;
     mozilla::Maybe<AutoTraceLog> frontendLog_;
     mozilla::Maybe<AutoTraceLog> typeLog_;
 #endif
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -149,16 +149,20 @@ JS_FOR_EACH_TRACEKIND(FINISH_ROOT_LIST)
 inline void
 AutoGCRooter::trace(JSTracer* trc)
 {
     switch (tag_) {
       case PARSER:
         frontend::TraceParser(trc, this);
         return;
 
+      case BINPARSER:
+        frontend::TraceBinParser(trc, this);
+        return;
+
       case VALARRAY: {
         /*
          * We don't know the template size parameter, but we can safely treat it
          * as an AutoValueArray<1> because the length is stored separately.
          */
         AutoValueArray<1>* array = static_cast<AutoValueArray<1>*>(this);
         TraceRootRange(trc, array->length(), array->begin(), "js::AutoValueArray");
         return;
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -239,16 +239,17 @@ class JS_PUBLIC_API(AutoGCRooter)
      * below.  Any other negative value indicates some deeper problem such as
      * memory corruption.
      */
     ptrdiff_t tag_;
 
     enum {
         VALARRAY =     -2, /* js::AutoValueArray */
         PARSER =       -3, /* js::frontend::Parser */
+        BINPARSER =    -4, /* js::frontend::BinSource */
         VALVECTOR =   -10, /* js::AutoValueVector */
         IDVECTOR =    -11, /* js::AutoIdVector */
         OBJVECTOR =   -14, /* js::AutoObjectVector */
         IONMASM =     -19, /* js::jit::MacroAssembler */
         WRAPVECTOR =  -20, /* js::AutoWrapperVector */
         WRAPPER =     -21, /* js::AutoWrapperRooter */
         CUSTOM =      -26  /* js::CustomAutoRooter */
     };