OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 } | 1020 } |
1021 void set_external_callback(Address callback) { | 1021 void set_external_callback(Address callback) { |
1022 thread_local_top_.external_callback_ = callback; | 1022 thread_local_top_.external_callback_ = callback; |
1023 } | 1023 } |
1024 | 1024 |
1025 StateTag current_vm_state() { | 1025 StateTag current_vm_state() { |
1026 return thread_local_top_.current_vm_state_; | 1026 return thread_local_top_.current_vm_state_; |
1027 } | 1027 } |
1028 | 1028 |
1029 void SetCurrentVMState(StateTag state) { | 1029 void SetCurrentVMState(StateTag state) { |
1030 if (RuntimeProfiler::IsEnabled()) { | |
1031 // Make sure thread local top is initialized. | |
1032 ASSERT(thread_local_top_.isolate_ == this); | |
1033 StateTag current_state = thread_local_top_.current_vm_state_; | |
1034 if (current_state != JS && state == JS) { | |
1035 // Non-JS -> JS transition. | |
1036 RuntimeProfiler::IsolateEnteredJS(this); | |
1037 } else if (current_state == JS && state != JS) { | |
1038 // JS -> non-JS transition. | |
1039 RuntimeProfiler::IsolateExitedJS(this); | |
1040 } else { | |
1041 // Other types of state transitions are not interesting to the | |
1042 // runtime profiler, because they don't affect whether we're | |
1043 // in JS or not. | |
1044 ASSERT((current_state == JS) == (state == JS)); | |
1045 } | |
1046 } | |
1047 thread_local_top_.current_vm_state_ = state; | 1030 thread_local_top_.current_vm_state_ = state; |
1048 } | 1031 } |
1049 | 1032 |
1050 void SetData(void* data) { embedder_data_ = data; } | 1033 void SetData(void* data) { embedder_data_ = data; } |
1051 void* GetData() { return embedder_data_; } | 1034 void* GetData() { return embedder_data_; } |
1052 | 1035 |
1053 LookupResult* top_lookup_result() { | 1036 LookupResult* top_lookup_result() { |
1054 return thread_local_top_.top_lookup_result_; | 1037 return thread_local_top_.top_lookup_result_; |
1055 } | 1038 } |
1056 void SetTopLookupResult(LookupResult* top) { | 1039 void SetTopLookupResult(LookupResult* top) { |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 | 1473 |
1491 // Mark the native context with out of memory. | 1474 // Mark the native context with out of memory. |
1492 inline void Context::mark_out_of_memory() { | 1475 inline void Context::mark_out_of_memory() { |
1493 native_context()->set_out_of_memory(HEAP->true_value()); | 1476 native_context()->set_out_of_memory(HEAP->true_value()); |
1494 } | 1477 } |
1495 | 1478 |
1496 | 1479 |
1497 } } // namespace v8::internal | 1480 } } // namespace v8::internal |
1498 | 1481 |
1499 #endif // V8_ISOLATE_H_ | 1482 #endif // V8_ISOLATE_H_ |
OLD | NEW |