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

Unified Diff: test/mjsunit/global.js

Issue 1378323003: [runtime-object]: part fix element key list on global object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months 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
« src/runtime/runtime-object.cc ('K') | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/global.js
diff --git a/test/mjsunit/compiler/control-flow-1.js b/test/mjsunit/global.js
similarity index 54%
copy from test/mjsunit/compiler/control-flow-1.js
copy to test/mjsunit/global.js
index ca7ad8785017200dc3b37b26f0bd95b896846185..05e8453bab2543ca3a383fa2c5e50fce9598d3c0 100644
--- a/test/mjsunit/compiler/control-flow-1.js
+++ b/test/mjsunit/global.js
@@ -24,32 +24,45 @@
// 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.
-
+//
var global = this;
-function f0(x) {
- assertTrue(this === global);
- return x;
-}
-
-function g0(x, y) {
- return f0(x == y);
+function testNamedProperty(key, value) {
+ global[key] = value;
+ assertTrue(global.hasOwnProperty(key));
+ assertTrue(-1 < Object.keys(global).indexOf(key));
+ assertTrue(-1 < Object.getOwnPropertyNames(global).indexOf(key));
+ assertTrue(-1 == Object.getOwnPropertySymbols(global).indexOf(key));
}
-assertTrue(g0(0, 0));
-assertFalse(g0(0, 1));
-
+testNamedProperty('property0', 'value');
+testNamedProperty('0property', 'value');
+testNamedProperty('42', 'value');
-var o = {};
-o.f1 = f1;
-function f1(x) {
- assertTrue(this === o);
- return x;
+function testNamedNonEnumerableProperty(key, value) {
+ Object.defineProperty(global, key, {
+ enumerable: false,
+ value: value
+ });
+ assertTrue(global.hasOwnProperty(key));
+ assertTrue(-1 == Object.keys(global).indexOf(key));
+ assertTrue(-1 < Object.getOwnPropertyNames(global).indexOf(key));
+ assertTrue(-1 == Object.getOwnPropertySymbols(global).indexOf(key));
}
-function g1(x, y) {
- return o.f1(x == y);
+testNamedNonEnumerableProperty('property1', 'value');
+testNamedNonEnumerableProperty('1property', 'value');
+testNamedNonEnumerableProperty('43', 'value');
+
+function testSymbolProperty(key, value) {
+ key = Symbol(key);
+ global[key] = value;
+ assertTrue(global.hasOwnProperty(key));
+ assertTrue(-1 == Object.keys(global).indexOf(key));
+ assertTrue(-1 == Object.getOwnPropertyNames(global).indexOf(key));
+ assertTrue(-1 < Object.getOwnPropertySymbols(global).indexOf(key));
}
-assertTrue(g1(0, 0));
-assertFalse(g1(0, 1));
+testSymbolProperty('property2', 'value');
+testSymbolProperty('2property', 'value');
+testSymbolProperty('43', 'value');
« src/runtime/runtime-object.cc ('K') | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698