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 "allocation.h" | 8 #include "allocation.h" |
9 #include "ast.h" | 9 #include "ast.h" |
10 #include "zone.h" | 10 #include "zone.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 class ScriptData; | 15 class ScriptData; |
16 class HydrogenCodeStub; | 16 class HydrogenCodeStub; |
| 17 class ParserSymbolTable; |
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 |
25 enum CachedDataMode { | 26 enum CachedDataMode { |
26 NO_CACHED_DATA, | 27 NO_CACHED_DATA, |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 300 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
300 return abort_due_to_dependency_; | 301 return abort_due_to_dependency_; |
301 } | 302 } |
302 | 303 |
303 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { | 304 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { |
304 return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_); | 305 return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_); |
305 } | 306 } |
306 | 307 |
307 int optimization_id() const { return optimization_id_; } | 308 int optimization_id() const { return optimization_id_; } |
308 | 309 |
| 310 ParserSymbolTable* symbol_table() const { return symbol_table_; } |
| 311 void SetSymbolTable(ParserSymbolTable* symbol_table) { |
| 312 symbol_table_ = symbol_table; |
| 313 } |
| 314 |
309 protected: | 315 protected: |
310 CompilationInfo(Handle<Script> script, | 316 CompilationInfo(Handle<Script> script, |
311 Zone* zone); | 317 Zone* zone); |
312 CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 318 CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
313 Zone* zone); | 319 Zone* zone); |
314 CompilationInfo(HydrogenCodeStub* stub, | 320 CompilationInfo(HydrogenCodeStub* stub, |
315 Isolate* isolate, | 321 Isolate* isolate, |
316 Zone* zone); | 322 Zone* zone); |
317 | 323 |
318 private: | 324 private: |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 446 |
441 // Number of parameters used for compilation of stubs that require arguments. | 447 // Number of parameters used for compilation of stubs that require arguments. |
442 int parameter_count_; | 448 int parameter_count_; |
443 | 449 |
444 bool this_has_uses_; | 450 bool this_has_uses_; |
445 | 451 |
446 Handle<Foreign> object_wrapper_; | 452 Handle<Foreign> object_wrapper_; |
447 | 453 |
448 int optimization_id_; | 454 int optimization_id_; |
449 | 455 |
| 456 ParserSymbolTable* symbol_table_; |
| 457 |
450 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 458 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
451 }; | 459 }; |
452 | 460 |
453 | 461 |
454 // Exactly like a CompilationInfo, except also creates and enters a | 462 // Exactly like a CompilationInfo, except also creates and enters a |
455 // Zone on construction and deallocates it on exit. | 463 // Zone on construction and deallocates it on exit. |
456 class CompilationInfoWithZone: public CompilationInfo { | 464 class CompilationInfoWithZone: public CompilationInfo { |
457 public: | 465 public: |
458 explicit CompilationInfoWithZone(Handle<Script> script) | 466 explicit CompilationInfoWithZone(Handle<Script> script) |
459 : CompilationInfo(script, &zone_), | 467 : CompilationInfo(script, &zone_), |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 unsigned info_zone_start_allocation_size_; | 684 unsigned info_zone_start_allocation_size_; |
677 ElapsedTimer timer_; | 685 ElapsedTimer timer_; |
678 | 686 |
679 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 687 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
680 }; | 688 }; |
681 | 689 |
682 | 690 |
683 } } // namespace v8::internal | 691 } } // namespace v8::internal |
684 | 692 |
685 #endif // V8_COMPILER_H_ | 693 #endif // V8_COMPILER_H_ |
OLD | NEW |