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