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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-411237.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 8614 matching lines...) Expand 10 before | Expand all | Expand 10 after
8625 DCHECK(args.length() == 0); 8625 DCHECK(args.length() == 0);
8626 return isolate->heap()->ToBoolean( 8626 return isolate->heap()->ToBoolean(
8627 isolate->concurrent_recompilation_enabled()); 8627 isolate->concurrent_recompilation_enabled());
8628 } 8628 }
8629 8629
8630 8630
8631 RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { 8631 RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
8632 HandleScope scope(isolate); 8632 HandleScope scope(isolate);
8633 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); 8633 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2);
8634 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8634 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8635 // The following two assertions are lifted from the DCHECKs inside
8636 // JSFunction::MarkForOptimization().
8637 RUNTIME_ASSERT(!function->shared()->is_generator());
8638 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() ||
8639 (function->code()->kind() == Code::FUNCTION &&
8640 function->code()->optimizable()));
8635 8641
8642 // If the function is optimized, just return.
8636 if (function->IsOptimized()) return isolate->heap()->undefined_value(); 8643 if (function->IsOptimized()) return isolate->heap()->undefined_value();
8637 8644
8638 function->MarkForOptimization(); 8645 function->MarkForOptimization();
8639 8646
8640 Code* unoptimized = function->shared()->code(); 8647 Code* unoptimized = function->shared()->code();
8641 if (args.length() == 2 && 8648 if (args.length() == 2 &&
8642 unoptimized->kind() == Code::FUNCTION) { 8649 unoptimized->kind() == Code::FUNCTION) {
8643 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); 8650 CONVERT_ARG_HANDLE_CHECKED(String, type, 1);
8644 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr")) && FLAG_use_osr) { 8651 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr")) && FLAG_use_osr) {
8645 // Start patching from the currently patched loop nesting level. 8652 // Start patching from the currently patched loop nesting level.
(...skipping 6994 matching lines...) Expand 10 before | Expand all | Expand 10 after
15640 } 15647 }
15641 return NULL; 15648 return NULL;
15642 } 15649 }
15643 15650
15644 15651
15645 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15652 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15646 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15653 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15647 } 15654 }
15648 15655
15649 } } // namespace v8::internal 15656 } } // namespace v8::internal
OLDNEW
« 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