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 #ifndef V8_COMPILER_H_ | 5 #ifndef V8_COMPILER_H_ |
6 #define V8_COMPILER_H_ | 6 #define V8_COMPILER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 kMustNotHaveEagerFrame = 1 << 10, | 78 kMustNotHaveEagerFrame = 1 << 10, |
79 kDeoptimizationSupport = 1 << 11, | 79 kDeoptimizationSupport = 1 << 11, |
80 kDebug = 1 << 12, | 80 kDebug = 1 << 12, |
81 kCompilingForDebugging = 1 << 13, | 81 kCompilingForDebugging = 1 << 13, |
82 kParseRestriction = 1 << 14, | 82 kParseRestriction = 1 << 14, |
83 kSerializing = 1 << 15, | 83 kSerializing = 1 << 15, |
84 kContextSpecializing = 1 << 16, | 84 kContextSpecializing = 1 << 16, |
85 kInliningEnabled = 1 << 17, | 85 kInliningEnabled = 1 << 17, |
86 kTypingEnabled = 1 << 18, | 86 kTypingEnabled = 1 << 18, |
87 kDisableFutureOptimization = 1 << 19, | 87 kDisableFutureOptimization = 1 << 19, |
88 kAbortedDueToDependency = 1 << 20, | 88 kToplevel = 1 << 20 |
89 kToplevel = 1 << 21 | |
90 }; | 89 }; |
91 | 90 |
92 CompilationInfo(Handle<JSFunction> closure, Zone* zone); | 91 CompilationInfo(Handle<JSFunction> closure, Zone* zone); |
93 CompilationInfo(Isolate* isolate, Zone* zone); | 92 CompilationInfo(Isolate* isolate, Zone* zone); |
94 virtual ~CompilationInfo(); | 93 virtual ~CompilationInfo(); |
95 | 94 |
96 Isolate* isolate() const { | 95 Isolate* isolate() const { |
97 return isolate_; | 96 return isolate_; |
98 } | 97 } |
99 Zone* zone() { return zone_; } | 98 Zone* zone() { return zone_; } |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 Handle<Foreign> object_wrapper() { | 363 Handle<Foreign> object_wrapper() { |
365 if (object_wrapper_.is_null()) { | 364 if (object_wrapper_.is_null()) { |
366 object_wrapper_ = | 365 object_wrapper_ = |
367 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); | 366 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); |
368 } | 367 } |
369 return object_wrapper_; | 368 return object_wrapper_; |
370 } | 369 } |
371 | 370 |
372 void AbortDueToDependencyChange() { | 371 void AbortDueToDependencyChange() { |
373 DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 372 DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
374 SetFlag(kAbortedDueToDependency); | 373 aborted_due_to_dependency_change_ = true; |
375 } | 374 } |
376 | 375 |
377 bool HasAbortedDueToDependencyChange() const { | 376 bool HasAbortedDueToDependencyChange() const { |
378 DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 377 DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
379 return GetFlag(kAbortedDueToDependency); | 378 return aborted_due_to_dependency_change_; |
380 } | 379 } |
381 | 380 |
382 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { | 381 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { |
383 return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_); | 382 return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_); |
384 } | 383 } |
385 | 384 |
386 int optimization_id() const { return optimization_id_; } | 385 int optimization_id() const { return optimization_id_; } |
387 | 386 |
388 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } | 387 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } |
389 void SetAstValueFactory(AstValueFactory* ast_value_factory, | 388 void SetAstValueFactory(AstValueFactory* ast_value_factory, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 int parameter_count_; | 507 int parameter_count_; |
509 | 508 |
510 Handle<Foreign> object_wrapper_; | 509 Handle<Foreign> object_wrapper_; |
511 | 510 |
512 int optimization_id_; | 511 int optimization_id_; |
513 | 512 |
514 AstValueFactory* ast_value_factory_; | 513 AstValueFactory* ast_value_factory_; |
515 bool ast_value_factory_owned_; | 514 bool ast_value_factory_owned_; |
516 AstNode::IdGen ast_node_id_gen_; | 515 AstNode::IdGen ast_node_id_gen_; |
517 | 516 |
| 517 // This flag is used by the main thread to track whether this compilation |
| 518 // should be abandoned due to dependency change. |
| 519 bool aborted_due_to_dependency_change_; |
| 520 |
518 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 521 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
519 }; | 522 }; |
520 | 523 |
521 | 524 |
522 // Exactly like a CompilationInfo, except also creates and enters a | 525 // Exactly like a CompilationInfo, except also creates and enters a |
523 // Zone on construction and deallocates it on exit. | 526 // Zone on construction and deallocates it on exit. |
524 class CompilationInfoWithZone: public CompilationInfo { | 527 class CompilationInfoWithZone: public CompilationInfo { |
525 public: | 528 public: |
526 explicit CompilationInfoWithZone(Handle<Script> script) | 529 explicit CompilationInfoWithZone(Handle<Script> script) |
527 : CompilationInfo(script, &zone_), | 530 : CompilationInfo(script, &zone_), |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 Zone zone_; | 748 Zone zone_; |
746 unsigned info_zone_start_allocation_size_; | 749 unsigned info_zone_start_allocation_size_; |
747 base::ElapsedTimer timer_; | 750 base::ElapsedTimer timer_; |
748 | 751 |
749 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 752 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
750 }; | 753 }; |
751 | 754 |
752 } } // namespace v8::internal | 755 } } // namespace v8::internal |
753 | 756 |
754 #endif // V8_COMPILER_H_ | 757 #endif // V8_COMPILER_H_ |
OLD | NEW |