Closed
Bug 903394
Opened 11 years ago
Closed 11 years ago
IonMonkey: Remove do {} while(false) in IonBuilder
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla26
People
(Reporter: h4writer, Assigned: h4writer)
References
Details
Attachments
(3 files, 1 obsolete file)
13.98 KB,
patch
|
jandem
:
review+
h4writer
:
checkin+
|
Details | Diff | Splinter Review |
15.11 KB,
patch
|
jandem
:
review+
h4writer
:
checkin+
|
Details | Diff | Splinter Review |
24.95 KB,
patch
|
jandem
:
review+
h4writer
:
checkin+
|
Details | Diff | Splinter Review |
I think it is very ugly to have do {} while(false) in the code. But that is a personal opinion. Now for getprop we used getPropTry... helper functions. We can do the same for setprop/setelem.
Assignee | ||
Comment 1•11 years ago
|
||
1) I didn't fold jsop_setelem_dense and jsop_setelem_typed into the setElemTryDense/setElemTryTyped, since the function are both quite big... 2) Jandem, feel free to forward the review to somebody if you approve to use of "setElemTryXXX" instead of do_while_false. It is pure refactor, no new functionality at all.
Assignee: general → hv1989
Attachment #788108 -
Flags: review?(jdemooij)
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #788109 -
Flags: review?(jdemooij)
Assignee | ||
Updated•11 years ago
|
Attachment #788108 -
Attachment description: bug903394-remove-do-while → bug903394-setelem-remove-do-while
Assignee | ||
Comment 3•11 years ago
|
||
I can do the same for getelem for consistency too (no do-while in there).
Assignee | ||
Comment 4•11 years ago
|
||
Comment on attachment 788108 [details] [diff] [review] bug903394-setelem-remove-do-while Review of attachment 788108 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit/IonBuilder.cpp @@ +7057,5 @@ > +{ > + JS_ASSERT(*emitted == false); > + > + if (object->type() != MIRType_Magic) > + return false; Oops, should be: "return true;"
Comment 5•11 years ago
|
||
Comment on attachment 788108 [details] [diff] [review] bug903394-setelem-remove-do-while Review of attachment 788108 [details] [diff] [review]: ----------------------------------------------------------------- \o/ Nice refactoring! ::: js/src/jit/IonBuilder.cpp @@ +7073,5 @@ > + if (!object->mightBeType(MIRType_Object)) > + return true; > + > + if (!index->mightBeType(MIRType_Int32) && > + !index->mightBeType(MIRType_String)) Style nit: if (!index->mightBeType(MIRType_Int32) && !index->mightBeType(MIRType_String)) return true;
Attachment #788108 -
Flags: review?(jdemooij) → review+
Comment 6•11 years ago
|
||
Comment on attachment 788109 [details] [diff] [review] bug903394-setprop-remove-do-while Review of attachment 788109 [details] [diff] [review]: ----------------------------------------------------------------- Very nice. ::: js/src/jit/IonBuilder.cpp @@ +8340,5 @@ > + // the setter's return value. > + CallInfo callInfo(cx, false); > + if (!callInfo.init(current, 1)) > + return false; > + // Ensure that we know we are calling a setter in case we inline it. Pre-existing nit: add a newline before this comment. @@ +8382,5 @@ > + // Emit SetDOMProperty. > + JS_ASSERT(setter->jitInfo()->type == JSJitInfo::Setter); > + MSetDOMProperty *set = MSetDOMProperty::New(setter->jitInfo()->setter, obj, value); > + if (!set) > + return false; Pre-existing nit: can remove this NULL check; we don't have them for other MIR instructions. @@ +8448,5 @@ > + > + if (shapes.length() == 1) { > + spew("Inlining monomorphic SETPROP"); > + > + // The JM IC was monomorphic, so we inline the property access as Pre-existing nit: s/JM/Baseline
Attachment #788109 -
Flags: review?(jdemooij) → review+
Assignee | ||
Comment 7•11 years ago
|
||
Decided to do getelem too. Failing jit-tests atm, probably just a typo, but not awake enough to find it.
Assignee | ||
Comment 8•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/9f324fcd43ec https://hg.mozilla.org/integration/mozilla-inbound/rev/6a5a7b55c22a
Whiteboard: [leave open]
Assignee | ||
Updated•11 years ago
|
Attachment #788108 -
Flags: checkin+
Assignee | ||
Updated•11 years ago
|
Attachment #788109 -
Flags: checkin+
Comment 9•11 years ago
|
||
(In reply to Hannes Verschore [:h4writer] from comment #8) > https://hg.mozilla.org/integration/mozilla-inbound/rev/9f324fcd43ec > https://hg.mozilla.org/integration/mozilla-inbound/rev/6a5a7b55c22a One of the patch in the range of [1] is causing deterministic failures while running octane-richards on Unagi. Hannes any idea, or I should back out them? [1] http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=928f0878d1cdef204feaed4e66a8f4baadf09d8f&tochange=6a5a7b55c22a954f12f4c7e8e178706daa806fe7
Comment 10•11 years ago
|
||
(In reply to Nicolas B. Pierron [:nbp] from comment #9) > One of the patch in the range of [1] is causing deterministic failures while > running octane-richards on Unagi. Not richards, but delta-blue. I still get a result displayed on richards and the crash happens asafter the delta blue box appears on the screen.
Comment 11•11 years ago
|
||
Comment on attachment 788108 [details] [diff] [review] bug903394-setelem-remove-do-while Review of attachment 788108 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit/IonBuilder.cpp @@ +6971,5 @@ > + > + TypedArrayObject *tarr = &tarrObj->as<TypedArrayObject>(); > + ArrayBufferView::ViewType viewType = JS_GetArrayBufferViewType(tarr); > + > + MDefinition *ptr = convertShiftToMaskForStaticTypedArray(index, viewType); This function should be splitted in 2 as it add MDefinitions to the MIR Graph and it might still return NULL if it cannot. This is confusing. @@ +7056,5 @@ > + MDefinition *index, MDefinition *value) > +{ > + JS_ASSERT(*emitted == false); > + > + if (object->type() != MIRType_Magic) You also need to guard against MIRType_Value which might be a not definitively lazy argument. It was written like that in the original code. if (script()->argumentsHasVarBinding() && object->mightBeType(MIRType_Magic)) return abort("Type is not definitely lazy arguments."); So I guess we need a setElemTryMaybeArguments(…) which is testing that and returns with an abort.
Comment 12•11 years ago
|
||
Backed out in https://hg.mozilla.org/integration/mozilla-inbound/rev/f815c1dcf93f - https://tbpl.mozilla.org/php/getParsedLog.php?id=26381631&tree=Mozilla-Inbound and https://tbpl.mozilla.org/php/getParsedLog.php?id=26381604&tree=Mozilla-Inbound, mochitest-3 and dromaeo crashing in js::types::StackTypeSet::propertyNeedsBarrier.
Assignee | ||
Comment 13•11 years ago
|
||
Bug 904024 is actually why this was backed out. We don't have type information on the returned object from PropertyWriteNeedsTypeBarrier. Since this is only refactor, I'll reland by letting it behave like before the refactor. I'll improve the situation in the attached bug.
Assignee | ||
Comment 14•11 years ago
|
||
Try push to be sure the Mochitests/dromaeo issues are fixed: https://tbpl.mozilla.org/?tree=Try&rev=cf2ffdd1f9fa (In reply to Nicolas B. Pierron [:nbp] from comment #11) > Comment on attachment 788108 [details] [diff] [review] > bug903394-setelem-remove-do-while > > Review of attachment 788108 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: js/src/jit/IonBuilder.cpp > @@ +6971,5 @@ > > + > > + TypedArrayObject *tarr = &tarrObj->as<TypedArrayObject>(); > > + ArrayBufferView::ViewType viewType = JS_GetArrayBufferViewType(tarr); > > + > > + MDefinition *ptr = convertShiftToMaskForStaticTypedArray(index, viewType); > > This function should be splitted in 2 as it add MDefinitions to the MIR > Graph and it might still return NULL if it cannot. This is confusing. I think we do that all over the place. So I don't see why this should be wrong... > > @@ +7056,5 @@ > > + MDefinition *index, MDefinition *value) > > +{ > > + JS_ASSERT(*emitted == false); > > + > > + if (object->type() != MIRType_Magic) > > You also need to guard against MIRType_Value which might be a not > definitively lazy argument. > > It was written like that in the original code. > > if (script()->argumentsHasVarBinding() && > object->mightBeType(MIRType_Magic)) > return abort("Type is not definitely lazy arguments."); > > So I guess we need a setElemTryMaybeArguments(…) which is testing that and > returns with an abort. This test is still present in the refactored code. I don't see a reason to add the "setElemTryMaybeArguments" function for this, yet.
Assignee | ||
Comment 15•11 years ago
|
||
I was indeed very close. This passes jit-tests. Started already a try build so I don't have a backout with this patch: https://tbpl.mozilla.org/?tree=Try&rev=901d02accfbf
Attachment #788453 -
Attachment is obsolete: true
Attachment #788919 -
Flags: review?(jdemooij)
Comment 16•11 years ago
|
||
(In reply to Hannes Verschore [:h4writer] from comment #14) > Try push to be sure the Mochitests/dromaeo issues are fixed: > https://tbpl.mozilla.org/?tree=Try&rev=cf2ffdd1f9fa > > (In reply to Nicolas B. Pierron [:nbp] from comment #11) > > Comment on attachment 788108 [details] [diff] [review] > > bug903394-setelem-remove-do-while > > > > Review of attachment 788108 [details] [diff] [review]: > > ----------------------------------------------------------------- > > > > ::: js/src/jit/IonBuilder.cpp > > @@ +6971,5 @@ > > > + > > > + TypedArrayObject *tarr = &tarrObj->as<TypedArrayObject>(); > > > + ArrayBufferView::ViewType viewType = JS_GetArrayBufferViewType(tarr); > > > + > > > + MDefinition *ptr = convertShiftToMaskForStaticTypedArray(index, viewType); > > > > This function should be splitted in 2 as it add MDefinitions to the MIR > > Graph and it might still return NULL if it cannot. This is confusing. > > I think we do that all over the place. So I don't see why this should be > wrong... Because we do not see the pivot between not-emitted and start-emitting code. > > > > @@ +7056,5 @@ > > > + MDefinition *index, MDefinition *value) > > > +{ > > > + JS_ASSERT(*emitted == false); > > > + > > > + if (object->type() != MIRType_Magic) > > > > You also need to guard against MIRType_Value which might be a not > > definitively lazy argument. > > > > It was written like that in the original code. > > > > if (script()->argumentsHasVarBinding() && > > object->mightBeType(MIRType_Magic)) > > return abort("Type is not definitely lazy arguments."); > > > > So I guess we need a setElemTryMaybeArguments(…) which is testing that and > > returns with an abort. > > This test is still present in the refactored code. I don't see a reason to > add the "setElemTryMaybeArguments" function for this, yet. Sorry, I did not see that it remained as-is, as I expected it to be moved too.
Assignee | ||
Comment 17•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/7842d98c6d32 https://hg.mozilla.org/integration/mozilla-inbound/rev/debfceea4af3 Try push was green, re-pushing.
Comment 18•11 years ago
|
||
Comment on attachment 788919 [details] [diff] [review] bug903394-getelem-remove-do-while Review of attachment 788919 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit/IonBuilder.cpp @@ +6641,5 @@ > + > + if (obj->type() != MIRType_String) > + return true; > + > + // Emit index to a string. Nit: something like "// Emit fast path for string[index]." ::: js/src/jit/IonBuilder.h @@ +398,5 @@ > MDefinition *index, MDefinition *value); > > + // jsop_getelem() helpers. > + bool getElemTryDense(bool *emitted, MDefinition *obj, > + MDefinition *index); Style nit: all these declarations fit on one line I think, same for the .cpp file probably.
Attachment #788919 -
Flags: review?(jdemooij) → review+
Comment 19•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/7842d98c6d32 https://hg.mozilla.org/mozilla-central/rev/debfceea4af3
Assignee | ||
Comment 20•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/003dff773a2a
Whiteboard: [leave open]
Assignee | ||
Updated•11 years ago
|
Attachment #788919 -
Flags: checkin+
Comment 21•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/003dff773a2a
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in
before you can comment on or make changes to this bug.
Description
•