| 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_FULL_CODEGEN_FULL_CODEGEN_H_ | 5 #ifndef V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
| 6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
| 10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 uint32_t pc_offset(uint32_t index) { | 1003 uint32_t pc_offset(uint32_t index) { |
| 1004 return Memory::uint32_at(entry_at(index) + kPcOffsetOffset); | 1004 return Memory::uint32_at(entry_at(index) + kPcOffsetOffset); |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 Address pc(uint32_t index) { | 1007 Address pc(uint32_t index) { |
| 1008 return instruction_start_ + pc_offset(index); | 1008 return instruction_start_ + pc_offset(index); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 enum BackEdgeState { | 1011 enum BackEdgeState { INTERRUPT, ON_STACK_REPLACEMENT }; |
| 1012 INTERRUPT, | |
| 1013 ON_STACK_REPLACEMENT, | |
| 1014 OSR_AFTER_STACK_CHECK | |
| 1015 }; | |
| 1016 | 1012 |
| 1017 // Increase allowed loop nesting level by one and patch those matching loops. | 1013 // Increase allowed loop nesting level by one and patch those matching loops. |
| 1018 static void Patch(Isolate* isolate, Code* unoptimized_code); | 1014 static void Patch(Isolate* isolate, Code* unoptimized_code); |
| 1019 | 1015 |
| 1020 // Patch the back edge to the target state, provided the correct callee. | 1016 // Patch the back edge to the target state, provided the correct callee. |
| 1021 static void PatchAt(Code* unoptimized_code, | 1017 static void PatchAt(Code* unoptimized_code, |
| 1022 Address pc, | 1018 Address pc, |
| 1023 BackEdgeState target_state, | 1019 BackEdgeState target_state, |
| 1024 Code* replacement_code); | 1020 Code* replacement_code); |
| 1025 | 1021 |
| 1026 // Change all patched back edges back to normal interrupts. | 1022 // Change all patched back edges back to normal interrupts. |
| 1027 static void Revert(Isolate* isolate, | 1023 static void Revert(Isolate* isolate, |
| 1028 Code* unoptimized_code); | 1024 Code* unoptimized_code); |
| 1029 | 1025 |
| 1030 // Change a back edge patched for on-stack replacement to perform a | |
| 1031 // stack check first. | |
| 1032 static void AddStackCheck(Handle<Code> code, uint32_t pc_offset); | |
| 1033 | |
| 1034 // Revert the patch by AddStackCheck. | |
| 1035 static void RemoveStackCheck(Handle<Code> code, uint32_t pc_offset); | |
| 1036 | |
| 1037 // Return the current patch state of the back edge. | 1026 // Return the current patch state of the back edge. |
| 1038 static BackEdgeState GetBackEdgeState(Isolate* isolate, | 1027 static BackEdgeState GetBackEdgeState(Isolate* isolate, |
| 1039 Code* unoptimized_code, | 1028 Code* unoptimized_code, |
| 1040 Address pc_after); | 1029 Address pc_after); |
| 1041 | 1030 |
| 1042 #ifdef DEBUG | 1031 #ifdef DEBUG |
| 1043 // Verify that all back edges of a certain loop depth are patched. | 1032 // Verify that all back edges of a certain loop depth are patched. |
| 1044 static bool Verify(Isolate* isolate, Code* unoptimized_code); | 1033 static bool Verify(Isolate* isolate, Code* unoptimized_code); |
| 1045 #endif // DEBUG | 1034 #endif // DEBUG |
| 1046 | 1035 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1059 Address start_; | 1048 Address start_; |
| 1060 Address instruction_start_; | 1049 Address instruction_start_; |
| 1061 uint32_t length_; | 1050 uint32_t length_; |
| 1062 }; | 1051 }; |
| 1063 | 1052 |
| 1064 | 1053 |
| 1065 } // namespace internal | 1054 } // namespace internal |
| 1066 } // namespace v8 | 1055 } // namespace v8 |
| 1067 | 1056 |
| 1068 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 1057 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
| OLD | NEW |