| 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,
|
|
|