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

Side by Side Diff: src/compiler.h

Issue 10831172: Introduced TypeFeedbackId and BailoutId types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated review feedback. Created 8 years, 4 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 | « src/ast.cc ('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 // 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 FunctionLiteral* function() const { return function_; } 66 FunctionLiteral* function() const { return function_; }
67 Scope* scope() const { return scope_; } 67 Scope* scope() const { return scope_; }
68 Scope* global_scope() const { return global_scope_; } 68 Scope* global_scope() const { return global_scope_; }
69 Handle<Code> code() const { return code_; } 69 Handle<Code> code() const { return code_; }
70 Handle<JSFunction> closure() const { return closure_; } 70 Handle<JSFunction> closure() const { return closure_; }
71 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 71 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
72 Handle<Script> script() const { return script_; } 72 Handle<Script> script() const { return script_; }
73 v8::Extension* extension() const { return extension_; } 73 v8::Extension* extension() const { return extension_; }
74 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } 74 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; }
75 Handle<Context> calling_context() const { return calling_context_; } 75 Handle<Context> calling_context() const { return calling_context_; }
76 int osr_ast_id() const { return osr_ast_id_; } 76 BailoutId osr_ast_id() const { return osr_ast_id_; }
77 77
78 void MarkAsEval() { 78 void MarkAsEval() {
79 ASSERT(!is_lazy()); 79 ASSERT(!is_lazy());
80 flags_ |= IsEval::encode(true); 80 flags_ |= IsEval::encode(true);
81 } 81 }
82 void MarkAsGlobal() { 82 void MarkAsGlobal() {
83 ASSERT(!is_lazy()); 83 ASSERT(!is_lazy());
84 flags_ |= IsGlobal::encode(true); 84 flags_ |= IsGlobal::encode(true);
85 } 85 }
86 void SetLanguageMode(LanguageMode language_mode) { 86 void SetLanguageMode(LanguageMode language_mode) {
(...skipping 30 matching lines...) Expand all
117 extension_ = extension; 117 extension_ = extension;
118 } 118 }
119 void SetPreParseData(ScriptDataImpl* pre_parse_data) { 119 void SetPreParseData(ScriptDataImpl* pre_parse_data) {
120 ASSERT(!is_lazy()); 120 ASSERT(!is_lazy());
121 pre_parse_data_ = pre_parse_data; 121 pre_parse_data_ = pre_parse_data;
122 } 122 }
123 void SetCallingContext(Handle<Context> context) { 123 void SetCallingContext(Handle<Context> context) {
124 ASSERT(is_eval()); 124 ASSERT(is_eval());
125 calling_context_ = context; 125 calling_context_ = context;
126 } 126 }
127 void SetOsrAstId(int osr_ast_id) {
128 ASSERT(IsOptimizing());
129 osr_ast_id_ = osr_ast_id;
130 }
131 void MarkCompilingForDebugging(Handle<Code> current_code) { 127 void MarkCompilingForDebugging(Handle<Code> current_code) {
132 ASSERT(mode_ != OPTIMIZE); 128 ASSERT(mode_ != OPTIMIZE);
133 ASSERT(current_code->kind() == Code::FUNCTION); 129 ASSERT(current_code->kind() == Code::FUNCTION);
134 flags_ |= IsCompilingForDebugging::encode(true); 130 flags_ |= IsCompilingForDebugging::encode(true);
135 if (current_code->is_compiled_optimizable()) { 131 if (current_code->is_compiled_optimizable()) {
136 EnableDeoptimizationSupport(); 132 EnableDeoptimizationSupport();
137 } else { 133 } else {
138 mode_ = CompilationInfo::NONOPT; 134 mode_ = CompilationInfo::NONOPT;
139 } 135 }
140 } 136 }
141 bool IsCompilingForDebugging() { 137 bool IsCompilingForDebugging() {
142 return IsCompilingForDebugging::decode(flags_); 138 return IsCompilingForDebugging::decode(flags_);
143 } 139 }
144 140
145 bool has_global_object() const { 141 bool has_global_object() const {
146 return !closure().is_null() && (closure()->context()->global() != NULL); 142 return !closure().is_null() && (closure()->context()->global() != NULL);
147 } 143 }
148 144
149 GlobalObject* global_object() const { 145 GlobalObject* global_object() const {
150 return has_global_object() ? closure()->context()->global() : NULL; 146 return has_global_object() ? closure()->context()->global() : NULL;
151 } 147 }
152 148
153 // Accessors for the different compilation modes. 149 // Accessors for the different compilation modes.
154 bool IsOptimizing() const { return mode_ == OPTIMIZE; } 150 bool IsOptimizing() const { return mode_ == OPTIMIZE; }
155 bool IsOptimizable() const { return mode_ == BASE; } 151 bool IsOptimizable() const { return mode_ == BASE; }
156 void SetOptimizing(int osr_ast_id) { 152 void SetOptimizing(BailoutId osr_ast_id) {
157 SetMode(OPTIMIZE); 153 SetMode(OPTIMIZE);
158 osr_ast_id_ = osr_ast_id; 154 osr_ast_id_ = osr_ast_id;
159 } 155 }
160 void DisableOptimization(); 156 void DisableOptimization();
161 157
162 // Deoptimization support. 158 // Deoptimization support.
163 bool HasDeoptimizationSupport() const { 159 bool HasDeoptimizationSupport() const {
164 return SupportsDeoptimization::decode(flags_); 160 return SupportsDeoptimization::decode(flags_);
165 } 161 }
166 void EnableDeoptimizationSupport() { 162 void EnableDeoptimizationSupport() {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // Fields possibly needed for eager compilation, NULL by default. 256 // Fields possibly needed for eager compilation, NULL by default.
261 v8::Extension* extension_; 257 v8::Extension* extension_;
262 ScriptDataImpl* pre_parse_data_; 258 ScriptDataImpl* pre_parse_data_;
263 259
264 // The context of the caller is needed for eval code, and will be a null 260 // The context of the caller is needed for eval code, and will be a null
265 // handle otherwise. 261 // handle otherwise.
266 Handle<Context> calling_context_; 262 Handle<Context> calling_context_;
267 263
268 // Compilation mode flag and whether deoptimization is allowed. 264 // Compilation mode flag and whether deoptimization is allowed.
269 Mode mode_; 265 Mode mode_;
270 int osr_ast_id_; 266 BailoutId osr_ast_id_;
271 267
272 // The zone from which the compilation pipeline working on this 268 // The zone from which the compilation pipeline working on this
273 // CompilationInfo allocates. 269 // CompilationInfo allocates.
274 Zone* zone_; 270 Zone* zone_;
275 271
276 DeferredHandles* deferred_handles_; 272 DeferredHandles* deferred_handles_;
277 273
278 template<typename T> 274 template<typename T>
279 void SaveHandle(Handle<T> *object) { 275 void SaveHandle(Handle<T> *object) {
280 if (!object->is_null()) { 276 if (!object->is_null()) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 465
470 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, 466 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
471 CompilationInfo* info, 467 CompilationInfo* info,
472 Handle<SharedFunctionInfo> shared); 468 Handle<SharedFunctionInfo> shared);
473 }; 469 };
474 470
475 471
476 } } // namespace v8::internal 472 } } // namespace v8::internal
477 473
478 #endif // V8_COMPILER_H_ 474 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698