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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 if (data->OsrPcOffset()->value() >= 0) { | 294 if (data->OsrPcOffset()->value() >= 0) { |
295 DCHECK(BailoutId(data->OsrAstId()->value()) == ast_id); | 295 DCHECK(BailoutId(data->OsrAstId()->value()) == ast_id); |
296 if (FLAG_trace_osr) { | 296 if (FLAG_trace_osr) { |
297 PrintF("[OSR - Entry at AST id %d, offset %d in optimized code]\n", | 297 PrintF("[OSR - Entry at AST id %d, offset %d in optimized code]\n", |
298 ast_id.ToInt(), data->OsrPcOffset()->value()); | 298 ast_id.ToInt(), data->OsrPcOffset()->value()); |
299 } | 299 } |
300 // TODO(titzer): this is a massive hack to make the deopt counts | 300 // TODO(titzer): this is a massive hack to make the deopt counts |
301 // match. Fix heuristics for reenabling optimizations! | 301 // match. Fix heuristics for reenabling optimizations! |
302 function->shared()->increment_deopt_count(); | 302 function->shared()->increment_deopt_count(); |
303 | 303 |
304 // TODO(titzer): Do not install code into the function. | 304 if (result->is_turbofanned()) { |
305 function->ReplaceCode(*result); | 305 // TurboFanned OSR code cannot be installed into the function. |
| 306 // But the function is obviously hot, so optimize it next time. |
| 307 function->ReplaceCode( |
| 308 isolate->builtins()->builtin(Builtins::kCompileOptimized)); |
| 309 } else { |
| 310 // Crankshafted OSR code can be installed into the function. |
| 311 function->ReplaceCode(*result); |
| 312 } |
306 return *result; | 313 return *result; |
307 } | 314 } |
308 } | 315 } |
309 | 316 |
310 // Failed. | 317 // Failed. |
311 if (FLAG_trace_osr) { | 318 if (FLAG_trace_osr) { |
312 PrintF("[OSR - Failed: "); | 319 PrintF("[OSR - Failed: "); |
313 function->PrintName(); | 320 function->PrintName(); |
314 PrintF(" at AST id %d]\n", ast_id.ToInt()); | 321 PrintF(" at AST id %d]\n", ast_id.ToInt()); |
315 } | 322 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 DCHECK(args.smi_at(4) == SLOPPY || args.smi_at(4) == STRICT); | 460 DCHECK(args.smi_at(4) == SLOPPY || args.smi_at(4) == STRICT); |
454 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(4)); | 461 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(4)); |
455 DCHECK(args[5]->IsSmi()); | 462 DCHECK(args[5]->IsSmi()); |
456 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 463 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
457 isolate); | 464 isolate); |
458 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 465 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
459 args.at<Object>(3), strict_mode, args.smi_at(5)); | 466 args.at<Object>(3), strict_mode, args.smi_at(5)); |
460 } | 467 } |
461 } | 468 } |
462 } // namespace v8::internal | 469 } // namespace v8::internal |
OLD | NEW |