Closed Bug 484333 Opened 15 years ago Closed 15 years ago

TM: make new String() trace

Categories

(Core :: JavaScript Engine, defect, P3)

x86
macOS
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: gal, Assigned: gal)

References

Details

(Keywords: fixed1.9.1, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

required to make xparb trace (not a fast native, so not caught by the generic code)
Attached patch patchSplinter Review
Assignee: general → gal
Attachment #368458 - Flags: review?(brendan)
Blocks: 484332
Flags: wanted1.9.1?
Priority: -- → P3
Attachment #368458 - Flags: review?(brendan) → review?(mrbkap)
Comment on attachment 368458 [details] [diff] [review]
patch

>+JSObject* FASTCALL
>+js_String_tn(JSContext* cx, JSObject* proto, JSString* str)
>+{
>+    JS_ASSERT(JS_ON_TRACE(cx));
>+    JSObject* obj = js_NewNativeObject(cx, &js_StringClass, proto, JSSLOT_PRIVATE + 1);
>+    if (!obj)
>+        return NULL;
>+
>+    obj->fslots[JSSLOT_PRIVATE] = STRING_TO_JSVAL(str);

STOBJ_SET_SLOT was used in the other place. Same style in both, I think this style rather than STOBJ_SET_SLOT (we have moved away from STOBJ_SET_SLOT for the fixed slots, to make clear what's going on at the loss of macro-substitution-capability).

>+
>+    return obj;    

Nits: kill blank line before return, and trailing space after ;.

>+}
>+
>+JS_DEFINE_CALLINFO_3(extern, OBJECT, js_String_tn, CONTEXT, CALLEE_PROTOTYPE, STRING, 0, 0)
>+
>+#endif /* !JS_TRACER */
>+
> static JSBool
> str_fromCharCode(JSContext *cx, uintN argc, jsval *vp)
> {
>diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp
>--- a/js/src/jstracer.cpp
>+++ b/js/src/jstracer.cpp
>@@ -6861,11 +6861,20 @@
>         JSNative native = fun->u.n.native;
>         if (native == js_Array)
>             return newArray(FUN_OBJECT(fun), argc, &tval + 1, &fval);
>-        if (native == js_String && argc == 1 && !constructing) {
>+        if (native == js_String && argc == 1) {
>             jsval& v = stackval(0 - argc);

Pre-existing code, but why not stackval(-1) here?

/be
Attachment #368458 - Flags: review?(mrbkap) → review+
http://hg.mozilla.org/tracemonkey/rev/d9c6a4d2e6b7
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/d9c6a4d2e6b7
Status: NEW → RESOLVED
Closed: 15 years ago
Flags: wanted1.9.1? → wanted1.9.1+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: