| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
| 9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
| 10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 isolate->concurrent_recompilation_enabled()); | 78 isolate->concurrent_recompilation_enabled()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { | 82 RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { |
| 83 HandleScope scope(isolate); | 83 HandleScope scope(isolate); |
| 84 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); | 84 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); |
| 85 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 85 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 86 // The following assertion was lifted from the DCHECK inside | 86 // The following assertion was lifted from the DCHECK inside |
| 87 // JSFunction::MarkForOptimization(). | 87 // JSFunction::MarkForOptimization(). |
| 88 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation()); | 88 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() || |
| 89 function->IsOptimizable()); |
| 89 | 90 |
| 90 // If the function is already optimized, just return. | 91 // If the function is already optimized, just return. |
| 91 if (function->IsOptimized()) return isolate->heap()->undefined_value(); | 92 if (function->IsOptimized()) return isolate->heap()->undefined_value(); |
| 92 | 93 |
| 93 function->MarkForOptimization(); | 94 function->MarkForOptimization(); |
| 94 | 95 |
| 95 Code* unoptimized = function->shared()->code(); | 96 Code* unoptimized = function->shared()->code(); |
| 96 if (args.length() == 2 && unoptimized->kind() == Code::FUNCTION) { | 97 if (args.length() == 2 && unoptimized->kind() == Code::FUNCTION) { |
| 97 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); | 98 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
| 98 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) && | 99 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) && |
| (...skipping 22 matching lines...) Expand all Loading... |
| 121 } | 122 } |
| 122 if (function.is_null()) return isolate->heap()->undefined_value(); | 123 if (function.is_null()) return isolate->heap()->undefined_value(); |
| 123 } else { | 124 } else { |
| 124 // Function was passed as an argument. | 125 // Function was passed as an argument. |
| 125 CONVERT_ARG_HANDLE_CHECKED(JSFunction, arg, 0); | 126 CONVERT_ARG_HANDLE_CHECKED(JSFunction, arg, 0); |
| 126 function = arg; | 127 function = arg; |
| 127 } | 128 } |
| 128 | 129 |
| 129 // The following assertion was lifted from the DCHECK inside | 130 // The following assertion was lifted from the DCHECK inside |
| 130 // JSFunction::MarkForOptimization(). | 131 // JSFunction::MarkForOptimization(). |
| 131 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation()); | 132 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() || |
| 133 function->IsOptimizable()); |
| 132 | 134 |
| 133 // If the function is already optimized, just return. | 135 // If the function is already optimized, just return. |
| 134 if (function->IsOptimized()) return isolate->heap()->undefined_value(); | 136 if (function->IsOptimized()) return isolate->heap()->undefined_value(); |
| 135 | 137 |
| 136 Code* unoptimized = function->shared()->code(); | 138 Code* unoptimized = function->shared()->code(); |
| 137 if (unoptimized->kind() == Code::FUNCTION) { | 139 if (unoptimized->kind() == Code::FUNCTION) { |
| 138 DCHECK(BackEdgeTable::Verify(isolate, unoptimized)); | 140 DCHECK(BackEdgeTable::Verify(isolate, unoptimized)); |
| 139 isolate->runtime_profiler()->AttemptOnStackReplacement( | 141 isolate->runtime_profiler()->AttemptOnStackReplacement( |
| 140 *function, Code::kMaxLoopNestingMarker); | 142 *function, Code::kMaxLoopNestingMarker); |
| 141 } | 143 } |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ | 494 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ |
| 493 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ | 495 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ |
| 494 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ | 496 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ |
| 495 } | 497 } |
| 496 | 498 |
| 497 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) | 499 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) |
| 498 | 500 |
| 499 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION | 501 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION |
| 500 } // namespace internal | 502 } // namespace internal |
| 501 } // namespace v8 | 503 } // namespace v8 |
| OLD | NEW |