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/js-operator.h" | 13 #include "src/compiler/js-operator.h" |
14 #include "src/compiler/node-matchers.h" | 14 #include "src/compiler/node-matchers.h" |
15 #include "src/compiler/node-properties.h" | 15 #include "src/compiler/node-properties.h" |
16 #include "src/compiler/operator-properties.h" | 16 #include "src/compiler/operator-properties.h" |
17 #include "src/full-codegen/full-codegen.h" | 17 #include "src/full-codegen/full-codegen.h" |
| 18 #include "src/isolate-inl.h" |
18 #include "src/parser.h" | 19 #include "src/parser.h" |
19 #include "src/rewriter.h" | 20 #include "src/rewriter.h" |
20 #include "src/scopes.h" | 21 #include "src/scopes.h" |
21 | 22 |
22 namespace v8 { | 23 namespace v8 { |
23 namespace internal { | 24 namespace internal { |
24 namespace compiler { | 25 namespace compiler { |
25 | 26 |
26 #define TRACE(...) \ | 27 #define TRACE(...) \ |
27 do { \ | 28 do { \ |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 info_->shared_info()->DebugName()->ToCString().get()); | 290 info_->shared_info()->DebugName()->ToCString().get()); |
290 return NoChange(); | 291 return NoChange(); |
291 } | 292 } |
292 } | 293 } |
293 | 294 |
294 Zone zone; | 295 Zone zone; |
295 ParseInfo parse_info(&zone, function); | 296 ParseInfo parse_info(&zone, function); |
296 CompilationInfo info(&parse_info); | 297 CompilationInfo info(&parse_info); |
297 if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled(); | 298 if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled(); |
298 | 299 |
299 if (!Compiler::ParseAndAnalyze(info.parse_info())) return NoChange(); | 300 if (!Compiler::ParseAndAnalyze(info.parse_info())) { |
300 if (!Compiler::EnsureDeoptimizationSupport(&info)) return NoChange(); | 301 TRACE("Not inlining %s into %s because parsing failed\n", |
| 302 function->shared()->DebugName()->ToCString().get(), |
| 303 info_->shared_info()->DebugName()->ToCString().get()); |
| 304 if (info_->isolate()->has_pending_exception()) { |
| 305 info_->isolate()->clear_pending_exception(); |
| 306 } |
| 307 return NoChange(); |
| 308 } |
| 309 |
| 310 if (!Compiler::EnsureDeoptimizationSupport(&info)) { |
| 311 TRACE("Not inlining %s into %s because deoptimization support failed\n", |
| 312 function->shared()->DebugName()->ToCString().get(), |
| 313 info_->shared_info()->DebugName()->ToCString().get()); |
| 314 return NoChange(); |
| 315 } |
301 | 316 |
302 if (info.scope()->arguments() != NULL && is_sloppy(info.language_mode())) { | 317 if (info.scope()->arguments() != NULL && is_sloppy(info.language_mode())) { |
303 // For now do not inline functions that use their arguments array. | 318 // For now do not inline functions that use their arguments array. |
304 TRACE("Not inlining %s into %s because inlinee uses arguments array\n", | 319 TRACE("Not inlining %s into %s because inlinee uses arguments array\n", |
305 function->shared()->DebugName()->ToCString().get(), | 320 function->shared()->DebugName()->ToCString().get(), |
306 info_->shared_info()->DebugName()->ToCString().get()); | 321 info_->shared_info()->DebugName()->ToCString().get()); |
307 return NoChange(); | 322 return NoChange(); |
308 } | 323 } |
309 | 324 |
310 TRACE("Inlining %s into %s\n", | 325 TRACE("Inlining %s into %s\n", |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 360 |
346 // Remember that we inlined this function. | 361 // Remember that we inlined this function. |
347 info_->AddInlinedFunction(info.shared_info()); | 362 info_->AddInlinedFunction(info.shared_info()); |
348 | 363 |
349 return InlineCall(node, context, frame_state, start, end); | 364 return InlineCall(node, context, frame_state, start, end); |
350 } | 365 } |
351 | 366 |
352 } // namespace compiler | 367 } // namespace compiler |
353 } // namespace internal | 368 } // namespace internal |
354 } // namespace v8 | 369 } // namespace v8 |
OLD | NEW |