Closed Bug 1058651 Opened 5 years ago Closed 5 years ago

Add MOZ_UNLIKELY to codegen argc and exception checks

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: Ms2ger, Assigned: akshendra521994, Mentored)

References

(Blocks 1 open bug)

Details

(Whiteboard: [lang=python][lang=c++])

Attachments

(1 file)

The codegen for DOM bindings (<https://mxr.mozilla.org/mozilla-central/source/dom/bindings/Codegen.py>) generates code that includes checks on the number of arguments and checks if the native function threw an exception.

We expect that these checks are only quite rarely true, so it seems worthwhile to wrap those checks in the MOZ_UNLIKELY() macro, to potentially improve the compiled code.

For number of arguments: <https://mxr.mozilla.org/mozilla-central/source/dom/bindings/Codegen.py?rev=1a3d7ec1a840&mark=6710-6712#6707>
For exceptions: <https://mxr.mozilla.org/mozilla-central/source/dom/bindings/Codegen.py?rev=1a3d7ec1a840&mark=6156-6158#6153>
Whiteboard: [lang=python][lang=c++]
I want to patch this,but need some help.
Thanks, Mohit. The first thing to do is get your development environment set up; a good place to read how to do that is here: 

https://developer.mozilla.org/en-US/docs/Introduction

BZ, can you point to an example of where we're already using MOZ_UNLIKELY() so Mohit can get a sense of what a successful patch looks like here?
I've gone through the docs and also completed the code for firefox exercise which was a part of it and as I'm working on linux I've setup an enviroment by the help of instructions given in the docs.
What is the status of this bug?
Attached patch 1058651.patchSplinter Review
Attachment #8507854 - Flags: review?(bzbarsky)
Comment on attachment 8507854 [details] [diff] [review]
1058651.patch

I missed the part of comment 2 directed at me.  :(

r=me
Attachment #8507854 - Flags: review?(bzbarsky) → review+
Akshendra, are you able to push this to try yourself, or do you need me to do it?
Assignee: nobody → akshendra521994
Flags: needinfo?(akshendra521994)
I don't seem to have a level 1 hg account, so I cannot I suppose.
Flags: needinfo?(akshendra521994)
https://hg.mozilla.org/mozilla-central/rev/04a6548edd2b
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.