| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 kRequiresFrame = 1 << 9, | 77 kRequiresFrame = 1 << 9, |
| 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 | |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 CompilationInfo(Handle<JSFunction> closure, Zone* zone); | 90 CompilationInfo(Handle<JSFunction> closure, Zone* zone); |
| 92 CompilationInfo(Isolate* isolate, Zone* zone); | 91 CompilationInfo(Isolate* isolate, Zone* zone); |
| 93 virtual ~CompilationInfo(); | 92 virtual ~CompilationInfo(); |
| 94 | 93 |
| 95 Isolate* isolate() const { | 94 Isolate* isolate() const { |
| 96 return isolate_; | 95 return isolate_; |
| 97 } | 96 } |
| 98 Zone* zone() { return zone_; } | 97 Zone* zone() { return zone_; } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 Handle<Foreign> object_wrapper() { | 358 Handle<Foreign> object_wrapper() { |
| 360 if (object_wrapper_.is_null()) { | 359 if (object_wrapper_.is_null()) { |
| 361 object_wrapper_ = | 360 object_wrapper_ = |
| 362 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); | 361 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); |
| 363 } | 362 } |
| 364 return object_wrapper_; | 363 return object_wrapper_; |
| 365 } | 364 } |
| 366 | 365 |
| 367 void AbortDueToDependencyChange() { | 366 void AbortDueToDependencyChange() { |
| 368 DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 367 DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
| 369 SetFlag(kAbortedDueToDependency); | 368 aborted_due_to_dependency_change_ = true; |
| 370 } | 369 } |
| 371 | 370 |
| 372 bool HasAbortedDueToDependencyChange() const { | 371 bool HasAbortedDueToDependencyChange() const { |
| 373 DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 372 DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
| 374 return GetFlag(kAbortedDueToDependency); | 373 return aborted_due_to_dependency_change_; |
| 375 } | 374 } |
| 376 | 375 |
| 377 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { | 376 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { |
| 378 return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_); | 377 return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_); |
| 379 } | 378 } |
| 380 | 379 |
| 381 int optimization_id() const { return optimization_id_; } | 380 int optimization_id() const { return optimization_id_; } |
| 382 | 381 |
| 383 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } | 382 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } |
| 384 void SetAstValueFactory(AstValueFactory* ast_value_factory, | 383 void SetAstValueFactory(AstValueFactory* ast_value_factory, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 int parameter_count_; | 502 int parameter_count_; |
| 504 | 503 |
| 505 Handle<Foreign> object_wrapper_; | 504 Handle<Foreign> object_wrapper_; |
| 506 | 505 |
| 507 int optimization_id_; | 506 int optimization_id_; |
| 508 | 507 |
| 509 AstValueFactory* ast_value_factory_; | 508 AstValueFactory* ast_value_factory_; |
| 510 bool ast_value_factory_owned_; | 509 bool ast_value_factory_owned_; |
| 511 AstNode::IdGen ast_node_id_gen_; | 510 AstNode::IdGen ast_node_id_gen_; |
| 512 | 511 |
| 512 // This flag is used by the main thread to track whether this compilation |
| 513 // should be abandoned due to dependency change. |
| 514 bool aborted_due_to_dependency_change_; |
| 515 |
| 513 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 516 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
| 514 }; | 517 }; |
| 515 | 518 |
| 516 | 519 |
| 517 // Exactly like a CompilationInfo, except also creates and enters a | 520 // Exactly like a CompilationInfo, except also creates and enters a |
| 518 // Zone on construction and deallocates it on exit. | 521 // Zone on construction and deallocates it on exit. |
| 519 class CompilationInfoWithZone: public CompilationInfo { | 522 class CompilationInfoWithZone: public CompilationInfo { |
| 520 public: | 523 public: |
| 521 explicit CompilationInfoWithZone(Handle<Script> script) | 524 explicit CompilationInfoWithZone(Handle<Script> script) |
| 522 : CompilationInfo(script, &zone_), | 525 : CompilationInfo(script, &zone_), |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 Zone zone_; | 743 Zone zone_; |
| 741 unsigned info_zone_start_allocation_size_; | 744 unsigned info_zone_start_allocation_size_; |
| 742 base::ElapsedTimer timer_; | 745 base::ElapsedTimer timer_; |
| 743 | 746 |
| 744 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 747 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 745 }; | 748 }; |
| 746 | 749 |
| 747 } } // namespace v8::internal | 750 } } // namespace v8::internal |
| 748 | 751 |
| 749 #endif // V8_COMPILER_H_ | 752 #endif // V8_COMPILER_H_ |
| OLD | NEW |