OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 #define PARSE_INFO_GETTER_WITH_DEFAULT(type, name, def) \ | 55 #define PARSE_INFO_GETTER_WITH_DEFAULT(type, name, def) \ |
56 type CompilationInfo::name() const { \ | 56 type CompilationInfo::name() const { \ |
57 return parse_info() ? parse_info()->name() : def; \ | 57 return parse_info() ? parse_info()->name() : def; \ |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 PARSE_INFO_GETTER(Handle<Script>, script) | 61 PARSE_INFO_GETTER(Handle<Script>, script) |
62 PARSE_INFO_GETTER(bool, is_eval) | 62 PARSE_INFO_GETTER(bool, is_eval) |
63 PARSE_INFO_GETTER(bool, is_native) | 63 PARSE_INFO_GETTER(bool, is_native) |
64 PARSE_INFO_GETTER(bool, is_module) | 64 PARSE_INFO_GETTER(bool, is_module) |
65 PARSE_INFO_GETTER(bool, this_has_uses) | |
66 PARSE_INFO_GETTER(LanguageMode, language_mode) | 65 PARSE_INFO_GETTER(LanguageMode, language_mode) |
67 PARSE_INFO_GETTER_WITH_DEFAULT(Handle<JSFunction>, closure, | 66 PARSE_INFO_GETTER_WITH_DEFAULT(Handle<JSFunction>, closure, |
68 Handle<JSFunction>::null()) | 67 Handle<JSFunction>::null()) |
69 PARSE_INFO_GETTER(FunctionLiteral*, function) | 68 PARSE_INFO_GETTER(FunctionLiteral*, function) |
70 PARSE_INFO_GETTER_WITH_DEFAULT(Scope*, scope, nullptr) | 69 PARSE_INFO_GETTER_WITH_DEFAULT(Scope*, scope, nullptr) |
71 PARSE_INFO_GETTER(Handle<Context>, context) | 70 PARSE_INFO_GETTER(Handle<Context>, context) |
72 PARSE_INFO_GETTER(Handle<SharedFunctionInfo>, shared_info) | 71 PARSE_INFO_GETTER(Handle<SharedFunctionInfo>, shared_info) |
73 | 72 |
74 #undef PARSE_INFO_GETTER | 73 #undef PARSE_INFO_GETTER |
75 #undef PARSE_INFO_GETTER_WITH_DEFAULT | 74 #undef PARSE_INFO_GETTER_WITH_DEFAULT |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 return AbortOptimization( | 451 return AbortOptimization( |
453 info()->shared_info()->disable_optimization_reason()); | 452 info()->shared_info()->disable_optimization_reason()); |
454 } | 453 } |
455 | 454 |
456 graph_builder_ = (info()->is_tracking_positions() || FLAG_trace_ic) | 455 graph_builder_ = (info()->is_tracking_positions() || FLAG_trace_ic) |
457 ? new (info()->zone()) | 456 ? new (info()->zone()) |
458 HOptimizedGraphBuilderWithPositions(info()) | 457 HOptimizedGraphBuilderWithPositions(info()) |
459 : new (info()->zone()) HOptimizedGraphBuilder(info()); | 458 : new (info()->zone()) HOptimizedGraphBuilder(info()); |
460 | 459 |
461 Timer t(this, &time_taken_to_create_graph_); | 460 Timer t(this, &time_taken_to_create_graph_); |
462 // TODO(titzer): ParseInfo::this_has_uses is only used by Crankshaft. Move. | 461 info()->SetThisHasUses(false); |
463 info()->parse_info()->set_this_has_uses(false); | |
464 graph_ = graph_builder_->CreateGraph(); | 462 graph_ = graph_builder_->CreateGraph(); |
465 | 463 |
466 if (isolate()->has_pending_exception()) { | 464 if (isolate()->has_pending_exception()) { |
467 return SetLastStatus(FAILED); | 465 return SetLastStatus(FAILED); |
468 } | 466 } |
469 | 467 |
470 if (graph_ == NULL) return SetLastStatus(BAILED_OUT); | 468 if (graph_ == NULL) return SetLastStatus(BAILED_OUT); |
471 | 469 |
472 if (info()->HasAbortedDueToDependencyChange()) { | 470 if (info()->HasAbortedDueToDependencyChange()) { |
473 // Dependency has changed during graph creation. Let's try again later. | 471 // Dependency has changed during graph creation. Let's try again later. |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 parse_info_ = nullptr; | 1563 parse_info_ = nullptr; |
1566 } | 1564 } |
1567 | 1565 |
1568 #if DEBUG | 1566 #if DEBUG |
1569 void CompilationInfo::PrintAstForTesting() { | 1567 void CompilationInfo::PrintAstForTesting() { |
1570 PrintF("--- Source from AST ---\n%s\n", | 1568 PrintF("--- Source from AST ---\n%s\n", |
1571 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1569 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1572 } | 1570 } |
1573 #endif | 1571 #endif |
1574 } } // namespace v8::internal | 1572 } } // namespace v8::internal |
OLD | NEW |