Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(629)

Side by Side Diff: src/runtime/runtime-test.cc

Issue 2230783004: [interpreter] Switch profiler to use frames for OSR. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_interpreter-preserve-bytecode-1
Patch Set: Fix frame type confusion. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime-profiler.cc ('k') | test/mjsunit/compiler/osr-infinite.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 function->AttemptConcurrentOptimization(); 136 function->AttemptConcurrentOptimization();
137 } 137 }
138 } 138 }
139 139
140 return isolate->heap()->undefined_value(); 140 return isolate->heap()->undefined_value();
141 } 141 }
142 142
143 143
144 RUNTIME_FUNCTION(Runtime_OptimizeOsr) { 144 RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
145 HandleScope scope(isolate); 145 HandleScope scope(isolate);
146 DCHECK(args.length() == 0 || args.length() == 1);
146 147
147 // This function is used by fuzzers, ignore calls with bogus arguments count. 148 Handle<JSFunction> function;
148 if (args.length() != 0 && args.length() != 1) {
149 return isolate->heap()->undefined_value();
150 }
151 149
152 Handle<JSFunction> function = Handle<JSFunction>::null(); 150 // The optional parameter determines the frame being targeted.
153 if (args.length() == 0) { 151 int stack_depth = args.length() == 1 ? args.smi_at(0) : 0;
154 // Find the JavaScript function on the top of the stack.
155 JavaScriptFrameIterator it(isolate);
156 if (!it.done()) function = Handle<JSFunction>(it.frame()->function());
157 if (function.is_null()) return isolate->heap()->undefined_value();
158 } else {
159 // Function was passed as an argument.
160 CONVERT_ARG_HANDLE_CHECKED(JSFunction, arg, 0);
161 function = arg;
162 }
163 152
164 // If function is interpreted but OSR hasn't been enabled, just return. 153 // Find the JavaScript function on the top of the stack.
165 if (function->shared()->HasBytecodeArray() && !FLAG_ignition_osr) { 154 JavaScriptFrameIterator it(isolate);
166 return isolate->heap()->undefined_value(); 155 while (!it.done() && stack_depth--) it.Advance();
167 } 156 if (!it.done()) function = Handle<JSFunction>(it.frame()->function());
157 if (function.is_null()) return isolate->heap()->undefined_value();
168 158
169 // If the function is already optimized, just return. 159 // If the function is already optimized, just return.
170 if (function->IsOptimized()) return isolate->heap()->undefined_value(); 160 if (function->IsOptimized()) return isolate->heap()->undefined_value();
171 161
172 // Make the profiler arm all back edges in unoptimized code. 162 // Make the profiler arm all back edges in unoptimized code.
173 if (function->shared()->HasBytecodeArray() || 163 if (it.frame()->type() == StackFrame::JAVA_SCRIPT ||
174 function->shared()->HasBaselineCode()) { 164 it.frame()->type() == StackFrame::INTERPRETED) {
175 isolate->runtime_profiler()->AttemptOnStackReplacement( 165 isolate->runtime_profiler()->AttemptOnStackReplacement(
176 *function, AbstractCode::kMaxLoopNestingMarker); 166 it.frame(), AbstractCode::kMaxLoopNestingMarker);
177 } 167 }
178 168
179 return isolate->heap()->undefined_value(); 169 return isolate->heap()->undefined_value();
180 } 170 }
181 171
182 172
183 RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) { 173 RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) {
184 HandleScope scope(isolate); 174 HandleScope scope(isolate);
185 DCHECK(args.length() == 1); 175 DCHECK(args.length() == 1);
186 CONVERT_ARG_CHECKED(JSFunction, function, 0); 176 CONVERT_ARG_CHECKED(JSFunction, function, 0);
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 WasmCompiledModuleSerializer::DeserializeWasmModule(isolate, &sc); 665 WasmCompiledModuleSerializer::DeserializeWasmModule(isolate, &sc);
676 Handle<FixedArray> compiled_module; 666 Handle<FixedArray> compiled_module;
677 if (!maybe_compiled_module.ToHandle(&compiled_module)) { 667 if (!maybe_compiled_module.ToHandle(&compiled_module)) {
678 return isolate->heap()->undefined_value(); 668 return isolate->heap()->undefined_value();
679 } 669 }
680 return *wasm::CreateCompiledModuleObject(isolate, compiled_module); 670 return *wasm::CreateCompiledModuleObject(isolate, compiled_module);
681 } 671 }
682 672
683 } // namespace internal 673 } // namespace internal
684 } // namespace v8 674 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime-profiler.cc ('k') | test/mjsunit/compiler/osr-infinite.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698