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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 if (data->OsrPcOffset()->value() >= 0) { | 283 if (data->OsrPcOffset()->value() >= 0) { |
284 DCHECK(BailoutId(data->OsrAstId()->value()) == ast_id); | 284 DCHECK(BailoutId(data->OsrAstId()->value()) == ast_id); |
285 if (FLAG_trace_osr) { | 285 if (FLAG_trace_osr) { |
286 PrintF("[OSR - Entry at AST id %d, offset %d in optimized code]\n", | 286 PrintF("[OSR - Entry at AST id %d, offset %d in optimized code]\n", |
287 ast_id.ToInt(), data->OsrPcOffset()->value()); | 287 ast_id.ToInt(), data->OsrPcOffset()->value()); |
288 } | 288 } |
289 // TODO(titzer): this is a massive hack to make the deopt counts | 289 // TODO(titzer): this is a massive hack to make the deopt counts |
290 // match. Fix heuristics for reenabling optimizations! | 290 // match. Fix heuristics for reenabling optimizations! |
291 function->shared()->increment_deopt_count(); | 291 function->shared()->increment_deopt_count(); |
292 | 292 |
293 // TODO(titzer): Do not install code into the function. | 293 if (result->is_turbofanned()) { |
294 function->ReplaceCode(*result); | 294 // TurboFanned OSR code cannot be installed into the function. |
| 295 // But the function is obviously hot, so optimize it next time. |
| 296 function->ReplaceCode( |
| 297 isolate->builtins()->builtin(Builtins::kCompileOptimized)); |
| 298 } else { |
| 299 // Crankshafted OSR code can be installed into the function. |
| 300 function->ReplaceCode(*result); |
| 301 } |
295 return *result; | 302 return *result; |
296 } | 303 } |
297 } | 304 } |
298 | 305 |
299 // Failed. | 306 // Failed. |
300 if (FLAG_trace_osr) { | 307 if (FLAG_trace_osr) { |
301 PrintF("[OSR - Failed: "); | 308 PrintF("[OSR - Failed: "); |
302 function->PrintName(); | 309 function->PrintName(); |
303 PrintF(" at AST id %d]\n", ast_id.ToInt()); | 310 PrintF(" at AST id %d]\n", ast_id.ToInt()); |
304 } | 311 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 DCHECK(args.smi_at(4) == SLOPPY || args.smi_at(4) == STRICT); | 449 DCHECK(args.smi_at(4) == SLOPPY || args.smi_at(4) == STRICT); |
443 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(4)); | 450 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(4)); |
444 DCHECK(args[5]->IsSmi()); | 451 DCHECK(args[5]->IsSmi()); |
445 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 452 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
446 isolate); | 453 isolate); |
447 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 454 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
448 args.at<Object>(3), strict_mode, args.smi_at(5)); | 455 args.at<Object>(3), strict_mode, args.smi_at(5)); |
449 } | 456 } |
450 } | 457 } |
451 } // namespace v8::internal | 458 } // namespace v8::internal |
OLD | NEW |