OLD | NEW |
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 "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "accessors.h" | 10 #include "accessors.h" |
(...skipping 8598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8609 function->MarkForOptimization(); | 8609 function->MarkForOptimization(); |
8610 | 8610 |
8611 Code* unoptimized = function->shared()->code(); | 8611 Code* unoptimized = function->shared()->code(); |
8612 if (args.length() == 2 && | 8612 if (args.length() == 2 && |
8613 unoptimized->kind() == Code::FUNCTION) { | 8613 unoptimized->kind() == Code::FUNCTION) { |
8614 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); | 8614 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
8615 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) { | 8615 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) { |
8616 // Start patching from the currently patched loop nesting level. | 8616 // Start patching from the currently patched loop nesting level. |
8617 int current_level = unoptimized->allow_osr_at_loop_nesting_level(); | 8617 int current_level = unoptimized->allow_osr_at_loop_nesting_level(); |
8618 ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level)); | 8618 ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level)); |
8619 for (int i = current_level + 1; i <= Code::kMaxLoopNestingMarker; i++) { | 8619 if (FLAG_use_osr) { |
8620 unoptimized->set_allow_osr_at_loop_nesting_level(i); | 8620 for (int i = current_level + 1; i <= Code::kMaxLoopNestingMarker; i++) { |
8621 isolate->runtime_profiler()->AttemptOnStackReplacement(*function); | 8621 unoptimized->set_allow_osr_at_loop_nesting_level(i); |
| 8622 isolate->runtime_profiler()->AttemptOnStackReplacement(*function); |
| 8623 } |
8622 } | 8624 } |
8623 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("concurrent")) && | 8625 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("concurrent")) && |
8624 isolate->concurrent_recompilation_enabled()) { | 8626 isolate->concurrent_recompilation_enabled()) { |
8625 function->MarkForConcurrentOptimization(); | 8627 function->MarkForConcurrentOptimization(); |
8626 } | 8628 } |
8627 } | 8629 } |
8628 | 8630 |
8629 return isolate->heap()->undefined_value(); | 8631 return isolate->heap()->undefined_value(); |
8630 } | 8632 } |
8631 | 8633 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8712 | 8714 |
8713 RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) { | 8715 RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) { |
8714 HandleScope scope(isolate); | 8716 HandleScope scope(isolate); |
8715 ASSERT(args.length() == 1); | 8717 ASSERT(args.length() == 1); |
8716 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8718 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8717 Handle<Code> caller_code(function->shared()->code()); | 8719 Handle<Code> caller_code(function->shared()->code()); |
8718 | 8720 |
8719 // We're not prepared to handle a function with arguments object. | 8721 // We're not prepared to handle a function with arguments object. |
8720 ASSERT(!function->shared()->uses_arguments()); | 8722 ASSERT(!function->shared()->uses_arguments()); |
8721 | 8723 |
| 8724 RUNTIME_ASSERT(FLAG_use_osr); |
| 8725 |
8722 // Passing the PC in the javascript frame from the caller directly is | 8726 // Passing the PC in the javascript frame from the caller directly is |
8723 // not GC safe, so we walk the stack to get it. | 8727 // not GC safe, so we walk the stack to get it. |
8724 JavaScriptFrameIterator it(isolate); | 8728 JavaScriptFrameIterator it(isolate); |
8725 JavaScriptFrame* frame = it.frame(); | 8729 JavaScriptFrame* frame = it.frame(); |
8726 if (!caller_code->contains(frame->pc())) { | 8730 if (!caller_code->contains(frame->pc())) { |
8727 // Code on the stack may not be the code object referenced by the shared | 8731 // Code on the stack may not be the code object referenced by the shared |
8728 // function info. It may have been replaced to include deoptimization data. | 8732 // function info. It may have been replaced to include deoptimization data. |
8729 caller_code = Handle<Code>(frame->LookupCode()); | 8733 caller_code = Handle<Code>(frame->LookupCode()); |
8730 } | 8734 } |
8731 | 8735 |
(...skipping 6386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15118 } | 15122 } |
15119 return NULL; | 15123 return NULL; |
15120 } | 15124 } |
15121 | 15125 |
15122 | 15126 |
15123 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15127 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15124 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15128 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15125 } | 15129 } |
15126 | 15130 |
15127 } } // namespace v8::internal | 15131 } } // namespace v8::internal |
OLD | NEW |