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" |
11 #include "src/compiler/ast-graph-builder.h" | 11 #include "src/compiler/ast-graph-builder.h" |
12 #include "src/compiler/common-operator.h" | 12 #include "src/compiler/common-operator.h" |
13 #include "src/compiler/common-operator-reducer.h" | 13 #include "src/compiler/common-operator-reducer.h" |
14 #include "src/compiler/dead-code-elimination.h" | 14 #include "src/compiler/dead-code-elimination.h" |
15 #include "src/compiler/graph-reducer.h" | 15 #include "src/compiler/graph-reducer.h" |
| 16 #include "src/compiler/js-global-object-specialization.h" |
16 #include "src/compiler/js-native-context-specialization.h" | 17 #include "src/compiler/js-native-context-specialization.h" |
17 #include "src/compiler/js-operator.h" | 18 #include "src/compiler/js-operator.h" |
18 #include "src/compiler/node-matchers.h" | 19 #include "src/compiler/node-matchers.h" |
19 #include "src/compiler/node-properties.h" | 20 #include "src/compiler/node-properties.h" |
20 #include "src/compiler/operator-properties.h" | 21 #include "src/compiler/operator-properties.h" |
21 #include "src/isolate-inl.h" | 22 #include "src/isolate-inl.h" |
22 #include "src/parser.h" | 23 #include "src/parser.h" |
23 #include "src/rewriter.h" | 24 #include "src/rewriter.h" |
24 #include "src/scopes.h" | 25 #include "src/scopes.h" |
25 | 26 |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 graph_builder.CreateGraph(false); | 384 graph_builder.CreateGraph(false); |
384 | 385 |
385 // TODO(mstarzinger): Unify this with the Pipeline once JSInliner refactoring | 386 // TODO(mstarzinger): Unify this with the Pipeline once JSInliner refactoring |
386 // starts. | 387 // starts. |
387 if (info.is_native_context_specializing()) { | 388 if (info.is_native_context_specializing()) { |
388 GraphReducer graph_reducer(local_zone_, &graph, jsgraph.Dead()); | 389 GraphReducer graph_reducer(local_zone_, &graph, jsgraph.Dead()); |
389 DeadCodeElimination dead_code_elimination(&graph_reducer, &graph, | 390 DeadCodeElimination dead_code_elimination(&graph_reducer, &graph, |
390 jsgraph.common()); | 391 jsgraph.common()); |
391 CommonOperatorReducer common_reducer(&graph_reducer, &graph, | 392 CommonOperatorReducer common_reducer(&graph_reducer, &graph, |
392 jsgraph.common(), jsgraph.machine()); | 393 jsgraph.common(), jsgraph.machine()); |
| 394 JSGlobalObjectSpecialization global_object_specialization( |
| 395 &graph_reducer, &jsgraph, |
| 396 info.is_deoptimization_enabled() |
| 397 ? JSGlobalObjectSpecialization::kDeoptimizationEnabled |
| 398 : JSGlobalObjectSpecialization::kNoFlags, |
| 399 handle(info.global_object(), info.isolate()), info_->dependencies()); |
393 JSNativeContextSpecialization native_context_specialization( | 400 JSNativeContextSpecialization native_context_specialization( |
394 &graph_reducer, &jsgraph, | 401 &graph_reducer, &jsgraph, |
395 info.is_deoptimization_enabled() | 402 info.is_deoptimization_enabled() |
396 ? JSNativeContextSpecialization::kDeoptimizationEnabled | 403 ? JSNativeContextSpecialization::kDeoptimizationEnabled |
397 : JSNativeContextSpecialization::kNoFlags, | 404 : JSNativeContextSpecialization::kNoFlags, |
398 handle(info.global_object(), info.isolate()), info_->dependencies(), | 405 handle(info.global_object()->native_context(), info.isolate()), |
399 local_zone_); | 406 info_->dependencies(), local_zone_); |
400 graph_reducer.AddReducer(&dead_code_elimination); | 407 graph_reducer.AddReducer(&dead_code_elimination); |
401 graph_reducer.AddReducer(&common_reducer); | 408 graph_reducer.AddReducer(&common_reducer); |
| 409 graph_reducer.AddReducer(&global_object_specialization); |
402 graph_reducer.AddReducer(&native_context_specialization); | 410 graph_reducer.AddReducer(&native_context_specialization); |
403 graph_reducer.ReduceGraph(); | 411 graph_reducer.ReduceGraph(); |
404 } | 412 } |
405 | 413 |
406 // The inlinee specializes to the context from the JSFunction object. | 414 // The inlinee specializes to the context from the JSFunction object. |
407 // TODO(turbofan): We might want to load the context from the JSFunction at | 415 // TODO(turbofan): We might want to load the context from the JSFunction at |
408 // runtime in case we only know the SharedFunctionInfo once we have dynamic | 416 // runtime in case we only know the SharedFunctionInfo once we have dynamic |
409 // type feedback in the compiler. | 417 // type feedback in the compiler. |
410 Node* context = jsgraph_->Constant(handle(function->context())); | 418 Node* context = jsgraph_->Constant(handle(function->context())); |
411 | 419 |
(...skipping 28 matching lines...) Expand all Loading... |
440 if (call.formal_arguments() != parameter_count) { | 448 if (call.formal_arguments() != parameter_count) { |
441 frame_state = CreateArgumentsAdaptorFrameState(&call, info.shared_info()); | 449 frame_state = CreateArgumentsAdaptorFrameState(&call, info.shared_info()); |
442 } | 450 } |
443 | 451 |
444 return InlineCall(node, context, frame_state, start, end); | 452 return InlineCall(node, context, frame_state, start, end); |
445 } | 453 } |
446 | 454 |
447 } // namespace compiler | 455 } // namespace compiler |
448 } // namespace internal | 456 } // namespace internal |
449 } // namespace v8 | 457 } // namespace v8 |
OLD | NEW |