Closed Bug 695171 Opened 13 years ago Closed 13 years ago

Make our operator new throw bad_alloc

Categories

(Core :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: jrmuizel, Assigned: jrmuizel)

Details

Attachments

(1 file)

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

Attachment

General

Created:
Updated:
Size: