Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/compiler.h

Issue 1233073005: Debugger: prepare code for debugging on a per-function basis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/bailout-reason.h ('k') | src/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Various configuration flags for a compilation, as well as some properties 113 // Various configuration flags for a compilation, as well as some properties
114 // of the compiled code produced by a compilation. 114 // of the compiled code produced by a compilation.
115 enum Flag { 115 enum Flag {
116 kDeferredCalling = 1 << 0, 116 kDeferredCalling = 1 << 0,
117 kNonDeferredCalling = 1 << 1, 117 kNonDeferredCalling = 1 << 1,
118 kSavesCallerDoubles = 1 << 2, 118 kSavesCallerDoubles = 1 << 2,
119 kRequiresFrame = 1 << 3, 119 kRequiresFrame = 1 << 3,
120 kMustNotHaveEagerFrame = 1 << 4, 120 kMustNotHaveEagerFrame = 1 << 4,
121 kDeoptimizationSupport = 1 << 5, 121 kDeoptimizationSupport = 1 << 5,
122 kDebug = 1 << 6, 122 kDebug = 1 << 6,
123 kCompilingForDebugging = 1 << 7, 123 kSerializing = 1 << 7,
124 kSerializing = 1 << 8, 124 kContextSpecializing = 1 << 8,
125 kContextSpecializing = 1 << 9, 125 kFrameSpecializing = 1 << 9,
126 kFrameSpecializing = 1 << 10, 126 kInliningEnabled = 1 << 10,
127 kInliningEnabled = 1 << 11, 127 kTypingEnabled = 1 << 11,
128 kTypingEnabled = 1 << 12, 128 kDisableFutureOptimization = 1 << 12,
129 kDisableFutureOptimization = 1 << 13, 129 kSplittingEnabled = 1 << 13,
130 kSplittingEnabled = 1 << 14, 130 kTypeFeedbackEnabled = 1 << 14,
131 kTypeFeedbackEnabled = 1 << 15, 131 kDeoptimizationEnabled = 1 << 15,
132 kDeoptimizationEnabled = 1 << 16, 132 kSourcePositionsEnabled = 1 << 16,
133 kSourcePositionsEnabled = 1 << 17, 133 kFirstCompile = 1 << 17,
134 kFirstCompile = 1 << 18,
135 }; 134 };
136 135
137 explicit CompilationInfo(ParseInfo* parse_info); 136 explicit CompilationInfo(ParseInfo* parse_info);
138 CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone); 137 CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone);
139 virtual ~CompilationInfo(); 138 virtual ~CompilationInfo();
140 139
141 ParseInfo* parse_info() const { return parse_info_; } 140 ParseInfo* parse_info() const { return parse_info_; }
142 141
143 // ----------------------------------------------------------- 142 // -----------------------------------------------------------
144 // TODO(titzer): inline and delete accessors of ParseInfo 143 // TODO(titzer): inline and delete accessors of ParseInfo
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 void MarkAsRequiresFrame() { SetFlag(kRequiresFrame); } 199 void MarkAsRequiresFrame() { SetFlag(kRequiresFrame); }
201 200
202 bool requires_frame() const { return GetFlag(kRequiresFrame); } 201 bool requires_frame() const { return GetFlag(kRequiresFrame); }
203 202
204 void MarkMustNotHaveEagerFrame() { SetFlag(kMustNotHaveEagerFrame); } 203 void MarkMustNotHaveEagerFrame() { SetFlag(kMustNotHaveEagerFrame); }
205 204
206 bool GetMustNotHaveEagerFrame() const { 205 bool GetMustNotHaveEagerFrame() const {
207 return GetFlag(kMustNotHaveEagerFrame); 206 return GetFlag(kMustNotHaveEagerFrame);
208 } 207 }
209 208
209 // Compiles marked as debug produce unoptimized code with debug break slots.
210 // Inner functions that cannot be compiled w/o context are compiled eagerly.
210 void MarkAsDebug() { SetFlag(kDebug); } 211 void MarkAsDebug() { SetFlag(kDebug); }
211 212
212 bool is_debug() const { return GetFlag(kDebug); } 213 bool is_debug() const { return GetFlag(kDebug); }
213 214
214 void PrepareForSerializing() { SetFlag(kSerializing); } 215 void PrepareForSerializing() { SetFlag(kSerializing); }
215 216
216 bool will_serialize() const { return GetFlag(kSerializing); } 217 bool will_serialize() const { return GetFlag(kSerializing); }
217 218
218 void MarkAsContextSpecializing() { SetFlag(kContextSpecializing); } 219 void MarkAsContextSpecializing() { SetFlag(kContextSpecializing); }
219 220
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return FLAG_optimize_for_size && FLAG_age_code && !will_serialize() && 264 return FLAG_optimize_for_size && FLAG_age_code && !will_serialize() &&
264 !is_debug(); 265 !is_debug();
265 } 266 }
266 267
267 void EnsureFeedbackVector(); 268 void EnsureFeedbackVector();
268 Handle<TypeFeedbackVector> feedback_vector() const { 269 Handle<TypeFeedbackVector> feedback_vector() const {
269 return feedback_vector_; 270 return feedback_vector_;
270 } 271 }
271 void SetCode(Handle<Code> code) { code_ = code; } 272 void SetCode(Handle<Code> code) { code_ = code; }
272 273
273 void MarkCompilingForDebugging() { SetFlag(kCompilingForDebugging); }
274 bool IsCompilingForDebugging() { return GetFlag(kCompilingForDebugging); }
275 void MarkNonOptimizable() { 274 void MarkNonOptimizable() {
276 SetMode(CompilationInfo::NONOPT); 275 SetMode(CompilationInfo::NONOPT);
277 } 276 }
278 277
279 bool ShouldTrapOnDeopt() const { 278 bool ShouldTrapOnDeopt() const {
280 return (FLAG_trap_on_deopt && IsOptimizing()) || 279 return (FLAG_trap_on_deopt && IsOptimizing()) ||
281 (FLAG_trap_on_stub_deopt && IsStub()); 280 (FLAG_trap_on_stub_deopt && IsStub());
282 } 281 }
283 282
284 bool has_global_object() const { 283 bool has_global_object() const {
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 // Please note this interface returns shared function infos. This means you 619 // Please note this interface returns shared function infos. This means you
621 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a 620 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a
622 // real function with a context. 621 // real function with a context.
623 622
624 class Compiler : public AllStatic { 623 class Compiler : public AllStatic {
625 public: 624 public:
626 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode( 625 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode(
627 Handle<JSFunction> function); 626 Handle<JSFunction> function);
628 MUST_USE_RESULT static MaybeHandle<Code> GetLazyCode( 627 MUST_USE_RESULT static MaybeHandle<Code> GetLazyCode(
629 Handle<JSFunction> function); 628 Handle<JSFunction> function);
630 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode( 629
631 Handle<SharedFunctionInfo> shared);
632 MUST_USE_RESULT static MaybeHandle<Code> GetDebugCode( 630 MUST_USE_RESULT static MaybeHandle<Code> GetDebugCode(
633 Handle<JSFunction> function); 631 Handle<JSFunction> function);
632 MUST_USE_RESULT static MaybeHandle<Code> GetDebugCode(
633 Handle<SharedFunctionInfo> shared);
634 634
635 // Parser::Parse, then Compiler::Analyze. 635 // Parser::Parse, then Compiler::Analyze.
636 static bool ParseAndAnalyze(ParseInfo* info); 636 static bool ParseAndAnalyze(ParseInfo* info);
637 // Rewrite, analyze scopes, and renumber. 637 // Rewrite, analyze scopes, and renumber.
638 static bool Analyze(ParseInfo* info); 638 static bool Analyze(ParseInfo* info);
639 // Adds deoptimization support, requires ParseAndAnalyze. 639 // Adds deoptimization support, requires ParseAndAnalyze.
640 static bool EnsureDeoptimizationSupport(CompilationInfo* info); 640 static bool EnsureDeoptimizationSupport(CompilationInfo* info);
641 641
642 static bool EnsureCompiled(Handle<JSFunction> function, 642 static bool EnsureCompiled(Handle<JSFunction> function,
643 ClearExceptionFlag flag); 643 ClearExceptionFlag flag);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 // In the latter case, return the InOptimizationQueue builtin. On failure, 675 // In the latter case, return the InOptimizationQueue builtin. On failure,
676 // return the empty handle. 676 // return the empty handle.
677 MUST_USE_RESULT static MaybeHandle<Code> GetOptimizedCode( 677 MUST_USE_RESULT static MaybeHandle<Code> GetOptimizedCode(
678 Handle<JSFunction> function, Handle<Code> current_code, 678 Handle<JSFunction> function, Handle<Code> current_code,
679 ConcurrencyMode mode, BailoutId osr_ast_id = BailoutId::None(), 679 ConcurrencyMode mode, BailoutId osr_ast_id = BailoutId::None(),
680 JavaScriptFrame* osr_frame = nullptr); 680 JavaScriptFrame* osr_frame = nullptr);
681 681
682 // Generate and return code from previously queued optimization job. 682 // Generate and return code from previously queued optimization job.
683 // On failure, return the empty handle. 683 // On failure, return the empty handle.
684 static Handle<Code> GetConcurrentlyOptimizedCode(OptimizedCompileJob* job); 684 static Handle<Code> GetConcurrentlyOptimizedCode(OptimizedCompileJob* job);
685
686 // TODO(titzer): move this method out of the compiler.
687 static bool DebuggerWantsEagerCompilation(
688 Isolate* isolate, bool allow_lazy_without_ctx = false);
689 }; 685 };
690 686
691 687
692 class CompilationPhase BASE_EMBEDDED { 688 class CompilationPhase BASE_EMBEDDED {
693 public: 689 public:
694 CompilationPhase(const char* name, CompilationInfo* info); 690 CompilationPhase(const char* name, CompilationInfo* info);
695 ~CompilationPhase(); 691 ~CompilationPhase();
696 692
697 protected: 693 protected:
698 bool ShouldProduceTraceOutput() const; 694 bool ShouldProduceTraceOutput() const;
699 695
700 const char* name() const { return name_; } 696 const char* name() const { return name_; }
701 CompilationInfo* info() const { return info_; } 697 CompilationInfo* info() const { return info_; }
702 Isolate* isolate() const { return info()->isolate(); } 698 Isolate* isolate() const { return info()->isolate(); }
703 Zone* zone() { return &zone_; } 699 Zone* zone() { return &zone_; }
704 700
705 private: 701 private:
706 const char* name_; 702 const char* name_;
707 CompilationInfo* info_; 703 CompilationInfo* info_;
708 Zone zone_; 704 Zone zone_;
709 size_t info_zone_start_allocation_size_; 705 size_t info_zone_start_allocation_size_;
710 base::ElapsedTimer timer_; 706 base::ElapsedTimer timer_;
711 707
712 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); 708 DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
713 }; 709 };
714 710
715 } } // namespace v8::internal 711 } } // namespace v8::internal
716 712
717 #endif // V8_COMPILER_H_ 713 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/bailout-reason.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698