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/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/frames.h" | 10 #include "src/frames.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 #ifdef DEBUG | 212 #ifdef DEBUG |
213 DCHECK_EQ(frame->function(), *function); | 213 DCHECK_EQ(frame->function(), *function); |
214 DCHECK_EQ(frame->LookupCode(), *caller_code); | 214 DCHECK_EQ(frame->LookupCode(), *caller_code); |
215 DCHECK(caller_code->contains(frame->pc())); | 215 DCHECK(caller_code->contains(frame->pc())); |
216 #endif // DEBUG | 216 #endif // DEBUG |
217 | 217 |
218 | 218 |
219 BailoutId ast_id = caller_code->TranslatePcOffsetToAstId(pc_offset); | 219 BailoutId ast_id = caller_code->TranslatePcOffsetToAstId(pc_offset); |
220 DCHECK(!ast_id.IsNone()); | 220 DCHECK(!ast_id.IsNone()); |
221 | 221 |
222 Compiler::ConcurrencyMode mode = | 222 // Disable concurrent OSR for asm.js, to enable frame specialization. |
223 isolate->concurrent_osr_enabled() && | 223 Compiler::ConcurrencyMode mode = (isolate->concurrent_osr_enabled() && |
224 (function->shared()->ast_node_count() > 512) | 224 !function->shared()->asm_function() && |
225 ? Compiler::CONCURRENT | 225 function->shared()->ast_node_count() > 512) |
226 : Compiler::NOT_CONCURRENT; | 226 ? Compiler::CONCURRENT |
| 227 : Compiler::NOT_CONCURRENT; |
227 Handle<Code> result = Handle<Code>::null(); | 228 Handle<Code> result = Handle<Code>::null(); |
228 | 229 |
229 OptimizedCompileJob* job = NULL; | 230 OptimizedCompileJob* job = NULL; |
230 if (mode == Compiler::CONCURRENT) { | 231 if (mode == Compiler::CONCURRENT) { |
231 // Gate the OSR entry with a stack check. | 232 // Gate the OSR entry with a stack check. |
232 BackEdgeTable::AddStackCheck(caller_code, pc_offset); | 233 BackEdgeTable::AddStackCheck(caller_code, pc_offset); |
233 // Poll already queued compilation jobs. | 234 // Poll already queued compilation jobs. |
234 OptimizingCompileDispatcher* dispatcher = | 235 OptimizingCompileDispatcher* dispatcher = |
235 isolate->optimizing_compile_dispatcher(); | 236 isolate->optimizing_compile_dispatcher(); |
236 if (dispatcher->IsQueuedForOSR(function, ast_id)) { | 237 if (dispatcher->IsQueuedForOSR(function, ast_id)) { |
(...skipping 14 matching lines...) Expand all Loading... |
251 function->PrintName(); | 252 function->PrintName(); |
252 PrintF(" at AST id %d]\n", ast_id.ToInt()); | 253 PrintF(" at AST id %d]\n", ast_id.ToInt()); |
253 } | 254 } |
254 result = Compiler::GetConcurrentlyOptimizedCode(job); | 255 result = Compiler::GetConcurrentlyOptimizedCode(job); |
255 } else if (IsSuitableForOnStackReplacement(isolate, function)) { | 256 } else if (IsSuitableForOnStackReplacement(isolate, function)) { |
256 if (FLAG_trace_osr) { | 257 if (FLAG_trace_osr) { |
257 PrintF("[OSR - Compiling: "); | 258 PrintF("[OSR - Compiling: "); |
258 function->PrintName(); | 259 function->PrintName(); |
259 PrintF(" at AST id %d]\n", ast_id.ToInt()); | 260 PrintF(" at AST id %d]\n", ast_id.ToInt()); |
260 } | 261 } |
261 MaybeHandle<Code> maybe_result = | 262 MaybeHandle<Code> maybe_result = Compiler::GetOptimizedCode( |
262 Compiler::GetOptimizedCode(function, caller_code, mode, ast_id); | 263 function, caller_code, mode, ast_id, |
| 264 (mode == Compiler::NOT_CONCURRENT) ? frame : nullptr); |
263 if (maybe_result.ToHandle(&result) && | 265 if (maybe_result.ToHandle(&result) && |
264 result.is_identical_to(isolate->builtins()->InOptimizationQueue())) { | 266 result.is_identical_to(isolate->builtins()->InOptimizationQueue())) { |
265 // Optimization is queued. Return to check later. | 267 // Optimization is queued. Return to check later. |
266 return NULL; | 268 return NULL; |
267 } | 269 } |
268 } | 270 } |
269 | 271 |
270 // Revert the patched back edge table, regardless of whether OSR succeeds. | 272 // Revert the patched back edge table, regardless of whether OSR succeeds. |
271 BackEdgeTable::Revert(isolate, *caller_code); | 273 BackEdgeTable::Revert(isolate, *caller_code); |
272 | 274 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 DCHECK(is_valid_language_mode(args.smi_at(3))); | 436 DCHECK(is_valid_language_mode(args.smi_at(3))); |
435 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); | 437 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); |
436 DCHECK(args[4]->IsSmi()); | 438 DCHECK(args[4]->IsSmi()); |
437 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 439 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
438 isolate); | 440 isolate); |
439 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 441 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
440 language_mode, args.smi_at(4)); | 442 language_mode, args.smi_at(4)); |
441 } | 443 } |
442 } // namespace internal | 444 } // namespace internal |
443 } // namespace v8 | 445 } // namespace v8 |
OLD | NEW |