Changes between Initial Version and Version 1 of JSRootingGuide


Ignore:
Timestamp:
Mar 11, 2014, 10:11:14 PM (10 years ago)
Author:
Yves
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • JSRootingGuide

    v1 v1  
     1The [https://developer.mozilla.org/en-US/docs/SpiderMonkey/GC_Rooting_Guide GC Rooting Guide] and the guide for [https://developer.mozilla.org/en-US/docs/SpiderMonkey/Internals/GC/Exact_Stack_Rooting Exact Stack Rooting] give a first overview, but there's still a lot to figure out.
     2For the upgrade to ESR24 I've decided to avoid this topic because it's way to complicated and extensive to do it at the same time as the upgrade, but I'd still like to make some notes about important things I figure out.
     3
     4== Use cases and examples ==
     5
     6=== Implicit conversion to JS::Value ===
     7Implicit conversion from JS::RootedValue, JS::HandleValue and JS::MutableHandle to JS::Value allows us using a rooted type at the top of a chain of functions that are not migrated yet.
     8This does not work with JS::Value pointer arguments unfortunately. The following code is valid:
     9{{{
     10void bar(JS::Value val)
     11{       
     12}
     13
     14void foo(JSContext* cx, JS::HandleValue handleVal, JS::MutableHandleValue mutableHandleVal)
     15{
     16        JS::RootedValue val(cx);
     17        bar(val);
     18        bar(handleVal);
     19        bar(mutableHandleVal);
     20}
     21}}}
     22