Reviewers: arv, Michael Starzinger,
Message:
Please advised this is a very early draft. Erik, it would be great if you
can
point me in the right direction.
Description:
For Micro-benchmarks for 'with'
[email protected], [email protected]
BUG=v8:4131
Please review this at https://codereview.chromium.org/1153363002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+83, -2 lines):
M test/js-perf-test/JSTests.json
A + test/js-perf-test/PreES6/run.js
A test/js-perf-test/PreES6/with.js
Index: test/js-perf-test/JSTests.json
diff --git a/test/js-perf-test/JSTests.json b/test/js-perf-test/JSTests.json
index
b71257b8d2871dea0dfbd705918b81b2dc3d5389..0dc5ce2dffaba69f56c75909987fc94281e03bf3
100644
--- a/test/js-perf-test/JSTests.json
+++ b/test/js-perf-test/JSTests.json
@@ -106,6 +106,17 @@
"tests": [
{"name": "Assign"}
]
+ },
+ {
+ "name": "PreES6",
+ "path": ["PreES6"],
+ "main": "run.js",
+ "resources": ["with.js"],
+ "flags": ["--turbo"],
+ "results_regexp": "^%s\\-PreES6\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "With"}
+ ]
}
]
}
Index: test/js-perf-test/PreES6/run.js
diff --git a/test/js-perf-test/Object/run.js
b/test/js-perf-test/PreES6/run.js
similarity index 89%
copy from test/js-perf-test/Object/run.js
copy to test/js-perf-test/PreES6/run.js
index
15c31ba08db6a5cd59c5ebc68498e9b024c2f91e..96d38ef050ffdeca63ab30ffe4aa9b4b71db706a
100644
--- a/test/js-perf-test/Object/run.js
+++ b/test/js-perf-test/PreES6/run.js
@@ -4,12 +4,12 @@
load('../base.js');
-load('assign.js');
+load('with.js');
var success = true;
function PrintResult(name, result) {
- print(name + '-Object(Score): ' + result);
+ print(name + '-PreES6(Score): ' + result);
}
Index: test/js-perf-test/PreES6/with.js
diff --git a/test/js-perf-test/PreES6/with.js
b/test/js-perf-test/PreES6/with.js
new file mode 100644
index
0000000000000000000000000000000000000000..203e8944d02fdc2533e0419c40fac853c1352a6c
--- /dev/null
+++ b/test/js-perf-test/PreES6/with.js
@@ -0,0 +1,70 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+new BenchmarkSuite('With', [1000], [
+ new Benchmark('AccessOnSameLevel', false, false, 0,
+ AccessOnSameLevel, AccessOnSameLevelSetup,
+ AccessOnSameLevelTearDown),
+ new Benchmark('AccessOverPrototypeChain', false, false, 0,
+ AccessOverPrototypeChainSetup,
AccessOverPrototypeChainSetup,
+ AccessOverPrototypeChainTearDown),
+ new Benchmark('CompetingScope', false, false, 0,
+ CompetingScope, CompetingScopeSetup,
CompetingScopeTearDown)
+]);
+
+var objectUnderTest;
+var objectUnderTestExtended;
+var resultStore;
+var VALUE_OF_PROPERTY = "Simply a string";
+
+//
----------------------------------------------------------------------------
+
+function AccessOnSameLevelSetup() {
+ objectUnderTest = {"First": VALUE_OF_PROPERTY};
+}
+
+function AccessOnSameLevel() {
+ with(objectUnderTest) {
+ resultStore = First;
+ }
+}
+
+function AccessOnSameLevelTearDown() {
+ return objectUnderTest.First === resultStore;
+}
+
+//
----------------------------------------------------------------------------
+
+function AccessOverPrototypeChainSetup() {
+ objectUnderTest = {"First": VALUE_OF_PROPERTY};
+ objectUnderTestExtended = Object.create(objectUnderTest);
+ objectUnderTestExtended.Second = "Another string";
+}
+
+function AccessOverPrototypeChain() {
+ with(objectUnderTestExtended) {
+ resultStore = First;
+ }
+}
+
+function AccessOverPrototypeChainTearDown() {
+ return objectUnderTest.First === resultStore;
+}
+
+//
----------------------------------------------------------------------------
+
+function CompetingScopeSetup() {
+ objectUnderTest = {"First": VALUE_OF_PROPERTY};
+}
+
+function CompetingScope() {
+ var First = "Not correct";
+ with(objectUnderTest) {
+ resultStore = First;
+ }
+}
+
+function CompetingScopeTearDown() {
+ return objectUnderTest.First === resultStore;
+}
--
--
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.