OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 LOG(UncheckedStringEvent("Entering", StateToString(state_))); | 1118 LOG(UncheckedStringEvent("Entering", StateToString(state_))); |
1119 if (previous_ != NULL) { | 1119 if (previous_ != NULL) { |
1120 LOG(UncheckedStringEvent("From", StateToString(previous_->state_))); | 1120 LOG(UncheckedStringEvent("From", StateToString(previous_->state_))); |
1121 } | 1121 } |
1122 } | 1122 } |
1123 | 1123 |
1124 #ifdef ENABLE_HEAP_PROTECTION | 1124 #ifdef ENABLE_HEAP_PROTECTION |
1125 if (FLAG_protect_heap && previous_ != NULL) { | 1125 if (FLAG_protect_heap && previous_ != NULL) { |
1126 if (state_ == EXTERNAL) { | 1126 if (state_ == EXTERNAL) { |
1127 // We are leaving V8. | 1127 // We are leaving V8. |
1128 ASSERT(previous_ == NULL || previous_->state_ != EXTERNAL); | 1128 ASSERT(previous_->state_ != EXTERNAL); |
1129 Heap::Protect(); | 1129 Heap::Protect(); |
1130 } else { | 1130 } else if (previous_->state_ == EXTERNAL) { |
1131 // Are we entering V8? | 1131 // We are entering V8. |
1132 if (previous_->state_ == EXTERNAL) Heap::Unprotect(); | 1132 Heap::Unprotect(); |
1133 } | 1133 } |
1134 } | 1134 } |
1135 #endif | 1135 #endif |
1136 } | 1136 } |
1137 | 1137 |
1138 | 1138 |
1139 VMState::~VMState() { | 1139 VMState::~VMState() { |
1140 Logger::current_state_ = previous_; | 1140 Logger::current_state_ = previous_; |
1141 | 1141 |
1142 if (FLAG_log_state_changes) { | 1142 if (FLAG_log_state_changes) { |
1143 LOG(UncheckedStringEvent("Leaving", StateToString(state_))); | 1143 LOG(UncheckedStringEvent("Leaving", StateToString(state_))); |
1144 if (previous_ != NULL) { | 1144 if (previous_ != NULL) { |
1145 LOG(UncheckedStringEvent("To", StateToString(previous_->state_))); | 1145 LOG(UncheckedStringEvent("To", StateToString(previous_->state_))); |
1146 } | 1146 } |
1147 } | 1147 } |
1148 | 1148 |
1149 #ifdef ENABLE_HEAP_PROTECTION | 1149 #ifdef ENABLE_HEAP_PROTECTION |
1150 if (FLAG_protect_heap && previous_ != NULL) { | 1150 if (FLAG_protect_heap && previous_ != NULL) { |
1151 if (state_ == EXTERNAL) { | 1151 if (state_ == EXTERNAL) { |
1152 // Are we (re)entering V8? | 1152 // We are reentering V8. |
1153 if (previous_->state_ != EXTERNAL) Heap::Unprotect(); | 1153 ASSERT(previous_->state_ != EXTERNAL); |
1154 } else { | 1154 Heap::Unprotect(); |
1155 // Are we leaving V8? | 1155 } else if (previous_->state_ == EXTERNAL) { |
1156 if (previous_->state_ == EXTERNAL) Heap::Protect(); | 1156 // We are leaving V8. |
| 1157 Heap::Protect(); |
1157 } | 1158 } |
1158 } | 1159 } |
1159 #endif | 1160 #endif |
1160 } | 1161 } |
1161 #endif | 1162 #endif |
1162 | 1163 |
1163 } } // namespace v8::internal | 1164 } } // namespace v8::internal |
OLD | NEW |