Reviewers: mvstanton,

Description:
Cache optimization status getter in mjsunit.js

[email protected]

Please review this at https://codereview.chromium.org/300003007/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+11, -4 lines):
  M test/mjsunit/mjsunit.js


Index: test/mjsunit/mjsunit.js
diff --git a/test/mjsunit/mjsunit.js b/test/mjsunit/mjsunit.js
index a5f65e24e75cc6279a3650407134ab493fea85bc..121b7e0a0e2043952017a02759706806bddaaf4d 100644
--- a/test/mjsunit/mjsunit.js
+++ b/test/mjsunit/mjsunit.js
@@ -371,11 +371,18 @@ var assertUnoptimized;
     throw new MjsUnitAssertionError(message);
   };

+  var OptimizationStatusImpl = undefined;
+
   var OptimizationStatus = function(fun, sync_opt) {
-    try {
-      return eval("%GetOptimizationStatus(fun, sync_opt);");
-    } catch (e) {
-      throw new Error("natives syntax not allowed");
+    if (OptimizationStatusImpl === undefined) {
+      try {
+        OptimizationStatusImpl = new Function(
+            "fun", "sync", "return %GetOptimizationStatus(fun, sync);");
+      } catch (e) {
+        throw new Error("natives syntax not allowed");
+      }
+    } else {
+      OptimizationStatusImpl(fun, sync_opt);
     }
   }



--
--
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.

Reply via email to