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

Unified Diff: src/runtime.cc

Issue 547553003: Harden OptimizeFunctionOnNextCall. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-411237.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index f0c5edc53b1e8947646ddac4420a27a65d8149e9..7ff15ec69ee059c572f9c2b6507c1d012078df91 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8632,7 +8632,14 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 1 || args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
-
+ // The following two assertions are lifted from the DCHECKs inside
+ // JSFunction::MarkForOptimization().
+ RUNTIME_ASSERT(!function->shared()->is_generator());
+ RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() ||
+ (function->code()->kind() == Code::FUNCTION &&
+ function->code()->optimizable()));
+
+ // If the function is optimized, just return.
if (function->IsOptimized()) return isolate->heap()->undefined_value();
function->MarkForOptimization();
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-411237.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698