Commit 186dd69b authored by arv's avatar arv Committed by Commit bot

[es6] Fix length property of collection constructors

{Map, Set, WeakMap, WeakSet}.length should be 0.

BUG=v8:4021
LOG=N
R=adamk@chromium.org

Review URL: https://codereview.chromium.org/1073233002

Cr-Commit-Position: refs/heads/master@{#27798}
parent 3118df23
...@@ -236,6 +236,7 @@ function SetForEach(f, receiver) { ...@@ -236,6 +236,7 @@ function SetForEach(f, receiver) {
%SetCode($Set, SetConstructor); %SetCode($Set, SetConstructor);
%FunctionSetLength($Set, 0);
%FunctionSetPrototype($Set, new $Object()); %FunctionSetPrototype($Set, new $Object());
%AddNamedProperty($Set.prototype, "constructor", $Set, DONT_ENUM); %AddNamedProperty($Set.prototype, "constructor", $Set, DONT_ENUM);
%AddNamedProperty( %AddNamedProperty(
...@@ -424,6 +425,7 @@ function MapForEach(f, receiver) { ...@@ -424,6 +425,7 @@ function MapForEach(f, receiver) {
%SetCode($Map, MapConstructor); %SetCode($Map, MapConstructor);
%FunctionSetLength($Map, 0);
%FunctionSetPrototype($Map, new $Object()); %FunctionSetPrototype($Map, new $Object());
%AddNamedProperty($Map.prototype, "constructor", $Map, DONT_ENUM); %AddNamedProperty($Map.prototype, "constructor", $Map, DONT_ENUM);
%AddNamedProperty( %AddNamedProperty(
......
...@@ -85,6 +85,7 @@ function SetUpWeakMap() { ...@@ -85,6 +85,7 @@ function SetUpWeakMap() {
%CheckIsBootstrapping(); %CheckIsBootstrapping();
%SetCode($WeakMap, WeakMapConstructor); %SetCode($WeakMap, WeakMapConstructor);
%FunctionSetLength($WeakMap, 0);
%FunctionSetPrototype($WeakMap, new $Object()); %FunctionSetPrototype($WeakMap, new $Object());
%AddNamedProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM); %AddNamedProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM);
%AddNamedProperty( %AddNamedProperty(
...@@ -162,6 +163,7 @@ function SetUpWeakSet() { ...@@ -162,6 +163,7 @@ function SetUpWeakSet() {
%CheckIsBootstrapping(); %CheckIsBootstrapping();
%SetCode($WeakSet, WeakSetConstructor); %SetCode($WeakSet, WeakSetConstructor);
%FunctionSetLength($WeakSet, 0);
%FunctionSetPrototype($WeakSet, new $Object()); %FunctionSetPrototype($WeakSet, new $Object());
%AddNamedProperty($WeakSet.prototype, "constructor", $WeakSet, DONT_ENUM); %AddNamedProperty($WeakSet.prototype, "constructor", $WeakSet, DONT_ENUM);
%AddNamedProperty( %AddNamedProperty(
......
...@@ -346,7 +346,7 @@ function TestConstructor(C) { ...@@ -346,7 +346,7 @@ function TestConstructor(C) {
assertFalse(C === Object.prototype.constructor); assertFalse(C === Object.prototype.constructor);
assertSame(C, C.prototype.constructor); assertSame(C, C.prototype.constructor);
assertSame(C, (new C).__proto__.constructor); assertSame(C, (new C).__proto__.constructor);
assertEquals(1, C.length); assertEquals(0, C.length);
} }
TestConstructor(Set); TestConstructor(Set);
TestConstructor(Map); TestConstructor(Map);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment