| 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.h" | 7 #include "src/ast.h" |
| 8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/compiler/all-nodes.h" | 10 #include "src/compiler/all-nodes.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 312 |
| 313 Zone zone; | 313 Zone zone; |
| 314 ParseInfo parse_info(&zone, function); | 314 ParseInfo parse_info(&zone, function); |
| 315 CompilationInfo info(&parse_info); | 315 CompilationInfo info(&parse_info); |
| 316 if (info_->is_deoptimization_enabled()) { | 316 if (info_->is_deoptimization_enabled()) { |
| 317 info.MarkAsDeoptimizationEnabled(); | 317 info.MarkAsDeoptimizationEnabled(); |
| 318 } | 318 } |
| 319 if (info_->is_native_context_specializing()) { | 319 if (info_->is_native_context_specializing()) { |
| 320 info.MarkAsNativeContextSpecializing(); | 320 info.MarkAsNativeContextSpecializing(); |
| 321 } | 321 } |
| 322 if (info_->is_typing_enabled()) { | |
| 323 info.MarkAsTypingEnabled(); | |
| 324 } | |
| 325 | 322 |
| 326 if (!Compiler::ParseAndAnalyze(info.parse_info())) { | 323 if (!Compiler::ParseAndAnalyze(info.parse_info())) { |
| 327 TRACE("Not inlining %s into %s because parsing failed\n", | 324 TRACE("Not inlining %s into %s because parsing failed\n", |
| 328 function->shared()->DebugName()->ToCString().get(), | 325 function->shared()->DebugName()->ToCString().get(), |
| 329 info_->shared_info()->DebugName()->ToCString().get()); | 326 info_->shared_info()->DebugName()->ToCString().get()); |
| 330 if (info_->isolate()->has_pending_exception()) { | 327 if (info_->isolate()->has_pending_exception()) { |
| 331 info_->isolate()->clear_pending_exception(); | 328 info_->isolate()->clear_pending_exception(); |
| 332 } | 329 } |
| 333 return NoChange(); | 330 return NoChange(); |
| 334 } | 331 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 351 graph_builder.CreateGraph(false); | 348 graph_builder.CreateGraph(false); |
| 352 | 349 |
| 353 // TODO(mstarzinger): Unify this with the Pipeline once JSInliner refactoring | 350 // TODO(mstarzinger): Unify this with the Pipeline once JSInliner refactoring |
| 354 // starts. | 351 // starts. |
| 355 if (info.is_native_context_specializing()) { | 352 if (info.is_native_context_specializing()) { |
| 356 GraphReducer graph_reducer(local_zone_, &graph, jsgraph.Dead()); | 353 GraphReducer graph_reducer(local_zone_, &graph, jsgraph.Dead()); |
| 357 DeadCodeElimination dead_code_elimination(&graph_reducer, &graph, | 354 DeadCodeElimination dead_code_elimination(&graph_reducer, &graph, |
| 358 jsgraph.common()); | 355 jsgraph.common()); |
| 359 CommonOperatorReducer common_reducer(&graph_reducer, &graph, | 356 CommonOperatorReducer common_reducer(&graph_reducer, &graph, |
| 360 jsgraph.common(), jsgraph.machine()); | 357 jsgraph.common(), jsgraph.machine()); |
| 361 JSGlobalSpecialization::Flags flags = JSGlobalSpecialization::kNoFlags; | |
| 362 if (info.is_deoptimization_enabled()) { | |
| 363 flags |= JSGlobalSpecialization::kDeoptimizationEnabled; | |
| 364 } | |
| 365 if (info.is_typing_enabled()) { | |
| 366 flags |= JSGlobalSpecialization::kTypingEnabled; | |
| 367 } | |
| 368 JSGlobalSpecialization global_specialization( | 358 JSGlobalSpecialization global_specialization( |
| 369 &graph_reducer, &jsgraph, flags, | 359 &graph_reducer, &jsgraph, |
| 360 info.is_deoptimization_enabled() |
| 361 ? JSGlobalSpecialization::kDeoptimizationEnabled |
| 362 : JSGlobalSpecialization::kNoFlags, |
| 370 handle(info.global_object(), info.isolate()), info_->dependencies()); | 363 handle(info.global_object(), info.isolate()), info_->dependencies()); |
| 371 graph_reducer.AddReducer(&dead_code_elimination); | 364 graph_reducer.AddReducer(&dead_code_elimination); |
| 372 graph_reducer.AddReducer(&common_reducer); | 365 graph_reducer.AddReducer(&common_reducer); |
| 373 graph_reducer.AddReducer(&global_specialization); | 366 graph_reducer.AddReducer(&global_specialization); |
| 374 graph_reducer.ReduceGraph(); | 367 graph_reducer.ReduceGraph(); |
| 375 } | 368 } |
| 376 | 369 |
| 377 // The inlinee specializes to the context from the JSFunction object. | 370 // The inlinee specializes to the context from the JSFunction object. |
| 378 // TODO(turbofan): We might want to load the context from the JSFunction at | 371 // TODO(turbofan): We might want to load the context from the JSFunction at |
| 379 // runtime in case we only know the SharedFunctionInfo once we have dynamic | 372 // runtime in case we only know the SharedFunctionInfo once we have dynamic |
| (...skipping 22 matching lines...) Expand all Loading... |
| 402 | 395 |
| 403 // Remember that we inlined this function. | 396 // Remember that we inlined this function. |
| 404 info_->AddInlinedFunction(info.shared_info()); | 397 info_->AddInlinedFunction(info.shared_info()); |
| 405 | 398 |
| 406 return InlineCall(node, context, frame_state, start, end); | 399 return InlineCall(node, context, frame_state, start, end); |
| 407 } | 400 } |
| 408 | 401 |
| 409 } // namespace compiler | 402 } // namespace compiler |
| 410 } // namespace internal | 403 } // namespace internal |
| 411 } // namespace v8 | 404 } // namespace v8 |
| OLD | NEW |