Add MOZ_UNLIKELY to codegen argc and exception checks

RESOLVED FIXED in mozilla36

Status

()

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Ms2ger, Assigned: akshendra521994, Mentored)

Tracking

(Blocks: 1 bug)

Trunk
mozilla36
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

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

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
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++]

Comment 1

4 years ago
I want to patch this,but need some help.

Comment 2

4 years ago
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?

Comment 3

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

Comment 4

4 years ago
What is the status of this bug?
(Assignee)

Comment 5

4 years ago
Created attachment 8507854 [details] [diff] [review]
1058651.patch
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)
(Assignee)

Comment 8

4 years ago
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
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.