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 11 matching lines...) Expand all Loading... | |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdarg.h> | 28 #include <stdarg.h> |
29 | 29 |
30 #include "v8.h" | 30 #include "v8.h" |
31 | 31 |
32 #include "bootstrapper.h" | |
32 #include "log.h" | 33 #include "log.h" |
34 #include "macro-assembler.h" | |
33 #include "platform.h" | 35 #include "platform.h" |
36 #include "serialize.h" | |
34 #include "string-stream.h" | 37 #include "string-stream.h" |
35 #include "macro-assembler.h" | |
36 | 38 |
37 namespace v8 { namespace internal { | 39 namespace v8 { namespace internal { |
38 | 40 |
39 #ifdef ENABLE_LOGGING_AND_PROFILING | 41 #ifdef ENABLE_LOGGING_AND_PROFILING |
40 | 42 |
41 // | 43 // |
42 // Sliding state window. Updates counters to keep track of the last | 44 // Sliding state window. Updates counters to keep track of the last |
43 // window of kBufferSize states. This is useful to track where we | 45 // window of kBufferSize states. This is useful to track where we |
44 // spent our time. | 46 // spent our time. |
45 // | 47 // |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1108 } | 1110 } |
1109 } | 1111 } |
1110 | 1112 |
1111 VMState::VMState(StateTag state) { | 1113 VMState::VMState(StateTag state) { |
1112 state_ = state; | 1114 state_ = state; |
1113 previous_ = Logger::current_state_; | 1115 previous_ = Logger::current_state_; |
1114 Logger::current_state_ = this; | 1116 Logger::current_state_ = this; |
1115 | 1117 |
1116 if (FLAG_log_state_changes) { | 1118 if (FLAG_log_state_changes) { |
1117 LOG(UncheckedStringEvent("Entering", StateToString(state_))); | 1119 LOG(UncheckedStringEvent("Entering", StateToString(state_))); |
1118 if (previous_) { | 1120 if (previous_ != NULL) { |
1119 LOG(UncheckedStringEvent("From", StateToString(previous_->state_))); | 1121 LOG(UncheckedStringEvent("From", StateToString(previous_->state_))); |
1120 } | 1122 } |
1121 } | 1123 } |
1124 | |
1125 #ifdef ENABLE_HEAP_PROTECTION | |
1126 if (FLAG_protect_heap && previous_ != NULL) { | |
1127 if (state_ == EXTERNAL) { | |
1128 // Are we leaving V8? | |
Søren Thygesen Gjesse
2009/03/24 11:43:55
ASSERT that previous state was not EXTERNAL and li
| |
1129 if (previous_->state_ != EXTERNAL) Heap::Protect(); | |
1130 } else { | |
1131 // Are we entering V8? | |
1132 if (previous_->state_ == EXTERNAL) Heap::Unprotect(); | |
1133 } | |
1134 } | |
1135 #endif | |
1122 } | 1136 } |
1123 | 1137 |
1124 | 1138 |
1125 VMState::~VMState() { | 1139 VMState::~VMState() { |
1126 Logger::current_state_ = previous_; | 1140 Logger::current_state_ = previous_; |
1127 | 1141 |
1128 if (FLAG_log_state_changes) { | 1142 if (FLAG_log_state_changes) { |
1129 LOG(UncheckedStringEvent("Leaving", StateToString(state_))); | 1143 LOG(UncheckedStringEvent("Leaving", StateToString(state_))); |
1130 if (previous_) { | 1144 if (previous_ != NULL) { |
1131 LOG(UncheckedStringEvent("To", StateToString(previous_->state_))); | 1145 LOG(UncheckedStringEvent("To", StateToString(previous_->state_))); |
1132 } | 1146 } |
1133 } | 1147 } |
1148 | |
1149 #ifdef ENABLE_HEAP_PROTECTION | |
1150 if (FLAG_protect_heap && previous_ != NULL) { | |
1151 if (state_ == EXTERNAL) { | |
1152 // Are we (re)entering V8? | |
1153 if (previous_->state_ != EXTERNAL) Heap::Unprotect(); | |
1154 } else { | |
1155 // Are we leaving V8? | |
1156 if (previous_->state_ == EXTERNAL) Heap::Protect(); | |
1157 } | |
1158 } | |
1159 #endif | |
1134 } | 1160 } |
1135 #endif | 1161 #endif |
1136 | 1162 |
1137 } } // namespace v8::internal | 1163 } } // namespace v8::internal |
OLD | NEW |