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 bool owned = true) { |
| 328 ast_value_factory_ = ast_value_factory; |
| 329 ast_value_factory_owned_ = owned; |
| 330 } |
| 331 |
324 protected: | 332 protected: |
325 CompilationInfo(Handle<Script> script, | 333 CompilationInfo(Handle<Script> script, |
326 Zone* zone); | 334 Zone* zone); |
327 CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 335 CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
328 Zone* zone); | 336 Zone* zone); |
329 CompilationInfo(HydrogenCodeStub* stub, | 337 CompilationInfo(HydrogenCodeStub* stub, |
330 Isolate* isolate, | 338 Isolate* isolate, |
331 Zone* zone); | 339 Zone* zone); |
332 | 340 |
333 private: | 341 private: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 465 |
458 // Number of parameters used for compilation of stubs that require arguments. | 466 // Number of parameters used for compilation of stubs that require arguments. |
459 int parameter_count_; | 467 int parameter_count_; |
460 | 468 |
461 bool this_has_uses_; | 469 bool this_has_uses_; |
462 | 470 |
463 Handle<Foreign> object_wrapper_; | 471 Handle<Foreign> object_wrapper_; |
464 | 472 |
465 int optimization_id_; | 473 int optimization_id_; |
466 | 474 |
| 475 AstValueFactory* ast_value_factory_; |
| 476 bool ast_value_factory_owned_; |
| 477 |
467 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 478 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
468 }; | 479 }; |
469 | 480 |
470 | 481 |
471 // Exactly like a CompilationInfo, except also creates and enters a | 482 // Exactly like a CompilationInfo, except also creates and enters a |
472 // Zone on construction and deallocates it on exit. | 483 // Zone on construction and deallocates it on exit. |
473 class CompilationInfoWithZone: public CompilationInfo { | 484 class CompilationInfoWithZone: public CompilationInfo { |
474 public: | 485 public: |
475 explicit CompilationInfoWithZone(Handle<Script> script) | 486 explicit CompilationInfoWithZone(Handle<Script> script) |
476 : CompilationInfo(script, &zone_), | 487 : CompilationInfo(script, &zone_), |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 unsigned info_zone_start_allocation_size_; | 704 unsigned info_zone_start_allocation_size_; |
694 ElapsedTimer timer_; | 705 ElapsedTimer timer_; |
695 | 706 |
696 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 707 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
697 }; | 708 }; |
698 | 709 |
699 | 710 |
700 } } // namespace v8::internal | 711 } } // namespace v8::internal |
701 | 712 |
702 #endif // V8_COMPILER_H_ | 713 #endif // V8_COMPILER_H_ |
OLD | NEW |