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 27 matching lines...) Expand all Loading... | |
38 #include "string-stream.h" | 38 #include "string-stream.h" |
39 #include "vm-state-inl.h" | 39 #include "vm-state-inl.h" |
40 | 40 |
41 | 41 |
42 // TODO(isolates): move to isolate.cc. This stuff is kept here to | 42 // TODO(isolates): move to isolate.cc. This stuff is kept here to |
43 // simplify merging. | 43 // simplify merging. |
44 | 44 |
45 namespace v8 { | 45 namespace v8 { |
46 namespace internal { | 46 namespace internal { |
47 | 47 |
48 v8::TryCatch* ThreadLocalTop::TryCatchHandler() { | 48 ThreadLocalTop::ThreadLocalTop() { |
49 return TRY_CATCH_FROM_ADDRESS(try_catch_handler_address()); | 49 InitializeInternal(); |
50 } | 50 } |
51 | 51 |
52 | 52 |
53 void ThreadLocalTop::Initialize() { | 53 void ThreadLocalTop::InitializeInternal() { |
54 c_entry_fp_ = 0; | 54 c_entry_fp_ = 0; |
55 handler_ = 0; | 55 handler_ = 0; |
56 #ifdef USE_SIMULATOR | 56 #ifdef USE_SIMULATOR |
57 #ifdef V8_TARGET_ARCH_ARM | 57 simulator_ = NULL; |
58 simulator_ = Simulator::current(Isolate::Current()); | |
59 #elif V8_TARGET_ARCH_MIPS | |
60 simulator_ = Simulator::current(Isolate::Current()); | |
61 #endif | |
62 #endif | 58 #endif |
63 #ifdef ENABLE_LOGGING_AND_PROFILING | 59 #ifdef ENABLE_LOGGING_AND_PROFILING |
64 js_entry_sp_ = NULL; | 60 js_entry_sp_ = NULL; |
65 external_callback_ = NULL; | 61 external_callback_ = NULL; |
66 #endif | 62 #endif |
67 #ifdef ENABLE_VMSTATE_TRACKING | 63 #ifdef ENABLE_VMSTATE_TRACKING |
68 current_vm_state_ = EXTERNAL; | 64 current_vm_state_ = EXTERNAL; |
69 #endif | 65 #endif |
70 try_catch_handler_address_ = NULL; | 66 try_catch_handler_address_ = NULL; |
71 context_ = NULL; | 67 context_ = NULL; |
72 thread_id_ = ThreadId::Current(); | 68 thread_id_ = ThreadId::Invalid(); |
73 external_caught_exception_ = false; | 69 external_caught_exception_ = false; |
74 failed_access_check_callback_ = NULL; | 70 failed_access_check_callback_ = NULL; |
75 save_context_ = NULL; | 71 save_context_ = NULL; |
76 catcher_ = NULL; | 72 catcher_ = NULL; |
77 } | 73 } |
78 | 74 |
79 | 75 |
76 void ThreadLocalTop::Initialize() { | |
77 InitializeInternal(); | |
Søren Thygesen Gjesse
2011/04/15 07:23:57
Do you need to call InitializeInternal() here as w
Vitaly Repeshko
2011/04/15 20:47:56
Yes, because Inititalize is called more than once
| |
78 #ifdef USE_SIMULATOR | |
79 #ifdef V8_TARGET_ARCH_ARM | |
80 simulator_ = Simulator::current(Isolate::Current()); | |
81 #elif V8_TARGET_ARCH_MIPS | |
82 simulator_ = Simulator::current(Isolate::Current()); | |
83 #endif | |
84 #endif | |
85 thread_id_ = ThreadId::Current(); | |
86 } | |
87 | |
88 | |
89 v8::TryCatch* ThreadLocalTop::TryCatchHandler() { | |
90 return TRY_CATCH_FROM_ADDRESS(try_catch_handler_address()); | |
91 } | |
92 | |
93 | |
80 Address Isolate::get_address_from_id(Isolate::AddressId id) { | 94 Address Isolate::get_address_from_id(Isolate::AddressId id) { |
81 return isolate_addresses_[id]; | 95 return isolate_addresses_[id]; |
82 } | 96 } |
83 | 97 |
84 | 98 |
85 char* Isolate::Iterate(ObjectVisitor* v, char* thread_storage) { | 99 char* Isolate::Iterate(ObjectVisitor* v, char* thread_storage) { |
86 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(thread_storage); | 100 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(thread_storage); |
87 Iterate(v, thread); | 101 Iterate(v, thread); |
88 return thread_storage + sizeof(ThreadLocalTop); | 102 return thread_storage + sizeof(ThreadLocalTop); |
89 } | 103 } |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
954 thread_local_top()->simulator_ = Simulator::current(this); | 968 thread_local_top()->simulator_ = Simulator::current(this); |
955 #endif | 969 #endif |
956 #endif | 970 #endif |
957 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { | 971 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { |
958 RuntimeProfiler::IsolateEnteredJS(this); | 972 RuntimeProfiler::IsolateEnteredJS(this); |
959 } | 973 } |
960 return from + sizeof(ThreadLocalTop); | 974 return from + sizeof(ThreadLocalTop); |
961 } | 975 } |
962 | 976 |
963 } } // namespace v8::internal | 977 } } // namespace v8::internal |
OLD | NEW |