Closed Bug 683862 Opened 13 years ago Closed 13 years ago

Using JSGCTraceKind in the public API

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: igor, Assigned: igor)

References

Details

Attachments

(1 file)

In the bug 674251 I have added JSGCTraceKind enumeration to type the GC tracing constants. This way, when we add a new tracing kind, a compiler at least can warn about missing cases in various switches over these kinds. It also provided better debugging experience and allowed to eliminate few redundant JS_ASSERT(kind < JSTRACE_LIMIT) asserts delegating those to the compiler. 

However, in the patch I have not touched the public API. The various GC-tracing related functions continue to take untyped unsigned parameter. I suppose we should fix those as well.
Attached patch v1Splinter Review
The patch replaces uint32 with JSGCTraceKind in all pubic API calls.
Attachment #557496 - Flags: review?(luke)
Comment on attachment 557496 [details] [diff] [review]
v1

Review of attachment 557496 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsapi.h
@@ +1644,5 @@
>  {
>      jsval_layout l;
>      JS_ASSERT(JSVAL_IS_GCTHING(v));
>      l.asBits = JSVAL_BITS(v);
> +    return (JSGCTraceKind) JSVAL_TRACE_KIND_IMPL(l);

Can you change the return type of JSVAL_TRACE_KIND_IMPL instead?
Attachment #557496 - Flags: review?(luke) → review+
(In reply to Luke Wagner [:luke] from comment #2)
> > +    return (JSGCTraceKind) JSVAL_TRACE_KIND_IMPL(l);
> 
> Can you change the return type of JSVAL_TRACE_KIND_IMPL instead?

That does not work as jsval.h is included even before jspubtd.h and JSVAL_TRACE_KIND_IMPL is an inline function, not a macro. So to avoid defining the enum in jsval.h I left the type as uint32 and cast it in jsapi.h
Fair enough.
http://hg.mozilla.org/mozilla-central/rev/9833be423394
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: