Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Using JSGCTraceKind in the public API

RESOLVED FIXED in mozilla9

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Igor Bukanov, Assigned: Igor Bukanov)

Tracking

Trunk
mozilla9
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
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.
(Assignee)

Comment 1

6 years ago
Created attachment 557496 [details] [diff] [review]
v1

The patch replaces uint32 with JSGCTraceKind in all pubic API calls.
Attachment #557496 - Flags: review?(luke)

Comment 2

6 years ago
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+
(Assignee)

Comment 3

6 years ago
(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

Comment 4

6 years ago
Fair enough.
(Assignee)

Comment 5

6 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/9833be423394
http://hg.mozilla.org/mozilla-central/rev/9833be423394
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
You need to log in before you can comment on or make changes to this bug.