Reviewers: rossberg, Toon Verwaest,

Description:
Fix issue with getOwnPropertySymbols and hidden properties

When getting the symbols of an object we need to ignore the hidden
properties of the prototype object since the hidden properties are
represented by a single string key and we will not include that hidden
string in the found names.

BUG=350864

Please review this at https://codereview.chromium.org/192883005/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+11, -15 lines):
  M src/runtime.cc
  A + test/mjsunit/regress/regress-crbug-350864.js


Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 394deceaa8e82b3ea4b08ff0c2f159fbbf330325..c50b3c459bbd7443fb3cf7aa5e53c9dabd4502e3 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -5811,7 +5811,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLocalPropertyNames) {
       }
     }
     next_copy_index += local_property_count[i];
-    if (jsproto->HasHiddenProperties()) {
+
+    // Hidden properties only show up if the filter does not skip strings.
+    if ((filter & STRING) == 0 && jsproto->HasHiddenProperties()) {
       hidden_strings++;
     }
     if (i < length - 1) {
Index: test/mjsunit/regress/regress-crbug-350864.js
diff --git a/test/mjsunit/regress/regress-333594.js b/test/mjsunit/regress/regress-crbug-350864.js
similarity index 88%
copy from test/mjsunit/regress/regress-333594.js
copy to test/mjsunit/regress/regress-crbug-350864.js
index 6f6dbaafcd64d8b752226a290df525ca200b69a0..eef3dba108206aa9da2a4aa95a7912867873c5ba 100644
--- a/test/mjsunit/regress/regress-333594.js
+++ b/test/mjsunit/regress/regress-crbug-350864.js
@@ -25,18 +25,12 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-// Flags: --allow-natives-syntax
+// Flags: --harmony_symbols --harmony-collections

-var a = { x: 1.1 };
-a.x = 0;
-var G = a.x;
-var o = { x: {} };
-
-function func() {
-  return {x: G};
-}
-
-func();
-func();
-%OptimizeFunctionOnNextCall(func);
-assertEquals(0, func().x);
+var v0 = new WeakMap;
+var v1 = {};
+v0.set(v1, 1);
+var sym = Symbol();
+v1[sym] = 1;
+var symbols = Object.getOwnPropertySymbols(v1);
+assertArrayEquals([sym], symbols);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to