Make our operator new throw bad_alloc

RESOLVED FIXED in mozilla10

Status

()

Core
General
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: jrmuizel, Assigned: jrmuizel)

Tracking

unspecified
mozilla10
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
Created attachment 567579 [details] [diff] [review]
add throw(std::bad_alloc)

If new doesn't throw bad_alloc the compiler emits a null check after to avoid calling the constructor. http://llvm.org/bugs/show_bug.cgi?id=10895

Adding throw(std::bad_alloc) shaves 57KB of .text off a gcc mac build. I expect it would take more off the clang build.
Attachment #567579 - Flags: review?(jones.chris.g)
I'd rename the macros since the names after this patch would just be lies.
(Assignee)

Comment 2

6 years ago
I don't see how they are more lies than before.
Attachment #567579 - Flags: review?(jones.chris.g) → review+
As promised to Jeff, I measured how much of a size change this caused with Mac.  The answer is 0.

__TEXT	__DATA	__OBJC	others	dec	hex
24739840	2547712	0	24514560	51802112	3167000	obj-ff-opt/dist/Nightly2.app/Contents/MacOS/XUL
24739840	2547712	0	24514560	51802112	3167000	obj-ff-opt/dist/Nightly.app/Contents/MacOS/XUL
(Assignee)

Comment 4

6 years ago
Fortunately, my results don't match Ehsan's.

/tmp$ size XUL-pre 
__TEXT	__DATA	__OBJC	others	dec	hex
24637440	2539520	0	24469504	51646464	3141000
/tmp$ size XUL-post 
__TEXT	__DATA	__OBJC	others	dec	hex
24576000	2539520	0	24469504	51585024	3132000

Which gives a savings of 61KB
https://hg.mozilla.org/mozilla-central/rev/2606bc44cb7c
Assignee: nobody → jmuizelaar
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in before you can comment on or make changes to this bug.