Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 pre_parse_data_ = pre_parse_data; | 113 pre_parse_data_ = pre_parse_data; |
| 114 } | 114 } |
| 115 void SetCallingContext(Handle<Context> context) { | 115 void SetCallingContext(Handle<Context> context) { |
| 116 ASSERT(is_eval()); | 116 ASSERT(is_eval()); |
| 117 calling_context_ = context; | 117 calling_context_ = context; |
| 118 } | 118 } |
| 119 void SetOsrAstId(int osr_ast_id) { | 119 void SetOsrAstId(int osr_ast_id) { |
| 120 ASSERT(IsOptimizing()); | 120 ASSERT(IsOptimizing()); |
| 121 osr_ast_id_ = osr_ast_id; | 121 osr_ast_id_ = osr_ast_id; |
| 122 } | 122 } |
| 123 void MarkCompilingForDebugging(Handle<Code> current_code) { | |
| 124 ASSERT(mode_ != OPTIMIZE); | |
| 125 ASSERT(current_code->kind() == Code::FUNCTION); | |
| 126 compiling_for_debugging_ = true; | |
| 127 if (current_code->is_compiled_optimizable()) { | |
| 128 EnableDeoptimizationSupport(); | |
| 129 } else { | |
| 130 mode_ = CompilationInfo::NONOPT; | |
| 131 } | |
| 132 } | |
| 133 bool CompilingForDebugging() { return compiling_for_debugging_; } | |
| 123 | 134 |
| 124 bool has_global_object() const { | 135 bool has_global_object() const { |
| 125 return !closure().is_null() && (closure()->context()->global() != NULL); | 136 return !closure().is_null() && (closure()->context()->global() != NULL); |
| 126 } | 137 } |
| 127 | 138 |
| 128 GlobalObject* global_object() const { | 139 GlobalObject* global_object() const { |
| 129 return has_global_object() ? closure()->context()->global() : NULL; | 140 return has_global_object() ? closure()->context()->global() : NULL; |
| 130 } | 141 } |
| 131 | 142 |
| 132 // Accessors for the different compilation modes. | 143 // Accessors for the different compilation modes. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 | 238 |
| 228 // The context of the caller is needed for eval code, and will be a null | 239 // The context of the caller is needed for eval code, and will be a null |
| 229 // handle otherwise. | 240 // handle otherwise. |
| 230 Handle<Context> calling_context_; | 241 Handle<Context> calling_context_; |
| 231 | 242 |
| 232 // Compilation mode flag and whether deoptimization is allowed. | 243 // Compilation mode flag and whether deoptimization is allowed. |
| 233 Mode mode_; | 244 Mode mode_; |
| 234 bool supports_deoptimization_; | 245 bool supports_deoptimization_; |
| 235 int osr_ast_id_; | 246 int osr_ast_id_; |
| 236 | 247 |
| 248 // If compiling for debugging produce just full code matching the | |
| 249 // initial mode setting. | |
| 250 bool compiling_for_debugging_; | |
|
Kevin Millikin (Chromium)
2011/09/29 10:47:35
There's a bit field "flags_" in this class. I thi
Søren Thygesen Gjesse
2011/09/30 08:33:22
Good point - changed.
| |
| 251 | |
| 237 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 252 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
| 238 }; | 253 }; |
| 239 | 254 |
| 240 | 255 |
| 241 // The V8 compiler | 256 // The V8 compiler |
| 242 // | 257 // |
| 243 // General strategy: Source code is translated into an anonymous function w/o | 258 // General strategy: Source code is translated into an anonymous function w/o |
| 244 // parameters which then can be executed. If the source code contains other | 259 // parameters which then can be executed. If the source code contains other |
| 245 // functions, they will be compiled and allocated as part of the compilation | 260 // functions, they will be compiled and allocated as part of the compilation |
| 246 // of the source code. | 261 // of the source code. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 | 313 |
| 299 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 314 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 300 CompilationInfo* info, | 315 CompilationInfo* info, |
| 301 Handle<SharedFunctionInfo> shared); | 316 Handle<SharedFunctionInfo> shared); |
| 302 }; | 317 }; |
| 303 | 318 |
| 304 | 319 |
| 305 } } // namespace v8::internal | 320 } } // namespace v8::internal |
| 306 | 321 |
| 307 #endif // V8_COMPILER_H_ | 322 #endif // V8_COMPILER_H_ |
| OLD | NEW |