Closed Bug 560101 Opened 14 years ago Closed 14 years ago

"Assertion failure: obj->map->ops->lookupProperty == js_LookupProperty, at ../jsobj.cpp" with e4x

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
critical

Tracking

()

VERIFIED FIXED
Tracking Status
blocking2.0 --- final+

People

(Reporter: gkw, Assigned: jorendorff)

References

Details

(Keywords: assertion, regression, testcase, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

Object.defineProperty(<x/>,0,[])

asserts js debug shell on TM tip without -j at Assertion failure: obj->map->ops->lookupProperty == js_LookupProperty, at ../jsobj.cpp:2191
OS: Linux → All
Hardware: x86 → All
autoBisect shows this is probably related to bug 430133:

The first bad revision is:
changeset:   36651:766a6b2e74e7
user:        Jeff Walden
date:        Fri Jun 05 12:56:45 2009 -0700
summary:     Bug 430133 - Implement ES3.1's Object.defineProperty and Object.defineProperties.  r=jorendorff
Summary: "Assertion failure: obj->map->ops->lookupProperty == js_LookupProperty, at ../jsobj.cpp" → "Assertion failure: obj->map->ops->lookupProperty == js_LookupProperty, at ../jsobj.cpp" with e4x
I can tell what's wrong: obj->isNative() is true for XML objects, since they have scopes, but they don't have anything resembling native ops.

I didn't know this before. To me it looks like jsapi.cpp:DefinePropertyById has the same bug.
Assignee: general → jorendorff
So does js_LookupPropertyWithFlags (bug 500274), and so does the property cache. I think I can fix them all in this bug.
blocking2.0: --- → final+
I've given up on fixing bug 500274 here. It's complicated and I don't have time.

This bug warrants a direct fix anyway. Running the tests now...
Attached patch v1 (obsolete) (deleted) — Splinter Review
The bulk of this patch is just renaming isNative() to hasScope(), with no change in semantics.

The parts to look out for are where I've changed isNative() to hasStandardPropertyOps(), which excludes XML objects.
Attachment #441229 - Flags: review?(jwalden+bmo)
I don't think we should rename isNative to hasScope. We're getting rid of scopes. Then what? We need a name, and the name's not the thing. Also, E4X sucks and we shouldn't let it make us do gratuitous work.

/be
I'll post a more straightforward fix, but 'isNative' is the worst identifier in the JS engine. We really ought to rename it.

I believe we need a term to refer to objects that have normal property behavior, that support the shape guarantees and thus can be supported by the property cache and the tracing JIT. For better or worse I think we already have this term, and it is "native object".

XML objects are not native in this sense. But xmlobj->isNative() returns true. That's pretty astonishing. I have no idea what bugs I've introduced (or failed to detect on review) due to not knowing about this.

If 'hasScope' is no good, I'd be happy with renaming 'isNative' to 'isNativeOrXML' globally, then introducing an 'isNative' method that means the right thing.

> Also, E4X sucks and we shouldn't let it make us do gratuitous work.

Boy do I wish I could just ignore E4X. But E4X is going to make us do stupid work as long as we continue to support it. It has the uncanny power to cause bugs almost anywhere the engine, as happened here.
(In reply to comment #7)
> I'll post a more straightforward fix, but 'isNative' is the worst identifier in
> the JS engine. We really ought to rename it.

It's in ECMA-262. You don't want "isNotHost" :-P.

> I believe we need a term to refer to objects that have normal property
> behavior, that support the shape guarantees and thus can be supported by the
> property cache and the tracing JIT. For better or worse I think we already have
> this term, and it is "native object".

Right.

> XML objects are not native in this sense. But xmlobj->isNative() returns true.
> That's pretty astonishing. I have no idea what bugs I've introduced (or failed
> to detect on review) due to not knowing about this.

Let's make XML objects non-native, then?

/be
ECMA-357 is a full of botches, Waldemar tried warning the BEA (ex-MSFT, Crossgain) guys to no avail. It seems to want its crazyland objects to be "native" in the ECMA-262 sense. But we can and should ring-fence E4X in SpiderMonkey by making our implementation's XML objects non-native.

/be
Attached patch v2 (deleted) — Splinter Review
The one-line fix.
Attachment #441229 - Attachment is obsolete: true
Attachment #441513 - Flags: review?(jwalden+bmo)
Attachment #441229 - Flags: review?(jwalden+bmo)
(In reply to comment #0)
> Object.defineProperty(<x/>,0,[])
> 
> asserts js debug shell on TM tip without -j at Assertion failure:
> obj->map->ops->lookupProperty == js_LookupProperty, at ../jsobj.cpp:2191

Any ill effects in optimized builds?

/be
(In reply to comment #8)
> Let's make XML objects non-native, then?

Filed bug 561785. I think that's the right way forward. It's bit of a hike to get there from here though.
(In reply to comment #11)
> (In reply to comment #0)
> > Object.defineProperty(<x/>,0,[])
> > 
> > asserts js debug shell on TM tip without -j at Assertion failure:
> > obj->map->ops->lookupProperty == js_LookupProperty, at ../jsobj.cpp:2191
> 
> Any ill effects in optimized builds?
> 
> /be

Doesn't seem to have any:

jsfunfuzz-dbg-64-tm-41266-df5f812ab8b7$ ./js-dbg-64-tm-linux 
js> Object.defineProperty(<x/>,0,[])
Assertion failure: obj->map->ops->lookupProperty == js_LookupProperty, at ../jsobj.cpp:2191
Aborted

jsfunfuzz-dbg-64-tm-41266-df5f812ab8b7$ ./js-opt-64-tm-linux 
js> Object.defineProperty(<x/>,0,[])
<x/>
js>
Attachment #441513 - Flags: review?(jwalden+bmo) → review+
http://hg.mozilla.org/mozilla-central/rev/91a48e004fc2
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
A testcase for this bug was automatically identified at js/src/tests/js1_8_5/regress/regress-560101.js.
Flags: in-testsuite+
Testcases have been landed by virtue of being marked in-testsuite+ -> VERIFIED as well.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: