OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_H_ | 5 #ifndef V8_COMPILER_H_ |
6 #define V8_COMPILER_H_ | 6 #define V8_COMPILER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(ScriptData); | 57 DISALLOW_COPY_AND_ASSIGN(ScriptData); |
58 }; | 58 }; |
59 | 59 |
60 | 60 |
61 // CompilationInfo encapsulates some information known at compile time. It | 61 // CompilationInfo encapsulates some information known at compile time. It |
62 // is constructed based on the resources available at compile-time. | 62 // is constructed based on the resources available at compile-time. |
63 class CompilationInfo { | 63 class CompilationInfo { |
64 public: | 64 public: |
65 CompilationInfo(Handle<JSFunction> closure, Zone* zone); | 65 CompilationInfo(Handle<JSFunction> closure, Zone* zone); |
| 66 CompilationInfo(Isolate* isolate, Zone* zone); |
66 virtual ~CompilationInfo(); | 67 virtual ~CompilationInfo(); |
67 | 68 |
68 Isolate* isolate() const { | 69 Isolate* isolate() const { |
69 return isolate_; | 70 return isolate_; |
70 } | 71 } |
71 Zone* zone() { return zone_; } | 72 Zone* zone() { return zone_; } |
72 bool is_osr() const { return !osr_ast_id_.IsNone(); } | 73 bool is_osr() const { return !osr_ast_id_.IsNone(); } |
73 bool is_lazy() const { return IsLazy::decode(flags_); } | 74 bool is_lazy() const { return IsLazy::decode(flags_); } |
74 bool is_eval() const { return IsEval::decode(flags_); } | 75 bool is_eval() const { return IsEval::decode(flags_); } |
75 bool is_global() const { return IsGlobal::decode(flags_); } | 76 bool is_global() const { return IsGlobal::decode(flags_); } |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 enum Mode { | 385 enum Mode { |
385 BASE, | 386 BASE, |
386 OPTIMIZE, | 387 OPTIMIZE, |
387 NONOPT, | 388 NONOPT, |
388 STUB | 389 STUB |
389 }; | 390 }; |
390 | 391 |
391 void Initialize(Isolate* isolate, Mode mode, Zone* zone); | 392 void Initialize(Isolate* isolate, Mode mode, Zone* zone); |
392 | 393 |
393 void SetMode(Mode mode) { | 394 void SetMode(Mode mode) { |
394 ASSERT(isolate()->use_crankshaft()); | |
395 mode_ = mode; | 395 mode_ = mode; |
396 } | 396 } |
397 | 397 |
398 // Flags using template class BitField<type, start, length>. All are | 398 // Flags using template class BitField<type, start, length>. All are |
399 // false by default. | 399 // false by default. |
400 // | 400 // |
401 // Compilation is either eager or lazy. | 401 // Compilation is either eager or lazy. |
402 class IsLazy: public BitField<bool, 0, 1> {}; | 402 class IsLazy: public BitField<bool, 0, 1> {}; |
403 // Flags that can be set for eager compilation. | 403 // Flags that can be set for eager compilation. |
404 class IsEval: public BitField<bool, 1, 1> {}; | 404 class IsEval: public BitField<bool, 1, 1> {}; |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 Zone zone_; | 736 Zone zone_; |
737 unsigned info_zone_start_allocation_size_; | 737 unsigned info_zone_start_allocation_size_; |
738 base::ElapsedTimer timer_; | 738 base::ElapsedTimer timer_; |
739 | 739 |
740 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 740 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
741 }; | 741 }; |
742 | 742 |
743 } } // namespace v8::internal | 743 } } // namespace v8::internal |
744 | 744 |
745 #endif // V8_COMPILER_H_ | 745 #endif // V8_COMPILER_H_ |
OLD | NEW |