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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 function->AttemptConcurrentOptimization(); | 104 function->AttemptConcurrentOptimization(); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 return isolate->heap()->undefined_value(); | 108 return isolate->heap()->undefined_value(); |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 RUNTIME_FUNCTION(Runtime_OptimizeOsr) { | 112 RUNTIME_FUNCTION(Runtime_OptimizeOsr) { |
113 HandleScope scope(isolate); | 113 HandleScope scope(isolate); |
114 RUNTIME_ASSERT(args.length() == 0); | 114 RUNTIME_ASSERT(args.length() == 0 || args.length() == 1); |
115 Handle<JSFunction> function = Handle<JSFunction>::null(); | 115 Handle<JSFunction> function = Handle<JSFunction>::null(); |
116 | 116 |
117 { | 117 if (args.length() == 0) { |
118 // Find the JavaScript function on the top of the stack. | 118 // Find the JavaScript function on the top of the stack. |
119 JavaScriptFrameIterator it(isolate); | 119 JavaScriptFrameIterator it(isolate); |
120 while (!it.done()) { | 120 while (!it.done()) { |
121 if (it.frame()->is_java_script()) { | 121 if (it.frame()->is_java_script()) { |
122 function = Handle<JSFunction>(it.frame()->function()); | 122 function = Handle<JSFunction>(it.frame()->function()); |
123 break; | 123 break; |
124 } | 124 } |
125 } | 125 } |
126 if (function.is_null()) return isolate->heap()->undefined_value(); | 126 if (function.is_null()) return isolate->heap()->undefined_value(); |
| 127 } else { |
| 128 // Function was passed as an argument. |
| 129 CONVERT_ARG_HANDLE_CHECKED(JSFunction, arg, 0); |
| 130 function = arg; |
127 } | 131 } |
128 | 132 |
129 // The following assertion was lifted from the DCHECK inside | 133 // The following assertion was lifted from the DCHECK inside |
130 // JSFunction::MarkForOptimization(). | 134 // JSFunction::MarkForOptimization(). |
131 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() || | 135 RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() || |
132 (function->code()->kind() == Code::FUNCTION && | 136 (function->code()->kind() == Code::FUNCTION && |
133 function->code()->optimizable())); | 137 function->code()->optimizable())); |
134 | 138 |
135 if (!isolate->use_crankshaft()) return isolate->heap()->undefined_value(); | 139 if (!isolate->use_crankshaft()) return isolate->heap()->undefined_value(); |
136 | 140 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ | 471 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ |
468 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ | 472 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ |
469 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ | 473 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ |
470 } | 474 } |
471 | 475 |
472 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) | 476 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) |
473 | 477 |
474 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION | 478 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION |
475 } | 479 } |
476 } // namespace v8::internal | 480 } // namespace v8::internal |
OLD | NEW |