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

Unified Diff: src/compiler.h

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compilation-cache.cc ('k') | src/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index 273005b8d3cb9b9903c534ca69496ed9fcd93b60..46850e1c9dd10cfe628999bc9b5f475d9a88813b 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -63,6 +63,7 @@ class CompilationInfo BASE_EMBEDDED {
v8::Extension* extension() const { return extension_; }
ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; }
Handle<Context> calling_context() const { return calling_context_; }
+ int osr_ast_id() const { return osr_ast_id_; }
void MarkAsEval() {
ASSERT(!is_lazy());
@@ -97,10 +98,68 @@ class CompilationInfo BASE_EMBEDDED {
ASSERT(is_eval());
calling_context_ = context;
}
+ void SetOsrAstId(int osr_ast_id) {
+ ASSERT(IsOptimizing());
+ osr_ast_id_ = osr_ast_id;
+ }
+
+ bool has_global_object() const {
+ return !closure().is_null() && (closure()->context()->global() != NULL);
+ }
+
+ GlobalObject* global_object() const {
+ return has_global_object() ? closure()->context()->global() : NULL;
+ }
+
+ // Accessors for the different compilation modes.
+ bool IsOptimizing() const { return mode_ == OPTIMIZE; }
+ bool IsOptimizable() const { return mode_ == BASE; }
+ void SetOptimizing(int osr_ast_id) {
+ SetMode(OPTIMIZE);
+ osr_ast_id_ = osr_ast_id;
+ }
+ void DisableOptimization() { SetMode(NONOPT); }
+
+ // Deoptimization support.
+ bool HasDeoptimizationSupport() const { return supports_deoptimization_; }
+ void EnableDeoptimizationSupport() {
+ ASSERT(IsOptimizable());
+ supports_deoptimization_ = true;
+ }
+
+ // Determine whether or not we can adaptively optimize.
+ bool AllowOptimize() {
+ return V8::UseCrankshaft() &&
+ !closure_.is_null() &&
+ function_->AllowOptimize();
+ }
private:
Isolate* isolate_;
+ // Compilation mode.
+ // BASE is generated by the full codegen, optionally prepared for bailouts.
+ // OPTIMIZE is optimized code generated by the Hydrogen-based backend.
+ // NONOPT is generated by the full codegen or the classic backend
+ // and is not prepared for recompilation/bailouts. These functions
+ // are never recompiled.
+ enum Mode {
+ BASE,
+ OPTIMIZE,
+ NONOPT
+ };
+
+ CompilationInfo() : function_(NULL) {}
+
+ void Initialize(Mode mode) {
+ mode_ = V8::UseCrankshaft() ? mode : NONOPT;
+ }
+
+ void SetMode(Mode mode) {
+ ASSERT(V8::UseCrankshaft());
+ mode_ = mode;
+ }
+
// Flags using template class BitField<type, start, length>. All are
// false by default.
//
@@ -136,6 +195,11 @@ class CompilationInfo BASE_EMBEDDED {
// handle otherwise.
Handle<Context> calling_context_;
+ // Compilation mode flag and whether deoptimization is allowed.
+ Mode mode_;
+ bool supports_deoptimization_;
+ int osr_ast_id_;
+
DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
};
@@ -191,7 +255,6 @@ class Compiler : public AllStatic {
static bool MakeCodeForLiveEdit(CompilationInfo* info);
#endif
- private:
static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
Handle<String> name,
int start_position,
« no previous file with comments | « src/compilation-cache.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698