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

Unified Diff: test/mjsunit/eval.js

Issue 523051: Make the ResolvePossiblyDirectEval faster by avoiding the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 12 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/x64/codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/eval.js
===================================================================
--- test/mjsunit/eval.js (revision 3528)
+++ test/mjsunit/eval.js (working copy)
@@ -58,16 +58,16 @@
// Test that un-aliased eval reads from local context.
foo = 0;
-result =
+result =
(function() {
var foo = 2;
return eval('foo');
})();
assertEquals(2, result);
-//Test that un-aliased eval writes to local context.
+// Test that un-aliased eval writes to local context.
foo = 0;
-result =
+result =
(function() {
var foo = 1;
eval('foo = 2');
@@ -84,7 +84,7 @@
// Test that aliased eval reads from global context.
var e = eval;
foo = 0;
-result =
+result =
(function() {
var foo = 2;
return e('foo');
@@ -105,7 +105,7 @@
// Try to cheat the 'aliased eval' detection.
var x = this;
foo = 0;
-result =
+result =
(function() {
var foo = 2;
return x.eval('foo');
@@ -113,7 +113,7 @@
assertEquals(0, result);
foo = 0;
-result =
+result =
(function() {
var eval = function(x) { return x; };
var foo = eval(2);
@@ -128,8 +128,29 @@
})();
assertEquals(4, result);
+result =
+ (function() {
+ eval("var eval = function(s) { return this; }");
+ return eval("42"); // Should return the global object
+ })();
+assertEquals(this, result);
+
+result =
+ (function() {
+ var obj = { f: function(eval) { return eval("this"); } };
+ return obj.f(eval);
+ })();
+assertEquals(this, result);
+
+result =
+ (function() {
+ var obj = { f: function(eval) { arguments; return eval("this"); } };
+ return obj.f(eval);
+ })();
+assertEquals(this, result);
+
eval = function(x) { return 2 * x; };
-result =
+result =
(function() {
return (function() { return eval(2); })();
})();
« no previous file with comments | « src/x64/codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698