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