Closed Bug 1103344 Opened 10 years ago Closed 9 years ago

Remove the try/catch behavior of Object.assign

Categories

(Core :: JavaScript: Standard Library, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: 446240525, Assigned: evilpie)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: [DocArea=JS])

Attachments

(1 file)

js> obj=Object("0")
(new String("0"))
js> Object.assign(obj, {0:1, 1: 1})
typein:2:0 TypeError: 0 is read-only
js> obj[1]
1 // this should be undefined

TC39 decided to remove this for performance reasons: https://twitter.com/bterlson/status/535921786525736960
Depends on: 1063921
Assignee: nobody → evilpies
Attachment #8580752 - Flags: review?(till)
Comment on attachment 8580752 [details] [diff] [review]
Object.assign should stop when an exception is thrown

Review of attachment 8580752 [details] [diff] [review]:
-----------------------------------------------------------------

Mmmmmh, so much nicer!

::: js/src/builtin/Object.js
@@ +30,4 @@
>  
> +            // Steps 5.c.i-iii. We abbreviate this by calling propertyIsEnumerable
> +            // which is faster and returns false for not defined properties.
> +            if (callFunction(std_Object_propertyIsEnumerable, from, nextKey)) {

It'd be really nice to inline std_Object_propertyIsEnumerable to substantially speed this up. Perhaps file a bug so it's at least visible?
Attachment #8580752 - Flags: review?(till) → review+
https://treeherder.mozilla.org/#/jobs?repo=try&revision=3e4f8caef1dc
https://hg.mozilla.org/integration/mozilla-inbound/rev/c279eefced07

Filed bug 1147154 for inlining propertyIsEnumerable. That was quick, even before coming back from your vacation! :)
https://hg.mozilla.org/mozilla-central/rev/c279eefced07
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: