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

Side by Side Diff: src/compiler.h

Issue 8337009: Reapply "Support for precise stepping in functions compiled before debugging was started (step 2)" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Correct default value Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 pre_parse_data_ = pre_parse_data; 107 pre_parse_data_ = pre_parse_data;
108 } 108 }
109 void SetCallingContext(Handle<Context> context) { 109 void SetCallingContext(Handle<Context> context) {
110 ASSERT(is_eval()); 110 ASSERT(is_eval());
111 calling_context_ = context; 111 calling_context_ = context;
112 } 112 }
113 void SetOsrAstId(int osr_ast_id) { 113 void SetOsrAstId(int osr_ast_id) {
114 ASSERT(IsOptimizing()); 114 ASSERT(IsOptimizing());
115 osr_ast_id_ = osr_ast_id; 115 osr_ast_id_ = osr_ast_id;
116 } 116 }
117 void MarkCompilingForDebugging(Handle<Code> current_code) {
118 ASSERT(mode_ != OPTIMIZE);
119 ASSERT(current_code->kind() == Code::FUNCTION);
120 flags_ |= IsCompilingForDebugging::encode(true);
121 if (current_code->is_compiled_optimizable()) {
122 EnableDeoptimizationSupport();
123 } else {
124 mode_ = CompilationInfo::NONOPT;
125 }
126 }
127 bool IsCompilingForDebugging() {
128 return IsCompilingForDebugging::decode(flags_);
129 }
117 130
118 bool has_global_object() const { 131 bool has_global_object() const {
119 return !closure().is_null() && (closure()->context()->global() != NULL); 132 return !closure().is_null() && (closure()->context()->global() != NULL);
120 } 133 }
121 134
122 GlobalObject* global_object() const { 135 GlobalObject* global_object() const {
123 return has_global_object() ? closure()->context()->global() : NULL; 136 return has_global_object() ? closure()->context()->global() : NULL;
124 } 137 }
125 138
126 // Accessors for the different compilation modes. 139 // Accessors for the different compilation modes.
127 bool IsOptimizing() const { return mode_ == OPTIMIZE; } 140 bool IsOptimizing() const { return mode_ == OPTIMIZE; }
128 bool IsOptimizable() const { return mode_ == BASE; } 141 bool IsOptimizable() const { return mode_ == BASE; }
129 void SetOptimizing(int osr_ast_id) { 142 void SetOptimizing(int osr_ast_id) {
130 SetMode(OPTIMIZE); 143 SetMode(OPTIMIZE);
131 osr_ast_id_ = osr_ast_id; 144 osr_ast_id_ = osr_ast_id;
132 } 145 }
133 void DisableOptimization(); 146 void DisableOptimization();
134 147
135 // Deoptimization support. 148 // Deoptimization support.
136 bool HasDeoptimizationSupport() const { return supports_deoptimization_; } 149 bool HasDeoptimizationSupport() const {
150 return SupportsDeoptimization::decode(flags_);
151 }
137 void EnableDeoptimizationSupport() { 152 void EnableDeoptimizationSupport() {
138 ASSERT(IsOptimizable()); 153 ASSERT(IsOptimizable());
139 supports_deoptimization_ = true; 154 flags_ |= SupportsDeoptimization::encode(true);
140 } 155 }
141 156
142 // Determine whether or not we can adaptively optimize. 157 // Determine whether or not we can adaptively optimize.
143 bool AllowOptimize() { 158 bool AllowOptimize() {
144 return V8::UseCrankshaft() && !closure_.is_null(); 159 return V8::UseCrankshaft() && !closure_.is_null();
145 } 160 }
146 161
147 // Disable all optimization attempts of this info for the rest of the 162 // Disable all optimization attempts of this info for the rest of the
148 // current compilation pipeline. 163 // current compilation pipeline.
149 void AbortOptimization(); 164 void AbortOptimization();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 class IsLazy: public BitField<bool, 0, 1> {}; 203 class IsLazy: public BitField<bool, 0, 1> {};
189 // Flags that can be set for eager compilation. 204 // Flags that can be set for eager compilation.
190 class IsEval: public BitField<bool, 1, 1> {}; 205 class IsEval: public BitField<bool, 1, 1> {};
191 class IsGlobal: public BitField<bool, 2, 1> {}; 206 class IsGlobal: public BitField<bool, 2, 1> {};
192 // Flags that can be set for lazy compilation. 207 // Flags that can be set for lazy compilation.
193 class IsInLoop: public BitField<bool, 3, 1> {}; 208 class IsInLoop: public BitField<bool, 3, 1> {};
194 // Strict mode - used in eager compilation. 209 // Strict mode - used in eager compilation.
195 class IsStrictMode: public BitField<bool, 4, 1> {}; 210 class IsStrictMode: public BitField<bool, 4, 1> {};
196 // Is this a function from our natives. 211 // Is this a function from our natives.
197 class IsNative: public BitField<bool, 6, 1> {}; 212 class IsNative: public BitField<bool, 6, 1> {};
213 // Is this code being compiled with support for deoptimization..
214 class SupportsDeoptimization: public BitField<bool, 7, 1> {};
215 // If compiling for debugging produce just full code matching the
216 // initial mode setting.
217 class IsCompilingForDebugging: public BitField<bool, 8, 1> {};
198 218
199 219
200 unsigned flags_; 220 unsigned flags_;
201 221
202 // Fields filled in by the compilation pipeline. 222 // Fields filled in by the compilation pipeline.
203 // AST filled in by the parser. 223 // AST filled in by the parser.
204 FunctionLiteral* function_; 224 FunctionLiteral* function_;
205 // The scope of the function literal as a convenience. Set to indicate 225 // The scope of the function literal as a convenience. Set to indicate
206 // that scopes have been analyzed. 226 // that scopes have been analyzed.
207 Scope* scope_; 227 Scope* scope_;
208 // The compiled code. 228 // The compiled code.
209 Handle<Code> code_; 229 Handle<Code> code_;
210 230
211 // Possible initial inputs to the compilation process. 231 // Possible initial inputs to the compilation process.
212 Handle<JSFunction> closure_; 232 Handle<JSFunction> closure_;
213 Handle<SharedFunctionInfo> shared_info_; 233 Handle<SharedFunctionInfo> shared_info_;
214 Handle<Script> script_; 234 Handle<Script> script_;
215 235
216 // Fields possibly needed for eager compilation, NULL by default. 236 // Fields possibly needed for eager compilation, NULL by default.
217 v8::Extension* extension_; 237 v8::Extension* extension_;
218 ScriptDataImpl* pre_parse_data_; 238 ScriptDataImpl* pre_parse_data_;
219 239
220 // The context of the caller is needed for eval code, and will be a null 240 // The context of the caller is needed for eval code, and will be a null
221 // handle otherwise. 241 // handle otherwise.
222 Handle<Context> calling_context_; 242 Handle<Context> calling_context_;
223 243
224 // Compilation mode flag and whether deoptimization is allowed. 244 // Compilation mode flag and whether deoptimization is allowed.
225 Mode mode_; 245 Mode mode_;
226 bool supports_deoptimization_;
227 int osr_ast_id_; 246 int osr_ast_id_;
228 247
229 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); 248 DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
230 }; 249 };
231 250
232 251
233 // The V8 compiler 252 // The V8 compiler
234 // 253 //
235 // General strategy: Source code is translated into an anonymous function w/o 254 // General strategy: Source code is translated into an anonymous function w/o
236 // parameters which then can be executed. If the source code contains other 255 // parameters which then can be executed. If the source code contains other
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 309
291 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, 310 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
292 CompilationInfo* info, 311 CompilationInfo* info,
293 Handle<SharedFunctionInfo> shared); 312 Handle<SharedFunctionInfo> shared);
294 }; 313 };
295 314
296 315
297 } } // namespace v8::internal 316 } } // namespace v8::internal
298 317
299 #endif // V8_COMPILER_H_ 318 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698