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

Side by Side Diff: src/compiler.h

Issue 6597029: [Isolates] Merge r 6300:6500 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 years, 10 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/codegen.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return has_global_object() ? closure()->context()->global() : NULL; 111 return has_global_object() ? closure()->context()->global() : NULL;
112 } 112 }
113 113
114 // Accessors for the different compilation modes. 114 // Accessors for the different compilation modes.
115 bool IsOptimizing() const { return mode_ == OPTIMIZE; } 115 bool IsOptimizing() const { return mode_ == OPTIMIZE; }
116 bool IsOptimizable() const { return mode_ == BASE; } 116 bool IsOptimizable() const { return mode_ == BASE; }
117 void SetOptimizing(int osr_ast_id) { 117 void SetOptimizing(int osr_ast_id) {
118 SetMode(OPTIMIZE); 118 SetMode(OPTIMIZE);
119 osr_ast_id_ = osr_ast_id; 119 osr_ast_id_ = osr_ast_id;
120 } 120 }
121 void DisableOptimization() { SetMode(NONOPT); } 121 void DisableOptimization();
122 122
123 // Deoptimization support. 123 // Deoptimization support.
124 bool HasDeoptimizationSupport() const { return supports_deoptimization_; } 124 bool HasDeoptimizationSupport() const { return supports_deoptimization_; }
125 void EnableDeoptimizationSupport() { 125 void EnableDeoptimizationSupport() {
126 ASSERT(IsOptimizable()); 126 ASSERT(IsOptimizable());
127 supports_deoptimization_ = true; 127 supports_deoptimization_ = true;
128 } 128 }
129 129
130 // Determine whether or not we can adaptively optimize. 130 // Determine whether or not we can adaptively optimize.
131 bool AllowOptimize() { 131 bool AllowOptimize() {
132 return V8::UseCrankshaft() && 132 return V8::UseCrankshaft() && !closure_.is_null();
133 !closure_.is_null() &&
134 function_->AllowOptimize();
135 } 133 }
136 134
137 private: 135 private:
138 Isolate* isolate_; 136 Isolate* isolate_;
139 137
140 // Compilation mode. 138 // Compilation mode.
141 // BASE is generated by the full codegen, optionally prepared for bailouts. 139 // BASE is generated by the full codegen, optionally prepared for bailouts.
142 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. 140 // OPTIMIZE is optimized code generated by the Hydrogen-based backend.
143 // NONOPT is generated by the full codegen or the classic backend 141 // NONOPT is generated by the full codegen or the classic backend
144 // and is not prepared for recompilation/bailouts. These functions 142 // and is not prepared for recompilation/bailouts. These functions
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // parameters which then can be executed. If the source code contains other 208 // parameters which then can be executed. If the source code contains other
211 // functions, they will be compiled and allocated as part of the compilation 209 // functions, they will be compiled and allocated as part of the compilation
212 // of the source code. 210 // of the source code.
213 211
214 // Please note this interface returns shared function infos. This means you 212 // Please note this interface returns shared function infos. This means you
215 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a 213 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a
216 // real function with a context. 214 // real function with a context.
217 215
218 class Compiler : public AllStatic { 216 class Compiler : public AllStatic {
219 public: 217 public:
220 // All routines return a JSFunction. 218 // Default maximum number of function optimization attempts before we
221 // If an error occurs an exception is raised and 219 // give up.
222 // the return handle contains NULL. 220 static const int kDefaultMaxOptCount = 10;
221
222 // All routines return a SharedFunctionInfo.
223 // If an error occurs an exception is raised and the return handle
224 // contains NULL.
223 225
224 // Compile a String source within a context. 226 // Compile a String source within a context.
225 static Handle<SharedFunctionInfo> Compile(Handle<String> source, 227 static Handle<SharedFunctionInfo> Compile(Handle<String> source,
226 Handle<Object> script_name, 228 Handle<Object> script_name,
227 int line_offset, 229 int line_offset,
228 int column_offset, 230 int column_offset,
229 v8::Extension* extension, 231 v8::Extension* extension,
230 ScriptDataImpl* pre_data, 232 ScriptDataImpl* pre_data,
231 Handle<Object> script_data, 233 Handle<Object> script_data,
232 NativesFlag is_natives_code); 234 NativesFlag is_natives_code);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 isolate->frame_element_constant_list()->Clear(); 276 isolate->frame_element_constant_list()->Clear();
275 isolate->result_constant_list()->Clear(); 277 isolate->result_constant_list()->Clear();
276 } 278 }
277 } 279 }
278 }; 280 };
279 281
280 282
281 } } // namespace v8::internal 283 } } // namespace v8::internal
282 284
283 #endif // V8_COMPILER_H_ 285 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698