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