Chromium Code Reviews| Index: src/compiler.h |
| diff --git a/src/compiler.h b/src/compiler.h |
| index 6df21de357ae9c10bb1aa3419a6018f365b64ebc..3c622ea58c9991d9fefca6a5a1415da6288aa44a 100644 |
| --- a/src/compiler.h |
| +++ b/src/compiler.h |
| @@ -39,7 +39,7 @@ class ScriptDataImpl; |
| // CompilationInfo encapsulates some information known at compile time. It |
| // is constructed based on the resources available at compile-time. |
| -class CompilationInfo BASE_EMBEDDED { |
| +class CompilationInfo { |
| public: |
| CompilationInfo(Handle<Script> script, Zone* zone); |
| CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone); |
| @@ -180,6 +180,13 @@ class CompilationInfo BASE_EMBEDDED { |
| deferred_handles_ = deferred_handles; |
| } |
| + void SaveHandles() { |
| + SaveHandle(&closure_); |
| + SaveHandle(&shared_info_); |
| + SaveHandle(&calling_context_); |
| + SaveHandle(&script_); |
| + } |
| + |
| private: |
| Isolate* isolate_; |
| @@ -268,6 +275,14 @@ class CompilationInfo BASE_EMBEDDED { |
| DeferredHandles* deferred_handles_; |
| + template<typename T> |
| + void SaveHandle(Handle<T> *object) { |
| + if (!object->is_null()) { |
| + Handle<T> handle(*(*object)); |
| + *object = handle; |
| + } |
| + } |
| + |
| DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
| }; |
| @@ -333,7 +348,8 @@ class OptimizingCompiler: public ZoneObject { |
| time_taken_to_create_graph_(0), |
| time_taken_to_optimize_(0), |
| time_taken_to_codegen_(0), |
| - last_status_(FAILED) { } |
| + last_status_(FAILED), |
| + abort_optimization_(false) { } |
| enum Status { |
| FAILED, BAILED_OUT, SUCCEEDED |
| @@ -346,6 +362,13 @@ class OptimizingCompiler: public ZoneObject { |
| Status last_status() const { return last_status_; } |
| CompilationInfo* info() const { return info_; } |
| + void DoPendingAbort() { |
| + if (abort_optimization_) { |
| + info_->AbortOptimization(); |
| + info_->shared_info()->DisableOptimization(); |
| + } |
| + } |
| + |
| private: |
| CompilationInfo* info_; |
| TypeFeedbackOracle* oracle_; |
| @@ -356,6 +379,7 @@ class OptimizingCompiler: public ZoneObject { |
| int64_t time_taken_to_optimize_; |
| int64_t time_taken_to_codegen_; |
| Status last_status_; |
| + bool abort_optimization_; |
|
Yang
2012/07/19 15:56:01
imo checking for BAILED_OUT status after the paral
sanjoy
2012/07/19 16:25:36
Done.
|
| MUST_USE_RESULT Status SetLastStatus(Status status) { |
| last_status_ = status; |
| @@ -367,6 +391,10 @@ class OptimizingCompiler: public ZoneObject { |
| info_->shared_info()->DisableOptimization(); |
| return SetLastStatus(BAILED_OUT); |
| } |
| + MUST_USE_RESULT Status DeferAbortOptimization() { |
| + abort_optimization_ = true; |
| + return SetLastStatus(BAILED_OUT); |
| + } |
| struct Timer { |
| Timer(OptimizingCompiler* compiler, int64_t* location) |
| @@ -432,6 +460,8 @@ class Compiler : public AllStatic { |
| // success and false if the compilation resulted in a stack overflow. |
| static bool CompileLazy(CompilationInfo* info); |
| + static void RecompileParallel(Handle<JSFunction> function); |
| + |
| // Compile a shared function info object (the function is possibly lazily |
| // compiled). |
| static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, |
| @@ -443,6 +473,8 @@ class Compiler : public AllStatic { |
| bool is_toplevel, |
| Handle<Script> script); |
| + static void InstallOptimizedCode(OptimizingCompiler* info); |
| + |
| #ifdef ENABLE_DEBUGGER_SUPPORT |
| static bool MakeCodeForLiveEdit(CompilationInfo* info); |
| #endif |