| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 | 105 |
| 106 // CompilationInfo encapsulates some information known at compile time. It | 106 // CompilationInfo encapsulates some information known at compile time. It |
| 107 // is constructed based on the resources available at compile-time. | 107 // is constructed based on the resources available at compile-time. |
| 108 class CompilationInfo { | 108 class CompilationInfo { |
| 109 public: | 109 public: |
| 110 // Various configuration flags for a compilation, as well as some properties | 110 // Various configuration flags for a compilation, as well as some properties |
| 111 // of the compiled code produced by a compilation. | 111 // of the compiled code produced by a compilation. |
| 112 enum Flag { | 112 enum Flag { |
| 113 kDeferredCalling = 1 << 7, | 113 kDeferredCalling = 1 << 0, |
| 114 kNonDeferredCalling = 1 << 8, | 114 kNonDeferredCalling = 1 << 1, |
| 115 kSavesCallerDoubles = 1 << 9, | 115 kSavesCallerDoubles = 1 << 2, |
| 116 kRequiresFrame = 1 << 10, | 116 kRequiresFrame = 1 << 3, |
| 117 kMustNotHaveEagerFrame = 1 << 11, | 117 kThisHasUses = 1 << 4, |
| 118 kDeoptimizationSupport = 1 << 12, | 118 kMustNotHaveEagerFrame = 1 << 5, |
| 119 kDebug = 1 << 13, | 119 kDeoptimizationSupport = 1 << 6, |
| 120 kCompilingForDebugging = 1 << 14, | 120 kDebug = 1 << 7, |
| 121 kSerializing = 1 << 16, | 121 kCompilingForDebugging = 1 << 8, |
| 122 kContextSpecializing = 1 << 17, | 122 kSerializing = 1 << 9, |
| 123 kInliningEnabled = 1 << 18, | 123 kContextSpecializing = 1 << 10, |
| 124 kTypingEnabled = 1 << 19, | 124 kInliningEnabled = 1 << 11, |
| 125 kDisableFutureOptimization = 1 << 20, | 125 kTypingEnabled = 1 << 12, |
| 126 kSplittingEnabled = 1 << 23, | 126 kDisableFutureOptimization = 1 << 13, |
| 127 kBuiltinInliningEnabled = 1 << 24 | 127 kSplittingEnabled = 1 << 14, |
| 128 kBuiltinInliningEnabled = 1 << 15 |
| 128 }; | 129 }; |
| 129 | 130 |
| 130 explicit CompilationInfo(ParseInfo* parse_info); | 131 explicit CompilationInfo(ParseInfo* parse_info); |
| 131 CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone); | 132 CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone); |
| 132 virtual ~CompilationInfo(); | 133 virtual ~CompilationInfo(); |
| 133 | 134 |
| 134 ParseInfo* parse_info() const { return parse_info_; } | 135 ParseInfo* parse_info() const { return parse_info_; } |
| 135 | 136 |
| 136 // ----------------------------------------------------------- | 137 // ----------------------------------------------------------- |
| 137 // TODO(titzer): inline and delete accessors of ParseInfo | 138 // TODO(titzer): inline and delete accessors of ParseInfo |
| 138 // ----------------------------------------------------------- | 139 // ----------------------------------------------------------- |
| 139 Handle<Script> script() const; | 140 Handle<Script> script() const; |
| 140 bool is_eval() const; | 141 bool is_eval() const; |
| 141 bool is_native() const; | 142 bool is_native() const; |
| 142 bool is_module() const; | 143 bool is_module() const; |
| 143 bool this_has_uses() const; | |
| 144 LanguageMode language_mode() const; | 144 LanguageMode language_mode() const; |
| 145 Handle<JSFunction> closure() const; | 145 Handle<JSFunction> closure() const; |
| 146 FunctionLiteral* function() const; | 146 FunctionLiteral* function() const; |
| 147 Scope* scope() const; | 147 Scope* scope() const; |
| 148 Handle<Context> context() const; | 148 Handle<Context> context() const; |
| 149 Handle<SharedFunctionInfo> shared_info() const; | 149 Handle<SharedFunctionInfo> shared_info() const; |
| 150 bool has_shared_info() const; | 150 bool has_shared_info() const; |
| 151 // ----------------------------------------------------------- | 151 // ----------------------------------------------------------- |
| 152 | 152 |
| 153 Isolate* isolate() const { | 153 Isolate* isolate() const { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 bool is_non_deferred_calling() const { return GetFlag(kNonDeferredCalling); } | 185 bool is_non_deferred_calling() const { return GetFlag(kNonDeferredCalling); } |
| 186 | 186 |
| 187 void MarkAsSavesCallerDoubles() { SetFlag(kSavesCallerDoubles); } | 187 void MarkAsSavesCallerDoubles() { SetFlag(kSavesCallerDoubles); } |
| 188 | 188 |
| 189 bool saves_caller_doubles() const { return GetFlag(kSavesCallerDoubles); } | 189 bool saves_caller_doubles() const { return GetFlag(kSavesCallerDoubles); } |
| 190 | 190 |
| 191 void MarkAsRequiresFrame() { SetFlag(kRequiresFrame); } | 191 void MarkAsRequiresFrame() { SetFlag(kRequiresFrame); } |
| 192 | 192 |
| 193 bool requires_frame() const { return GetFlag(kRequiresFrame); } | 193 bool requires_frame() const { return GetFlag(kRequiresFrame); } |
| 194 | 194 |
| 195 void SetThisHasUses(bool val) { SetFlag(kThisHasUses, val); } |
| 196 |
| 197 bool this_has_uses() const { return GetFlag(kThisHasUses); } |
| 198 |
| 195 void MarkMustNotHaveEagerFrame() { SetFlag(kMustNotHaveEagerFrame); } | 199 void MarkMustNotHaveEagerFrame() { SetFlag(kMustNotHaveEagerFrame); } |
| 196 | 200 |
| 197 bool GetMustNotHaveEagerFrame() const { | 201 bool GetMustNotHaveEagerFrame() const { |
| 198 return GetFlag(kMustNotHaveEagerFrame); | 202 return GetFlag(kMustNotHaveEagerFrame); |
| 199 } | 203 } |
| 200 | 204 |
| 201 void MarkAsDebug() { SetFlag(kDebug); } | 205 void MarkAsDebug() { SetFlag(kDebug); } |
| 202 | 206 |
| 203 bool is_debug() const { return GetFlag(kDebug); } | 207 bool is_debug() const { return GetFlag(kDebug); } |
| 204 | 208 |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 Zone zone_; | 705 Zone zone_; |
| 702 size_t info_zone_start_allocation_size_; | 706 size_t info_zone_start_allocation_size_; |
| 703 base::ElapsedTimer timer_; | 707 base::ElapsedTimer timer_; |
| 704 | 708 |
| 705 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 709 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 706 }; | 710 }; |
| 707 | 711 |
| 708 } } // namespace v8::internal | 712 } } // namespace v8::internal |
| 709 | 713 |
| 710 #endif // V8_COMPILER_H_ | 714 #endif // V8_COMPILER_H_ |
| OLD | NEW |