| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 class ScriptDataImpl; | 39 class ScriptDataImpl; |
| 40 | 40 |
| 41 // CompilationInfo encapsulates some information known at compile time. It | 41 // CompilationInfo encapsulates some information known at compile time. It |
| 42 // is constructed based on the resources available at compile-time. | 42 // is constructed based on the resources available at compile-time. |
| 43 class CompilationInfo BASE_EMBEDDED { | 43 class CompilationInfo BASE_EMBEDDED { |
| 44 public: | 44 public: |
| 45 explicit CompilationInfo(Handle<Script> script); | 45 explicit CompilationInfo(Handle<Script> script); |
| 46 explicit CompilationInfo(Handle<SharedFunctionInfo> shared_info); | 46 explicit CompilationInfo(Handle<SharedFunctionInfo> shared_info); |
| 47 explicit CompilationInfo(Handle<JSFunction> closure); | 47 explicit CompilationInfo(Handle<JSFunction> closure); |
| 48 | 48 |
| 49 Isolate* isolate() { |
| 50 ASSERT(Isolate::Current() == isolate_); |
| 51 return isolate_; |
| 52 } |
| 49 bool is_lazy() const { return (flags_ & IsLazy::mask()) != 0; } | 53 bool is_lazy() const { return (flags_ & IsLazy::mask()) != 0; } |
| 50 bool is_eval() const { return (flags_ & IsEval::mask()) != 0; } | 54 bool is_eval() const { return (flags_ & IsEval::mask()) != 0; } |
| 51 bool is_global() const { return (flags_ & IsGlobal::mask()) != 0; } | 55 bool is_global() const { return (flags_ & IsGlobal::mask()) != 0; } |
| 52 bool is_strict() const { return (flags_ & IsStrict::mask()) != 0; } | 56 bool is_strict() const { return (flags_ & IsStrict::mask()) != 0; } |
| 53 bool is_in_loop() const { return (flags_ & IsInLoop::mask()) != 0; } | 57 bool is_in_loop() const { return (flags_ & IsInLoop::mask()) != 0; } |
| 54 FunctionLiteral* function() const { return function_; } | 58 FunctionLiteral* function() const { return function_; } |
| 55 Scope* scope() const { return scope_; } | 59 Scope* scope() const { return scope_; } |
| 56 Handle<Code> code() const { return code_; } | 60 Handle<Code> code() const { return code_; } |
| 57 Handle<JSFunction> closure() const { return closure_; } | 61 Handle<JSFunction> closure() const { return closure_; } |
| 58 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 62 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 ASSERT(IsOptimizable()); | 139 ASSERT(IsOptimizable()); |
| 136 supports_deoptimization_ = true; | 140 supports_deoptimization_ = true; |
| 137 } | 141 } |
| 138 | 142 |
| 139 // Determine whether or not we can adaptively optimize. | 143 // Determine whether or not we can adaptively optimize. |
| 140 bool AllowOptimize() { | 144 bool AllowOptimize() { |
| 141 return V8::UseCrankshaft() && !closure_.is_null(); | 145 return V8::UseCrankshaft() && !closure_.is_null(); |
| 142 } | 146 } |
| 143 | 147 |
| 144 private: | 148 private: |
| 149 Isolate* isolate_; |
| 150 |
| 145 // Compilation mode. | 151 // Compilation mode. |
| 146 // BASE is generated by the full codegen, optionally prepared for bailouts. | 152 // BASE is generated by the full codegen, optionally prepared for bailouts. |
| 147 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 153 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
| 148 // NONOPT is generated by the full codegen or the classic backend | 154 // NONOPT is generated by the full codegen or the classic backend |
| 149 // and is not prepared for recompilation/bailouts. These functions | 155 // and is not prepared for recompilation/bailouts. These functions |
| 150 // are never recompiled. | 156 // are never recompiled. |
| 151 enum Mode { | 157 enum Mode { |
| 152 BASE, | 158 BASE, |
| 153 OPTIMIZE, | 159 OPTIMIZE, |
| 154 NONOPT | 160 NONOPT |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 285 |
| 280 | 286 |
| 281 // During compilation we need a global list of handles to constants | 287 // During compilation we need a global list of handles to constants |
| 282 // for frame elements. When the zone gets deleted, we make sure to | 288 // for frame elements. When the zone gets deleted, we make sure to |
| 283 // clear this list of handles as well. | 289 // clear this list of handles as well. |
| 284 class CompilationZoneScope : public ZoneScope { | 290 class CompilationZoneScope : public ZoneScope { |
| 285 public: | 291 public: |
| 286 explicit CompilationZoneScope(ZoneScopeMode mode) : ZoneScope(mode) { } | 292 explicit CompilationZoneScope(ZoneScopeMode mode) : ZoneScope(mode) { } |
| 287 virtual ~CompilationZoneScope() { | 293 virtual ~CompilationZoneScope() { |
| 288 if (ShouldDeleteOnExit()) { | 294 if (ShouldDeleteOnExit()) { |
| 289 FrameElement::ClearConstantList(); | 295 Isolate* isolate = Isolate::Current(); |
| 290 Result::ClearConstantList(); | 296 isolate->frame_element_constant_list()->Clear(); |
| 297 isolate->result_constant_list()->Clear(); |
| 291 } | 298 } |
| 292 } | 299 } |
| 293 }; | 300 }; |
| 294 | 301 |
| 295 | 302 |
| 296 } } // namespace v8::internal | 303 } } // namespace v8::internal |
| 297 | 304 |
| 298 #endif // V8_COMPILER_H_ | 305 #endif // V8_COMPILER_H_ |
| OLD | NEW |