| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 | 62 |
| 63 VMState::VMState(Isolate* isolate, StateTag tag) | 63 VMState::VMState(Isolate* isolate, StateTag tag) |
| 64 : isolate_(isolate), previous_tag_(isolate->current_vm_state()) { | 64 : isolate_(isolate), previous_tag_(isolate->current_vm_state()) { |
| 65 if (FLAG_log_state_changes) { | 65 if (FLAG_log_state_changes) { |
| 66 LOG(isolate, UncheckedStringEvent("Entering", StateToString(tag))); | 66 LOG(isolate, UncheckedStringEvent("Entering", StateToString(tag))); |
| 67 LOG(isolate, UncheckedStringEvent("From", StateToString(previous_tag_))); | 67 LOG(isolate, UncheckedStringEvent("From", StateToString(previous_tag_))); |
| 68 } | 68 } |
| 69 | 69 |
| 70 if (FLAG_log_timer_events) { | 70 if (FLAG_log_timer_events && previous_tag_ != EXTERNAL && tag == EXTERNAL) { |
| 71 LOG(isolate, ExternalSwitch(previous_tag_, tag)); | 71 LOG(isolate_, EnterExternal()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 isolate_->SetCurrentVMState(tag); | 74 isolate_->SetCurrentVMState(tag); |
| 75 } | 75 } |
| 76 | 76 |
| 77 | 77 |
| 78 VMState::~VMState() { | 78 VMState::~VMState() { |
| 79 if (FLAG_log_state_changes) { | 79 if (FLAG_log_state_changes) { |
| 80 LOG(isolate_, | 80 LOG(isolate_, |
| 81 UncheckedStringEvent("Leaving", | 81 UncheckedStringEvent("Leaving", |
| 82 StateToString(isolate_->current_vm_state()))); | 82 StateToString(isolate_->current_vm_state()))); |
| 83 LOG(isolate_, | 83 LOG(isolate_, |
| 84 UncheckedStringEvent("To", StateToString(previous_tag_))); | 84 UncheckedStringEvent("To", StateToString(previous_tag_))); |
| 85 } | 85 } |
| 86 | 86 |
| 87 if (FLAG_log_timer_events) { | 87 if (FLAG_log_timer_events && |
| 88 LOG(isolate_, ExternalSwitch(isolate_->current_vm_state(), previous_tag_)); | 88 previous_tag_ != EXTERNAL && isolate_->current_vm_state() == EXTERNAL) { |
| 89 LOG(isolate_, LeaveExternal()); |
| 89 } | 90 } |
| 90 | 91 |
| 91 isolate_->SetCurrentVMState(previous_tag_); | 92 isolate_->SetCurrentVMState(previous_tag_); |
| 92 } | 93 } |
| 93 | 94 |
| 94 | 95 |
| 95 ExternalCallbackScope::ExternalCallbackScope(Isolate* isolate, Address callback) | 96 ExternalCallbackScope::ExternalCallbackScope(Isolate* isolate, Address callback) |
| 96 : isolate_(isolate), previous_callback_(isolate->external_callback()) { | 97 : isolate_(isolate), previous_callback_(isolate->external_callback()) { |
| 97 isolate_->set_external_callback(callback); | 98 isolate_->set_external_callback(callback); |
| 98 } | 99 } |
| 99 | 100 |
| 100 ExternalCallbackScope::~ExternalCallbackScope() { | 101 ExternalCallbackScope::~ExternalCallbackScope() { |
| 101 isolate_->set_external_callback(previous_callback_); | 102 isolate_->set_external_callback(previous_callback_); |
| 102 } | 103 } |
| 103 | 104 |
| 104 | 105 |
| 105 } } // namespace v8::internal | 106 } } // namespace v8::internal |
| 106 | 107 |
| 107 #endif // V8_VM_STATE_INL_H_ | 108 #endif // V8_VM_STATE_INL_H_ |
| OLD | NEW |