<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183199] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183199">183199</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-04-23 11:44:16 -0700 (Thu, 23 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement `Object.assign`
https://bugs.webkit.org/show_bug.cgi?id=143980

Patch by Jordan Harband &lt;ljharb@gmail.com&gt; on 2015-04-23
Reviewed by Filip Pizlo.

Source/JavaScriptCore:

per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign

* builtins/ObjectConstructor.js: Added.
(assign):
* runtime/CommonIdentifiers.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/ObjectConstructor.cpp:
* runtime/ObjectConstructor.h:

LayoutTests:

* js/Object-assign-expected.txt: Added.
* js/Object-assign.html: Added.
* js/Object-getOwnPropertyNames-expected.txt:
* js/script-tests/Object-assign.js: Added.
* js/script-tests/Object-getOwnPropertyNames.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsObjectgetOwnPropertyNamesexpectedtxt">trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsObjectgetOwnPropertyNamesjs">trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCommonIdentifiersh">trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeObjectConstructorcpp">trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeObjectConstructorh">trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsObjectassignexpectedtxt">trunk/LayoutTests/js/Object-assign-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsObjectassignhtml">trunk/LayoutTests/js/Object-assign.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsObjectassignjs">trunk/LayoutTests/js/script-tests/Object-assign.js</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsObjectConstructorjs">trunk/Source/JavaScriptCore/builtins/ObjectConstructor.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (183198 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-04-23 18:41:10 UTC (rev 183198)
+++ trunk/LayoutTests/ChangeLog        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-04-23  Jordan Harband  &lt;ljharb@gmail.com&gt;
+
+        Implement `Object.assign`
+        https://bugs.webkit.org/show_bug.cgi?id=143980
+
+        Reviewed by Filip Pizlo.
+
+        * js/Object-assign-expected.txt: Added.
+        * js/Object-assign.html: Added.
+        * js/Object-getOwnPropertyNames-expected.txt:
+        * js/script-tests/Object-assign.js: Added.
+        * js/script-tests/Object-getOwnPropertyNames.js:
+
</ins><span class="cx"> 2015-04-23  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, temporarily skip http/tests/websocket/tests/hybi/stop-on-resume-in-error-handler.html on Windows.
</span></span></pre></div>
<a id="trunkLayoutTestsjsObjectassignexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/Object-assign-expected.txt (0 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/Object-assign-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/Object-assign-expected.txt        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+Test to ensure correct behavior of Object.assign
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Object.assign.length is 2
+PASS Object.assign.name is 'assign'
+check TypeError on null/undefined
+PASS Object.assign() threw exception TypeError: can't convert undefined to object.
+PASS Object.assign(undefined) threw exception TypeError: can't convert undefined to object.
+PASS Object.assign(null) threw exception TypeError: can't convert null to object.
+PASS var target = {}, ret = Object.assign(target); target === ret is true
+multiple sources are copied
+PASS var target = {}, ret = Object.assign(target, {a: 1}); target === ret is true
+PASS var target = {}; Object.assign(target, {a: 1}); target.a === 1 is true
+PASS var target = {}; Object.assign(target, {a: 1}, {b: 2}); target.b === 2 is true
+PASS var target = {}; Object.assign(target, {a: 1}, {a: 2}); target.a === 2 is true
+only enumerable properties are copied
+PASS var target = {}, source = {}; Object.defineProperty(source, 'a', { value: 1, enumerable: false }); Object.assign(target, {a: 2}, source); target.a === 2 is true
+PASS var target = {}, source = {}; Object.defineProperty(source, 'a', { value: 1, enumerable: false }); Object.assign(target, source); 'a' in target &amp;&amp; target.a === 1 is false
+PASS var target = {}, source = {}; Object.defineProperty(source, 'a', { value: 1, enumerable: false }); Object.assign(target, source, {a: 2}); target.a === 2 is true
+PASS var target = {}, source = {}; Object.defineProperty(source, 'a', { value: 1, enumerable: true }); Object.assign(target, source, {a: 2}); target.a === 2 is true
+PASS var target = {}, source = {}; Object.defineProperty(source, 'a', { value: 1, enumerable: true }); Object.assign(target, {a: 2}, source); target.a === 1 is true
+only own properties are copied
+PASS var target = {}, C = function C() {}; C.prototype.a = 1; Object.assign(target, {a: 2}, new C()); target.a === 2 is true
+Symbols are copied
+PASS var target = {}, source = {}, sym = Symbol('sym'); source[sym] = sym; Object.assign(target, source); target[sym] === sym is true
+PASS var target = {}, source1 = {}, source2 = {}, sym = Symbol('sym'); source1[sym] = 1; source2[sym] = 2; Object.assign(target, source1, source2); target[sym] === 2 is true
+non-enumerable Symbols are not copied
+PASS var target = {}, source = {}, sym = Symbol('sym'); Object.defineProperty(source, sym, { value: 1, enumerable: false }); Object.assign(target, source); target[sym] is undefined.
+only own Symbols are copied
+PASS var target = {}, source1 = {}, sym = Symbol('sym'), C = function C() {}; C.prototype[sym] = 1; source1[sym] = 2; Object.assign(target, source1, new C()); target[sym] === 2 is true
+primitives as sources
+PASS var target = {}; Object.assign(target, true); Object.getOwnPropertyNames(target).length === 0 is true
+PASS var target = {}; Object.assign(target, false); Object.getOwnPropertyNames(target).length === 0 is true
+PASS var target = {}; Object.assign(target, NaN); Object.getOwnPropertyNames(target).length === 0 is true
+PASS var target = {}; Object.assign(target, Infinity); Object.getOwnPropertyNames(target).length === 0 is true
+PASS var target = {}; Object.assign(target, -Infinity); Object.getOwnPropertyNames(target).length === 0 is true
+PASS var target = {}; Object.assign(target, 0); Object.getOwnPropertyNames(target).length === 0 is true
+PASS var target = {}; Object.assign(target, -0); Object.getOwnPropertyNames(target).length === 0 is true
+PASS var target = {}; Object.assign(target, Symbol('sym')); Object.getOwnPropertyNames(target).length === 0 is true
+PASS var target = {}; Object.assign(target, ''); Object.getOwnPropertyNames(target).length === 0 is true
+PASS var target = {}; Object.assign(target, 'abc'); Object.getOwnPropertyNames(target).length === 'abc'.length is true
+primitives as target
+PASS var target = Object.assign(true, { a: 1 }); isBoxedPrimitive(target, Boolean, true) &amp;&amp; target.a === 1 is true
+PASS var target = Object.assign(false, { a: 1 }); isBoxedPrimitive(target, Boolean, false) &amp;&amp; target.a === 1 is true
+PASS var target = Object.assign(NaN, { a: 1 }); isBoxedPrimitive(target, Number, NaN) &amp;&amp; target.a === 1 is true
+PASS var target = Object.assign(Infinity, { a: 1 }); isBoxedPrimitive(target, Number, Infinity) &amp;&amp; target.a === 1 is true
+PASS var target = Object.assign(-Infinity, { a: 1 }); isBoxedPrimitive(target, Number, -Infinity) &amp;&amp; target.a === 1 is true
+PASS var target = Object.assign(0, { a: 1 }); isBoxedPrimitive(target, Number, 0) &amp;&amp; target.a === 1 is true
+PASS var target = Object.assign(-0, { a: 1 }); isBoxedPrimitive(target, Number, -0) &amp;&amp; target.a === 1 is true
+PASS var sym = Symbol('sym'); var target = Object.assign(sym, { a: 1 }); isBoxedPrimitive(target, Symbol, sym) &amp;&amp; target.a === 1 is true
+PASS var target = Object.assign('', { a: 1 }); isBoxedPrimitive(target, String, '') &amp;&amp; target.a === 1 is true
+PASS var target = Object.assign('abc', { a: 1 }); isBoxedPrimitive(target, String, 'abc') &amp;&amp; target.a === 1 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsObjectassignhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/Object-assign.html (0 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/Object-assign.html                                (rev 0)
+++ trunk/LayoutTests/js/Object-assign.html        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/Object-assign.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsObjectgetOwnPropertyNamesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt (183198 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt        2015-04-23 18:41:10 UTC (rev 183198)
+++ trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> PASS getSortedOwnPropertyNames(decodeURIComponent) is ['length', 'name']
</span><span class="cx"> PASS getSortedOwnPropertyNames(encodeURI) is ['length', 'name']
</span><span class="cx"> PASS getSortedOwnPropertyNames(encodeURIComponent) is ['length', 'name']
</span><del>-PASS getSortedOwnPropertyNames(Object) is ['create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal']
</del><ins>+PASS getSortedOwnPropertyNames(Object) is ['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal']
</ins><span class="cx"> PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']
</span><span class="cx"> PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype']
</span><span class="cx"> PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsObjectassignjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/Object-assign.js (0 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/Object-assign.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/Object-assign.js        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+description(&quot;Test to ensure correct behavior of Object.assign&quot;);
+
+shouldBe(&quot;Object.assign.length&quot;, &quot;2&quot;);
+shouldBe(&quot;Object.assign.name&quot;, &quot;'assign'&quot;);
+
+debug(&quot;check TypeError on null/undefined&quot;);
+shouldThrow(&quot;Object.assign()&quot;);
+shouldThrow(&quot;Object.assign(undefined)&quot;);
+shouldThrow(&quot;Object.assign(null)&quot;);
+
+shouldBeTrue(&quot;var target = {}, ret = Object.assign(target); target === ret&quot;);
+
+debug(&quot;multiple sources are copied&quot;);
+shouldBeTrue(&quot;var target = {}, ret = Object.assign(target, {a: 1}); target === ret&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, {a: 1}); target.a === 1&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, {a: 1}, {b: 2}); target.b === 2&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, {a: 1}, {a: 2}); target.a === 2&quot;);
+
+debug(&quot;only enumerable properties are copied&quot;);
+shouldBeTrue(&quot;var target = {}, source = {}; Object.defineProperty(source, 'a', { value: 1, enumerable: false }); Object.assign(target, {a: 2}, source); target.a === 2&quot;);
+shouldBeFalse(&quot;var target = {}, source = {}; Object.defineProperty(source, 'a', { value: 1, enumerable: false }); Object.assign(target, source); 'a' in target &amp;&amp; target.a === 1&quot;);
+shouldBeTrue(&quot;var target = {}, source = {}; Object.defineProperty(source, 'a', { value: 1, enumerable: false }); Object.assign(target, source, {a: 2}); target.a === 2&quot;);
+shouldBeTrue(&quot;var target = {}, source = {}; Object.defineProperty(source, 'a', { value: 1, enumerable: true }); Object.assign(target, source, {a: 2}); target.a === 2&quot;);
+shouldBeTrue(&quot;var target = {}, source = {}; Object.defineProperty(source, 'a', { value: 1, enumerable: true }); Object.assign(target, {a: 2}, source); target.a === 1&quot;);
+
+debug(&quot;only own properties are copied&quot;);
+shouldBeTrue(&quot;var target = {}, C = function C() {}; C.prototype.a = 1; Object.assign(target, {a: 2}, new C()); target.a === 2&quot;);
+
+debug(&quot;Symbols are copied&quot;);
+shouldBeTrue(&quot;var target = {}, source = {}, sym = Symbol('sym'); source[sym] = sym; Object.assign(target, source); target[sym] === sym&quot;);
+shouldBeTrue(&quot;var target = {}, source1 = {}, source2 = {}, sym = Symbol('sym'); source1[sym] = 1; source2[sym] = 2; Object.assign(target, source1, source2); target[sym] === 2&quot;);
+
+debug(&quot;non-enumerable Symbols are not copied&quot;);
+shouldBeUndefined(&quot;var target = {}, source = {}, sym = Symbol('sym'); Object.defineProperty(source, sym, { value: 1, enumerable: false }); Object.assign(target, source); target[sym]&quot;);
+
+debug(&quot;only own Symbols are copied&quot;);
+shouldBeTrue(&quot;var target = {}, source1 = {}, sym = Symbol('sym'), C = function C() {}; C.prototype[sym] = 1; source1[sym] = 2; Object.assign(target, source1, new C()); target[sym] === 2&quot;);
+
+debug(&quot;primitives as sources&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, true); Object.getOwnPropertyNames(target).length === 0&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, false); Object.getOwnPropertyNames(target).length === 0&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, NaN); Object.getOwnPropertyNames(target).length === 0&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, Infinity); Object.getOwnPropertyNames(target).length === 0&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, -Infinity); Object.getOwnPropertyNames(target).length === 0&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, 0); Object.getOwnPropertyNames(target).length === 0&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, -0); Object.getOwnPropertyNames(target).length === 0&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, Symbol('sym')); Object.getOwnPropertyNames(target).length === 0&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, ''); Object.getOwnPropertyNames(target).length === 0&quot;);
+shouldBeTrue(&quot;var target = {}; Object.assign(target, 'abc'); Object.getOwnPropertyNames(target).length === 'abc'.length&quot;);
+
+debug(&quot;primitives as target&quot;);
+var is = function (a, b) {
+  if (a !== a &amp;&amp; b !== b) {
+    return true;
+  } else if (a === 0) {
+    return a / 1 === b / 1;
+  } else {
+    return a === b;
+  }
+};
+var isBoxedPrimitive = function isBoxedPrimitive(object, Wrapper, primitive) {
+  return object instanceof Wrapper &amp;&amp; is(Wrapper.prototype.valueOf.call(object), primitive);
+};
+shouldBeTrue(&quot;var target = Object.assign(true, { a: 1 }); isBoxedPrimitive(target, Boolean, true) &amp;&amp; target.a === 1&quot;);
+shouldBeTrue(&quot;var target = Object.assign(false, { a: 1 }); isBoxedPrimitive(target, Boolean, false) &amp;&amp; target.a === 1&quot;);
+shouldBeTrue(&quot;var target = Object.assign(NaN, { a: 1 }); isBoxedPrimitive(target, Number, NaN) &amp;&amp; target.a === 1&quot;);
+shouldBeTrue(&quot;var target = Object.assign(Infinity, { a: 1 }); isBoxedPrimitive(target, Number, Infinity) &amp;&amp; target.a === 1&quot;);
+shouldBeTrue(&quot;var target = Object.assign(-Infinity, { a: 1 }); isBoxedPrimitive(target, Number, -Infinity) &amp;&amp; target.a === 1&quot;);
+shouldBeTrue(&quot;var target = Object.assign(0, { a: 1 }); isBoxedPrimitive(target, Number, 0) &amp;&amp; target.a === 1&quot;);
+shouldBeTrue(&quot;var target = Object.assign(-0, { a: 1 }); isBoxedPrimitive(target, Number, -0) &amp;&amp; target.a === 1&quot;);
+shouldBeTrue(&quot;var sym = Symbol('sym'); var target = Object.assign(sym, { a: 1 }); isBoxedPrimitive(target, Symbol, sym) &amp;&amp; target.a === 1&quot;);
+shouldBeTrue(&quot;var target = Object.assign('', { a: 1 }); isBoxedPrimitive(target, String, '') &amp;&amp; target.a === 1&quot;);
+shouldBeTrue(&quot;var target = Object.assign('abc', { a: 1 }); isBoxedPrimitive(target, String, 'abc') &amp;&amp; target.a === 1&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsObjectgetOwnPropertyNamesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js (183198 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js        2015-04-23 18:41:10 UTC (rev 183198)
+++ trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">     &quot;encodeURI&quot;: &quot;['length', 'name']&quot;,
</span><span class="cx">     &quot;encodeURIComponent&quot;: &quot;['length', 'name']&quot;,
</span><span class="cx"> // Built-in ECMA objects
</span><del>-    &quot;Object&quot;: &quot;['create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal']&quot;,
</del><ins>+    &quot;Object&quot;: &quot;['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal']&quot;,
</ins><span class="cx">     &quot;Object.prototype&quot;: &quot;['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']&quot;,
</span><span class="cx">     &quot;Function&quot;: &quot;['length', 'name', 'prototype']&quot;,
</span><span class="cx">     &quot;Function.prototype&quot;: &quot;['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']&quot;,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (183198 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2015-04-23 18:41:10 UTC (rev 183198)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -1229,3 +1229,4 @@
</span><span class="cx"> if (ENABLE_FTL_JIT)
</span><span class="cx">     add_dependencies(JavaScriptCore llvmForJSC)
</span><span class="cx"> endif ()
</span><ins>+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (183198 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-04-23 18:41:10 UTC (rev 183198)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2015-04-23  Jordan Harband  &lt;ljharb@gmail.com&gt;
+
+        Implement `Object.assign`
+        https://bugs.webkit.org/show_bug.cgi?id=143980
+
+        Reviewed by Filip Pizlo.
+
+        per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
+
+        * builtins/ObjectConstructor.js: Added.
+        (assign):
+        * runtime/CommonIdentifiers.h:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        * runtime/ObjectConstructor.cpp:
+        * runtime/ObjectConstructor.h:
+
</ins><span class="cx"> 2015-04-22  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, fix debug build.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsObjectConstructorjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/builtins/ObjectConstructor.js (0 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/ObjectConstructor.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/builtins/ObjectConstructor.js        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2015 Jordan Harband. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function assign(target/*[*/, /*...*/sources/*] */) {
+    &quot;use strict&quot;;
+
+    if (target == null)
+        throw new @TypeError(&quot;can't convert &quot; + target + &quot; to object&quot;);
+
+    var objTarget = @Object(target);
+    var s, nextSource, from, i, keys, nextKey, desc;
+    for (s = 1; s &lt; arguments.length; ++s) {
+        nextSource = arguments[s];
+        if (nextSource != null) {
+            from = @Object(nextSource);
+            // TODO: replace @objectKeys + @objectGetOwnPropertySymbols with single @OwnPropertyKeys c++ operation
+            keys = @objectKeys(from);
+            for (i = 0; i &lt; keys.length; ++i) {
+                nextKey = keys[i];
+                desc = @objectGetOwnPropertyDescriptor(from, nextKey);
+                if (typeof desc !== &quot;undefined&quot; &amp;&amp; desc.enumerable) {
+                    objTarget[nextKey] = from[nextKey];
+                }
+            }
+            keys = @objectGetOwnPropertySymbols(from);
+            for (i = 0; i &lt; keys.length; ++i) {
+                nextKey = keys[i];
+                desc = @objectGetOwnPropertyDescriptor(from, nextKey);
+                if (typeof desc !== &quot;undefined&quot; &amp;&amp; desc.enumerable) {
+                    objTarget[nextKey] = from[nextKey];
+                }
+            }
+        }
+    }
+    return objTarget;
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCommonIdentifiersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h (183198 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2015-04-23 18:41:10 UTC (rev 183198)
+++ trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -264,6 +264,9 @@
</span><span class="cx">     macro(deferred) \
</span><span class="cx">     macro(countdownHolder) \
</span><span class="cx">     macro(Object) \
</span><ins>+    macro(objectKeys) \
+    macro(objectGetOwnPropertyDescriptor) \
+    macro(objectGetOwnPropertySymbols) \
</ins><span class="cx">     macro(Number) \
</span><span class="cx">     macro(Array) \
</span><span class="cx">     macro(abs) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (183198 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2015-04-23 18:41:10 UTC (rev 183198)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -428,12 +428,19 @@
</span><span class="cx">     JSFunction* privateFuncFloor = JSFunction::create(vm, this, 0, String(), globalPrivateFuncFloor);
</span><span class="cx">     JSFunction* privateFuncIsFinite = JSFunction::create(vm, this, 0, String(), globalFuncIsFinite);
</span><span class="cx"> 
</span><ins>+    JSFunction* privateFuncObjectKeys = JSFunction::create(vm, this, 0, String(), objectConstructorKeys);
+    JSFunction* privateFuncObjectGetOwnPropertyDescriptor = JSFunction::create(vm, this, 0, String(), objectConstructorGetOwnPropertyDescriptor);
+    JSFunction* privateFuncObjectGetOwnPropertySymbols = JSFunction::create(vm, this, 0, String(), objectConstructorGetOwnPropertySymbols);
+
</ins><span class="cx">     GlobalPropertyInfo staticGlobals[] = {
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;NaN, jsNaN(), DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;Infinity, jsNumber(std::numeric_limits&lt;double&gt;::infinity()), DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;undefinedKeyword, jsUndefined(), DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;undefinedPrivateName, jsUndefined(), DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;ObjectPrivateName, objectConstructor, DontEnum | DontDelete | ReadOnly),
</span><ins>+        GlobalPropertyInfo(vm.propertyNames-&gt;objectKeysPrivateName, privateFuncObjectKeys, DontEnum | DontDelete | ReadOnly),
+        GlobalPropertyInfo(vm.propertyNames-&gt;objectGetOwnPropertyDescriptorPrivateName, privateFuncObjectGetOwnPropertyDescriptor, DontEnum | DontDelete | ReadOnly),
+        GlobalPropertyInfo(vm.propertyNames-&gt;objectGetOwnPropertySymbolsPrivateName, privateFuncObjectGetOwnPropertySymbols, DontEnum | DontDelete | ReadOnly),
</ins><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;TypeErrorPrivateName, m_typeErrorConstructor.get(), DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;BuiltinLogPrivateName, builtinLog, DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;ArrayPrivateName, arrayConstructor, DontEnum | DontDelete | ReadOnly),
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeObjectConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp (183198 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp        2015-04-23 18:41:10 UTC (rev 183198)
+++ trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -39,10 +39,7 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*);
</span><del>-EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*);
</del><span class="cx"> EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*);
</span><del>-EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertySymbols(ExecState*);
-EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState*);
</del><span class="cx"> EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*);
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*);
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState*);
</span><span class="lines">@@ -80,6 +77,7 @@
</span><span class="cx">   isFrozen                  objectConstructorIsFrozen                   DontEnum|Function 1
</span><span class="cx">   isExtensible              objectConstructorIsExtensible               DontEnum|Function 1
</span><span class="cx">   is                        objectConstructorIs                         DontEnum|Function 2
</span><ins>+  assign                    objectConstructorAssign                     DontEnum|Function 2
</ins><span class="cx"> @end
</span><span class="cx"> */
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeObjectConstructorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h (183198 => 183199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h        2015-04-23 18:41:10 UTC (rev 183198)
+++ trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h        2015-04-23 18:44:16 UTC (rev 183199)
</span><span class="lines">@@ -27,6 +27,10 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*);
+EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertySymbols(ExecState*);
+EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState*);
+
</ins><span class="cx"> class ObjectPrototype;
</span><span class="cx"> 
</span><span class="cx"> class ObjectConstructor : public InternalFunction {
</span></span></pre>
</div>
</div>

</body>
</html>