Remove the try/catch behavior of Object.assign

RESOLVED FIXED in Firefox 39

Status

()

defect
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: 446240525, Assigned: evilpie)

Tracking

(Blocks 1 bug, {dev-doc-complete})

Trunk
mozilla39
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox39 fixed)

Details

(Whiteboard: [DocArea=JS])

Attachments

(1 attachment)

Reporter

Description

5 years ago
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
Reporter

Updated

5 years ago
Depends on: 1063921
Assignee

Updated

4 years ago
Assignee: nobody → evilpies
Assignee

Updated

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

Comment 3

4 years ago
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
Last Resolved: 4 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.