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/compiler/js-inlining.h" | 5 #include "src/compiler/js-inlining.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/ast-numbering.h" | 8 #include "src/ast/ast-numbering.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 415 matching lines...) Loading... |
426 } | 426 } |
427 return NoChange(); | 427 return NoChange(); |
428 } | 428 } |
429 | 429 |
430 if (!Compiler::EnsureDeoptimizationSupport(&info)) { | 430 if (!Compiler::EnsureDeoptimizationSupport(&info)) { |
431 TRACE("Not inlining %s into %s because deoptimization support failed\n", | 431 TRACE("Not inlining %s into %s because deoptimization support failed\n", |
432 shared_info->DebugName()->ToCString().get(), | 432 shared_info->DebugName()->ToCString().get(), |
433 info_->shared_info()->DebugName()->ToCString().get()); | 433 info_->shared_info()->DebugName()->ToCString().get()); |
434 return NoChange(); | 434 return NoChange(); |
435 } | 435 } |
| 436 |
436 // Remember that we inlined this function. This needs to be called right | 437 // Remember that we inlined this function. This needs to be called right |
437 // after we ensure deoptimization support so that the code flusher | 438 // after we ensure deoptimization support so that the code flusher |
438 // does not remove the code with the deoptimization support. | 439 // does not remove the code with the deoptimization support. |
439 info_->AddInlinedFunction(shared_info); | 440 info_->AddInlinedFunction(shared_info); |
440 | 441 |
441 // ---------------------------------------------------------------- | 442 // ---------------------------------------------------------------- |
442 // After this point, we've made a decision to inline this function. | 443 // After this point, we've made a decision to inline this function. |
443 // We shall not bailout from inlining if we got here. | 444 // We shall not bailout from inlining if we got here. |
444 | 445 |
445 TRACE("Inlining %s into %s\n", | 446 TRACE("Inlining %s into %s\n", |
446 shared_info->DebugName()->ToCString().get(), | 447 shared_info->DebugName()->ToCString().get(), |
447 info_->shared_info()->DebugName()->ToCString().get()); | 448 info_->shared_info()->DebugName()->ToCString().get()); |
448 | 449 |
| 450 // If function was lazily compiled, it's literals array may not yet be set up. |
| 451 JSFunction::EnsureLiterals(function); |
| 452 |
449 // TODO(mstarzinger): We could use the temporary zone for the graph because | 453 // TODO(mstarzinger): We could use the temporary zone for the graph because |
450 // nodes are copied. This however leads to Zone-Types being allocated in the | 454 // nodes are copied. This however leads to Zone-Types being allocated in the |
451 // wrong zone and makes the engine explode at high speeds. Explosion bad! | 455 // wrong zone and makes the engine explode at high speeds. Explosion bad! |
452 Graph graph(jsgraph_->zone()); | 456 Graph graph(jsgraph_->zone()); |
453 JSGraph jsgraph(info.isolate(), &graph, jsgraph_->common(), | 457 JSGraph jsgraph(info.isolate(), &graph, jsgraph_->common(), |
454 jsgraph_->javascript(), jsgraph_->simplified(), | 458 jsgraph_->javascript(), jsgraph_->simplified(), |
455 jsgraph_->machine()); | 459 jsgraph_->machine()); |
456 AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph); | 460 AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph); |
457 graph_builder.CreateGraph(false); | 461 graph_builder.CreateGraph(false); |
458 | 462 |
(...skipping 95 matching lines...) Loading... |
554 node, frame_state, call.formal_arguments(), | 558 node, frame_state, call.formal_arguments(), |
555 FrameStateType::kArgumentsAdaptor, shared_info); | 559 FrameStateType::kArgumentsAdaptor, shared_info); |
556 } | 560 } |
557 | 561 |
558 return InlineCall(node, new_target, context, frame_state, start, end); | 562 return InlineCall(node, new_target, context, frame_state, start, end); |
559 } | 563 } |
560 | 564 |
561 } // namespace compiler | 565 } // namespace compiler |
562 } // namespace internal | 566 } // namespace internal |
563 } // namespace v8 | 567 } // namespace v8 |
OLD | NEW |