Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: test/mjsunit/harmony/private.js

Issue 48923002: Provide private symbols through internal APIs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Mo comments Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/mjsunit/harmony/symbols.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/private.js
diff --git a/test/mjsunit/harmony/symbols.js b/test/mjsunit/harmony/private.js
similarity index 84%
copy from test/mjsunit/harmony/symbols.js
copy to test/mjsunit/harmony/private.js
index 5eaa1a37d8c4efdfc678d90e4bda06230cc4b093..884e31ba0a2b6696ac4220e96ad5c2ab150fd58b 100644
--- a/test/mjsunit/harmony/symbols.js
+++ b/test/mjsunit/harmony/private.js
@@ -32,24 +32,12 @@ var symbols = []
// Test different forms of constructor calls, all equivalent.
function TestNew() {
- function IndirectSymbol() { return new Symbol }
- function indirect() { return new IndirectSymbol() }
for (var i = 0; i < 2; ++i) {
for (var j = 0; j < 5; ++j) {
- symbols.push(Symbol())
- symbols.push(Symbol(undefined))
- symbols.push(Symbol("66"))
- symbols.push(Symbol(66))
- symbols.push(Symbol(Symbol()))
- symbols.push((new Symbol).valueOf())
- symbols.push((new Symbol()).valueOf())
- symbols.push((new Symbol(Symbol())).valueOf())
- symbols.push(Object(Symbol()).valueOf())
- symbols.push((indirect()).valueOf())
+ symbols.push(%CreatePrivateSymbol("66"))
+ symbols.push(Object(%CreatePrivateSymbol("66")).valueOf())
}
- %OptimizeFunctionOnNextCall(indirect)
- indirect() // Call once before GC throws away type feedback.
- gc() // Promote existing symbols and then allocate some more.
+ gc() // Promote existing symbols and then allocate some more.
}
}
TestNew()
@@ -59,6 +47,7 @@ function TestType() {
for (var i in symbols) {
assertEquals("symbol", typeof symbols[i])
assertTrue(typeof symbols[i] === "symbol")
+ assertTrue(%SymbolIsPrivate(symbols[i]))
assertEquals(null, %_ClassOf(symbols[i]))
assertEquals("Symbol", %_ClassOf(new Symbol(symbols[i])))
assertEquals("Symbol", %_ClassOf(Object(symbols[i])))
@@ -68,13 +57,6 @@ TestType()
function TestPrototype() {
- assertSame(Object.prototype, Symbol.prototype.__proto__)
- assertSame(Symbol.prototype, Symbol().__proto__)
- assertSame(Symbol.prototype, Symbol(Symbol()).__proto__)
- assertSame(Symbol.prototype, (new Symbol).__proto__)
- assertSame(Symbol.prototype, (new Symbol()).__proto__)
- assertSame(Symbol.prototype, (new Symbol(Symbol())).__proto__)
- assertSame(Symbol.prototype, Object(Symbol()).__proto__)
for (var i in symbols) {
assertSame(Symbol.prototype, symbols[i].__proto__)
}
@@ -83,15 +65,6 @@ TestPrototype()
function TestConstructor() {
- assertFalse(Object === Symbol.prototype.constructor)
- assertFalse(Symbol === Object.prototype.constructor)
- assertSame(Symbol, Symbol.prototype.constructor)
- assertSame(Symbol, Symbol().__proto__.constructor)
- assertSame(Symbol, Symbol(Symbol()).__proto__.constructor)
- assertSame(Symbol, (new Symbol).__proto__.constructor)
- assertSame(Symbol, (new Symbol()).__proto__.constructor)
- assertSame(Symbol, (new Symbol(Symbol())).__proto__.constructor)
- assertSame(Symbol, Object(Symbol()).__proto__.constructor)
for (var i in symbols) {
assertSame(Symbol, symbols[i].__proto__.constructor)
}
@@ -102,7 +75,7 @@ TestConstructor()
function TestName() {
for (var i in symbols) {
var name = symbols[i].name
- assertTrue(name === undefined || name === "66")
+ assertTrue(name === "66")
}
}
TestName()
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/mjsunit/harmony/symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698