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/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 ONLY_SINGLE_FUNCTION_LITERAL // Only a single FunctionLiteral expression. | 23 ONLY_SINGLE_FUNCTION_LITERAL // Only a single FunctionLiteral expression. |
24 }; | 24 }; |
25 | 25 |
26 struct OffsetRange { | 26 struct OffsetRange { |
27 OffsetRange(int from, int to) : from(from), to(to) {} | 27 OffsetRange(int from, int to) : from(from), to(to) {} |
28 int from; | 28 int from; |
29 int to; | 29 int to; |
30 }; | 30 }; |
31 | 31 |
32 | 32 |
| 33 class InlinedFunctionInfo { |
| 34 public: |
| 35 explicit InlinedFunctionInfo(Handle<SharedFunctionInfo> shared) |
| 36 : shared_(shared), start_position_(shared->start_position()) {} |
| 37 |
| 38 Handle<SharedFunctionInfo> shared() const { return shared_; } |
| 39 int start_position() const { return start_position_; } |
| 40 |
| 41 private: |
| 42 Handle<SharedFunctionInfo> shared_; |
| 43 int start_position_; |
| 44 }; |
| 45 |
| 46 |
33 class ScriptData { | 47 class ScriptData { |
34 public: | 48 public: |
35 ScriptData(const byte* data, int length); | 49 ScriptData(const byte* data, int length); |
36 ~ScriptData() { | 50 ~ScriptData() { |
37 if (owns_data_) DeleteArray(data_); | 51 if (owns_data_) DeleteArray(data_); |
38 } | 52 } |
39 | 53 |
40 const byte* data() const { return data_; } | 54 const byte* data() const { return data_; } |
41 int length() const { return length_; } | 55 int length() const { return length_; } |
42 bool rejected() const { return rejected_; } | 56 bool rejected() const { return rejected_; } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 inline void AddNoFrameRange(int from, int to) { | 390 inline void AddNoFrameRange(int from, int to) { |
377 if (no_frame_ranges_) no_frame_ranges_->Add(OffsetRange(from, to)); | 391 if (no_frame_ranges_) no_frame_ranges_->Add(OffsetRange(from, to)); |
378 } | 392 } |
379 | 393 |
380 List<OffsetRange>* ReleaseNoFrameRanges() { | 394 List<OffsetRange>* ReleaseNoFrameRanges() { |
381 List<OffsetRange>* result = no_frame_ranges_; | 395 List<OffsetRange>* result = no_frame_ranges_; |
382 no_frame_ranges_ = NULL; | 396 no_frame_ranges_ = NULL; |
383 return result; | 397 return result; |
384 } | 398 } |
385 | 399 |
| 400 List<InlinedFunctionInfo>* inlined_function_infos() { |
| 401 return inlined_function_infos_; |
| 402 } |
| 403 List<int>* inlining_id_to_function_id() { |
| 404 return inlining_id_to_function_id_; |
| 405 } |
| 406 int GetInlinedFunctionId(Handle<SharedFunctionInfo> shared); |
| 407 List<InlinedFunctionInfo>* ReleaseInlinedFunctonInfos() { |
| 408 List<InlinedFunctionInfo>* result = inlined_function_infos_; |
| 409 inlined_function_infos_ = NULL; |
| 410 return result; |
| 411 } |
| 412 |
| 413 |
386 Handle<Foreign> object_wrapper() { | 414 Handle<Foreign> object_wrapper() { |
387 if (object_wrapper_.is_null()) { | 415 if (object_wrapper_.is_null()) { |
388 object_wrapper_ = | 416 object_wrapper_ = |
389 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); | 417 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); |
390 } | 418 } |
391 return object_wrapper_; | 419 return object_wrapper_; |
392 } | 420 } |
393 | 421 |
394 void AbortDueToDependencyChange() { | 422 void AbortDueToDependencyChange() { |
395 DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 423 DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 Handle<T> handle(*(*object)); | 547 Handle<T> handle(*(*object)); |
520 *object = handle; | 548 *object = handle; |
521 } | 549 } |
522 } | 550 } |
523 | 551 |
524 BailoutReason bailout_reason_; | 552 BailoutReason bailout_reason_; |
525 | 553 |
526 int prologue_offset_; | 554 int prologue_offset_; |
527 | 555 |
528 List<OffsetRange>* no_frame_ranges_; | 556 List<OffsetRange>* no_frame_ranges_; |
| 557 List<InlinedFunctionInfo>* inlined_function_infos_; |
| 558 List<int>* inlining_id_to_function_id_; |
529 | 559 |
530 // A copy of shared_info()->opt_count() to avoid handle deref | 560 // A copy of shared_info()->opt_count() to avoid handle deref |
531 // during graph optimization. | 561 // during graph optimization. |
532 int opt_count_; | 562 int opt_count_; |
533 | 563 |
534 // Number of parameters used for compilation of stubs that require arguments. | 564 // Number of parameters used for compilation of stubs that require arguments. |
535 int parameter_count_; | 565 int parameter_count_; |
536 | 566 |
537 Handle<Foreign> object_wrapper_; | 567 Handle<Foreign> object_wrapper_; |
538 | 568 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 Zone zone_; | 806 Zone zone_; |
777 size_t info_zone_start_allocation_size_; | 807 size_t info_zone_start_allocation_size_; |
778 base::ElapsedTimer timer_; | 808 base::ElapsedTimer timer_; |
779 | 809 |
780 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 810 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
781 }; | 811 }; |
782 | 812 |
783 } } // namespace v8::internal | 813 } } // namespace v8::internal |
784 | 814 |
785 #endif // V8_COMPILER_H_ | 815 #endif // V8_COMPILER_H_ |
OLD | NEW |