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