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" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
| 15 class AstValueFactory; |
15 class ScriptData; | 16 class ScriptData; |
16 class HydrogenCodeStub; | 17 class HydrogenCodeStub; |
17 | 18 |
18 // ParseRestriction is used to restrict the set of valid statements in a | 19 // ParseRestriction is used to restrict the set of valid statements in a |
19 // unit of compilation. Restriction violations cause a syntax error. | 20 // unit of compilation. Restriction violations cause a syntax error. |
20 enum ParseRestriction { | 21 enum ParseRestriction { |
21 NO_PARSE_RESTRICTION, // All expressions are allowed. | 22 NO_PARSE_RESTRICTION, // All expressions are allowed. |
22 ONLY_SINGLE_FUNCTION_LITERAL // Only a single FunctionLiteral expression. | 23 ONLY_SINGLE_FUNCTION_LITERAL // Only a single FunctionLiteral expression. |
23 }; | 24 }; |
24 | 25 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 315 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
315 return abort_due_to_dependency_; | 316 return abort_due_to_dependency_; |
316 } | 317 } |
317 | 318 |
318 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { | 319 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { |
319 return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_); | 320 return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_); |
320 } | 321 } |
321 | 322 |
322 int optimization_id() const { return optimization_id_; } | 323 int optimization_id() const { return optimization_id_; } |
323 | 324 |
| 325 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } |
| 326 void SetAstValueFactory(AstValueFactory* ast_value_factory) { |
| 327 ast_value_factory_ = ast_value_factory; |
| 328 } |
| 329 |
324 protected: | 330 protected: |
325 CompilationInfo(Handle<Script> script, | 331 CompilationInfo(Handle<Script> script, |
326 Zone* zone); | 332 Zone* zone); |
327 CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 333 CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
328 Zone* zone); | 334 Zone* zone); |
329 CompilationInfo(HydrogenCodeStub* stub, | 335 CompilationInfo(HydrogenCodeStub* stub, |
330 Isolate* isolate, | 336 Isolate* isolate, |
331 Zone* zone); | 337 Zone* zone); |
332 | 338 |
333 private: | 339 private: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 463 |
458 // Number of parameters used for compilation of stubs that require arguments. | 464 // Number of parameters used for compilation of stubs that require arguments. |
459 int parameter_count_; | 465 int parameter_count_; |
460 | 466 |
461 bool this_has_uses_; | 467 bool this_has_uses_; |
462 | 468 |
463 Handle<Foreign> object_wrapper_; | 469 Handle<Foreign> object_wrapper_; |
464 | 470 |
465 int optimization_id_; | 471 int optimization_id_; |
466 | 472 |
| 473 AstValueFactory* ast_value_factory_; |
| 474 |
467 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 475 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
468 }; | 476 }; |
469 | 477 |
470 | 478 |
471 // Exactly like a CompilationInfo, except also creates and enters a | 479 // Exactly like a CompilationInfo, except also creates and enters a |
472 // Zone on construction and deallocates it on exit. | 480 // Zone on construction and deallocates it on exit. |
473 class CompilationInfoWithZone: public CompilationInfo { | 481 class CompilationInfoWithZone: public CompilationInfo { |
474 public: | 482 public: |
475 explicit CompilationInfoWithZone(Handle<Script> script) | 483 explicit CompilationInfoWithZone(Handle<Script> script) |
476 : CompilationInfo(script, &zone_), | 484 : CompilationInfo(script, &zone_), |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 unsigned info_zone_start_allocation_size_; | 701 unsigned info_zone_start_allocation_size_; |
694 ElapsedTimer timer_; | 702 ElapsedTimer timer_; |
695 | 703 |
696 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 704 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
697 }; | 705 }; |
698 | 706 |
699 | 707 |
700 } } // namespace v8::internal | 708 } } // namespace v8::internal |
701 | 709 |
702 #endif // V8_COMPILER_H_ | 710 #endif // V8_COMPILER_H_ |
OLD | NEW |