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 20 matching lines...) Expand all Loading... |
31 #include "bootstrapper.h" | 31 #include "bootstrapper.h" |
32 #include "debug.h" | 32 #include "debug.h" |
33 #include "execution.h" | 33 #include "execution.h" |
34 #include "string-stream.h" | 34 #include "string-stream.h" |
35 #include "platform.h" | 35 #include "platform.h" |
36 | 36 |
37 namespace v8 { namespace internal { | 37 namespace v8 { namespace internal { |
38 | 38 |
39 ThreadLocalTop Top::thread_local_; | 39 ThreadLocalTop Top::thread_local_; |
40 Mutex* Top::break_access_ = OS::CreateMutex(); | 40 Mutex* Top::break_access_ = OS::CreateMutex(); |
41 StackFrame::Id Top::break_frame_id_; | |
42 int Top::break_count_; | |
43 int Top::break_id_; | |
44 | 41 |
45 NoAllocationStringAllocator* preallocated_message_space = NULL; | 42 NoAllocationStringAllocator* preallocated_message_space = NULL; |
46 | 43 |
47 Address top_addresses[] = { | 44 Address top_addresses[] = { |
48 #define C(name) reinterpret_cast<Address>(Top::name()), | 45 #define C(name) reinterpret_cast<Address>(Top::name()), |
49 TOP_ADDRESS_LIST(C) | 46 TOP_ADDRESS_LIST(C) |
50 #undef C | 47 #undef C |
51 NULL | 48 NULL |
52 }; | 49 }; |
53 | 50 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 char* PreallocatedMemoryThread::data_ = NULL; | 212 char* PreallocatedMemoryThread::data_ = NULL; |
216 unsigned PreallocatedMemoryThread::length_ = 0; | 213 unsigned PreallocatedMemoryThread::length_ = 0; |
217 | 214 |
218 static bool initialized = false; | 215 static bool initialized = false; |
219 | 216 |
220 void Top::Initialize() { | 217 void Top::Initialize() { |
221 CHECK(!initialized); | 218 CHECK(!initialized); |
222 | 219 |
223 InitializeThreadLocal(); | 220 InitializeThreadLocal(); |
224 | 221 |
225 break_frame_id_ = StackFrame::NO_ID; | |
226 break_count_ = 0; | |
227 break_id_ = 0; | |
228 | |
229 // Only preallocate on the first initialization. | 222 // Only preallocate on the first initialization. |
230 if (FLAG_preallocate_message_memory && (preallocated_message_space == NULL)) { | 223 if (FLAG_preallocate_message_memory && (preallocated_message_space == NULL)) { |
231 // Start the thread which will set aside some memory. | 224 // Start the thread which will set aside some memory. |
232 PreallocatedMemoryThread::StartThread(); | 225 PreallocatedMemoryThread::StartThread(); |
233 preallocated_message_space = | 226 preallocated_message_space = |
234 new NoAllocationStringAllocator(PreallocatedMemoryThread::data(), | 227 new NoAllocationStringAllocator(PreallocatedMemoryThread::data(), |
235 PreallocatedMemoryThread::length()); | 228 PreallocatedMemoryThread::length()); |
236 PreallocatedStorage::Init(PreallocatedMemoryThread::length() / 4); | 229 PreallocatedStorage::Init(PreallocatedMemoryThread::length() / 4); |
237 } | 230 } |
238 initialized = true; | 231 initialized = true; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 thread_local_.try_catch_handler_ = that; | 281 thread_local_.try_catch_handler_ = that; |
289 } | 282 } |
290 | 283 |
291 | 284 |
292 void Top::UnregisterTryCatchHandler(v8::TryCatch* that) { | 285 void Top::UnregisterTryCatchHandler(v8::TryCatch* that) { |
293 ASSERT(thread_local_.try_catch_handler_ == that); | 286 ASSERT(thread_local_.try_catch_handler_ == that); |
294 thread_local_.try_catch_handler_ = that->next_; | 287 thread_local_.try_catch_handler_ = that->next_; |
295 } | 288 } |
296 | 289 |
297 | 290 |
298 void Top::new_break(StackFrame::Id break_frame_id) { | |
299 ExecutionAccess access; | |
300 break_frame_id_ = break_frame_id; | |
301 break_id_ = ++break_count_; | |
302 } | |
303 | |
304 | |
305 void Top::set_break(StackFrame::Id break_frame_id, int break_id) { | |
306 ExecutionAccess access; | |
307 break_frame_id_ = break_frame_id; | |
308 break_id_ = break_id; | |
309 } | |
310 | |
311 | |
312 bool Top::check_break(int break_id) { | |
313 ExecutionAccess access; | |
314 return break_id == break_id_; | |
315 } | |
316 | |
317 | |
318 bool Top::is_break() { | |
319 ExecutionAccess access; | |
320 return break_id_ != 0; | |
321 } | |
322 | |
323 | |
324 StackFrame::Id Top::break_frame_id() { | |
325 ExecutionAccess access; | |
326 return break_frame_id_; | |
327 } | |
328 | |
329 | |
330 int Top::break_id() { | |
331 ExecutionAccess access; | |
332 return break_id_; | |
333 } | |
334 | |
335 | |
336 void Top::MarkCompactPrologue(bool is_compacting) { | 291 void Top::MarkCompactPrologue(bool is_compacting) { |
337 MarkCompactPrologue(is_compacting, &thread_local_); | 292 MarkCompactPrologue(is_compacting, &thread_local_); |
338 } | 293 } |
339 | 294 |
340 | 295 |
341 void Top::MarkCompactPrologue(bool is_compacting, char* data) { | 296 void Top::MarkCompactPrologue(bool is_compacting, char* data) { |
342 MarkCompactPrologue(is_compacting, reinterpret_cast<ThreadLocalTop*>(data)); | 297 MarkCompactPrologue(is_compacting, reinterpret_cast<ThreadLocalTop*>(data)); |
343 } | 298 } |
344 | 299 |
345 | 300 |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 Top::break_access_->Lock(); | 892 Top::break_access_->Lock(); |
938 } | 893 } |
939 | 894 |
940 | 895 |
941 ExecutionAccess::~ExecutionAccess() { | 896 ExecutionAccess::~ExecutionAccess() { |
942 Top::break_access_->Unlock(); | 897 Top::break_access_->Unlock(); |
943 } | 898 } |
944 | 899 |
945 | 900 |
946 } } // namespace v8::internal | 901 } } // namespace v8::internal |
OLD | NEW |