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

Unified Diff: test/cctest/test-inobject-slack-tracking.cc

Issue 2651523002: [ast] Count index keys in AST not runtime. (Closed)
Patch Set: Treat getters with numbers as their name correctly. Created 3 years, 11 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
« no previous file with comments | « src/runtime/runtime-literals.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-inobject-slack-tracking.cc
diff --git a/test/cctest/test-inobject-slack-tracking.cc b/test/cctest/test-inobject-slack-tracking.cc
index 23e12e7249e513456827b516670fd4e44c8fbc75..650770e0553d3b0d162981499343e971734fbf83 100644
--- a/test/cctest/test-inobject-slack-tracking.cc
+++ b/test/cctest/test-inobject-slack-tracking.cc
@@ -753,13 +753,14 @@ TEST(ObjectLiteralPropertyBackingStoreSize) {
// Avoid over-/under-allocation for computed property names.
os << "(function() {\n"
+ " 'use strict';\n"
" function f(x) {\n"
" var o = {\n"
" 1: 42,\n" // Do not allocate for index key.
" '2': 42,\n" // Do not allocate for index key.
" [x]: 42,\n" // Allocate for property with computed name.
- " 3: 42\n" // Allocate for index key because we have seen a
- // computed property.
+ " 3: 42,\n" // Do not allocate for index key.
+ " '4': 42\n" // Do not allocate for index key.
" };\n"
" return o;\n"
" }\n"
@@ -768,7 +769,26 @@ TEST(ObjectLiteralPropertyBackingStoreSize) {
"\n"
" return f(x);\n"
"} )();";
- CheckExpectedProperties(2, os);
+ CheckExpectedProperties(1, os);
+
+ // Conversion to index key.
+ os << "(function() {\n"
+ " function f(x) {\n"
+ " var o = {\n"
+ " 1: 42,\n" // Do not allocate for index key.
+ " '2': 42,\n" // Do not allocate for index key.
+ " [x]: 42,\n" // Allocate for property with computed name.
+ " 3: 42,\n" // Do not allocate for index key.
+ " get 12() {}\n" // Do not allocate for index key.
+ " };\n"
+ " return o;\n"
+ " }\n"
+ "\n"
+ " var x = 'hello'\n"
+ "\n"
+ " return f(x);\n"
+ "} )();";
+ CheckExpectedProperties(1, os);
os << "(function() {\n"
" function f() {\n"
« no previous file with comments | « src/runtime/runtime-literals.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698