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/natives.h" | 10 #include "src/natives.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->code()->kind() == Code::FUNCTION && |
90 function->code()->optimizable())); | 90 function->code()->optimizable())); |
91 | 91 |
92 if (!isolate->use_crankshaft()) return isolate->heap()->undefined_value(); | |
93 | |
94 // If the function is already optimized, just return. | 92 // If the function is already optimized, just return. |
95 if (function->IsOptimized()) return isolate->heap()->undefined_value(); | 93 if (function->IsOptimized()) return isolate->heap()->undefined_value(); |
96 | 94 |
97 function->MarkForOptimization(); | 95 function->MarkForOptimization(); |
98 | 96 |
99 Code* unoptimized = function->shared()->code(); | 97 Code* unoptimized = function->shared()->code(); |
100 if (args.length() == 2 && unoptimized->kind() == Code::FUNCTION) { | 98 if (args.length() == 2 && unoptimized->kind() == Code::FUNCTION) { |
101 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); | 99 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
102 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) && | 100 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) && |
103 isolate->concurrent_recompilation_enabled()) { | 101 isolate->concurrent_recompilation_enabled()) { |
(...skipping 25 matching lines...) Expand all Loading... |
129 CONVERT_ARG_HANDLE_CHECKED(JSFunction, arg, 0); | 127 CONVERT_ARG_HANDLE_CHECKED(JSFunction, arg, 0); |
130 function = arg; | 128 function = arg; |
131 } | 129 } |
132 | 130 |
133 // The following assertion was lifted from the DCHECK inside | 131 // The following assertion was lifted from the DCHECK inside |
134 // JSFunction::MarkForOptimization(). | 132 // JSFunction::MarkForOptimization(). |
135 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() || | 133 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() || |
136 (function->code()->kind() == Code::FUNCTION && | 134 (function->code()->kind() == Code::FUNCTION && |
137 function->code()->optimizable())); | 135 function->code()->optimizable())); |
138 | 136 |
139 if (!isolate->use_crankshaft()) return isolate->heap()->undefined_value(); | |
140 | |
141 // If the function is already optimized, just return. | 137 // If the function is already optimized, just return. |
142 if (function->IsOptimized()) return isolate->heap()->undefined_value(); | 138 if (function->IsOptimized()) return isolate->heap()->undefined_value(); |
143 | 139 |
144 Code* unoptimized = function->shared()->code(); | 140 Code* unoptimized = function->shared()->code(); |
145 if (unoptimized->kind() == Code::FUNCTION) { | 141 if (unoptimized->kind() == Code::FUNCTION) { |
146 DCHECK(BackEdgeTable::Verify(isolate, unoptimized)); | 142 DCHECK(BackEdgeTable::Verify(isolate, unoptimized)); |
147 isolate->runtime_profiler()->AttemptOnStackReplacement( | 143 isolate->runtime_profiler()->AttemptOnStackReplacement( |
148 *function, Code::kMaxLoopNestingMarker); | 144 *function, Code::kMaxLoopNestingMarker); |
149 } | 145 } |
150 | 146 |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ | 467 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ |
472 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ | 468 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ |
473 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ | 469 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ |
474 } | 470 } |
475 | 471 |
476 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) | 472 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) |
477 | 473 |
478 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION | 474 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION |
479 } | 475 } |
480 } // namespace v8::internal | 476 } // namespace v8::internal |
OLD | NEW |