Chromium Code Reviews| 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 // Iterate pointers in live lookup results. | 470 // Iterate pointers in live lookup results. |
| 471 thread->top_lookup_result_->Iterate(v); | 471 thread->top_lookup_result_->Iterate(v); |
| 472 } | 472 } |
| 473 | 473 |
| 474 | 474 |
| 475 void Isolate::Iterate(ObjectVisitor* v) { | 475 void Isolate::Iterate(ObjectVisitor* v) { |
| 476 ThreadLocalTop* current_t = thread_local_top(); | 476 ThreadLocalTop* current_t = thread_local_top(); |
| 477 Iterate(v, current_t); | 477 Iterate(v, current_t); |
| 478 } | 478 } |
| 479 | 479 |
| 480 void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) { | |
| 481 for (DeferredHandles* deferred = deferred_handles_head_; | |
| 482 deferred; | |
|
danno
2012/07/18 13:36:17
Use explicit test against NULL
sanjoy
2012/07/18 14:00:44
Done.
| |
| 483 deferred = deferred->next_) { | |
| 484 deferred->Iterate(visitor); | |
| 485 } | |
| 486 } | |
| 487 | |
| 480 | 488 |
| 481 void Isolate::RegisterTryCatchHandler(v8::TryCatch* that) { | 489 void Isolate::RegisterTryCatchHandler(v8::TryCatch* that) { |
| 482 // The ARM simulator has a separate JS stack. We therefore register | 490 // The ARM simulator has a separate JS stack. We therefore register |
| 483 // the C++ try catch handler with the simulator and get back an | 491 // the C++ try catch handler with the simulator and get back an |
| 484 // address that can be used for comparisons with addresses into the | 492 // address that can be used for comparisons with addresses into the |
| 485 // JS stack. When running without the simulator, the address | 493 // JS stack. When running without the simulator, the address |
| 486 // returned will be the address of the C++ try catch handler itself. | 494 // returned will be the address of the C++ try catch handler itself. |
| 487 Address address = reinterpret_cast<Address>( | 495 Address address = reinterpret_cast<Address>( |
| 488 SimulatorStack::RegisterCTryCatch(reinterpret_cast<uintptr_t>(that))); | 496 SimulatorStack::RegisterCTryCatch(reinterpret_cast<uintptr_t>(that))); |
| 489 thread_local_top()->set_try_catch_handler_address(address); | 497 thread_local_top()->set_try_catch_handler_address(address); |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1477 inner_pointer_to_code_cache_(NULL), | 1485 inner_pointer_to_code_cache_(NULL), |
| 1478 write_input_buffer_(NULL), | 1486 write_input_buffer_(NULL), |
| 1479 global_handles_(NULL), | 1487 global_handles_(NULL), |
| 1480 context_switcher_(NULL), | 1488 context_switcher_(NULL), |
| 1481 thread_manager_(NULL), | 1489 thread_manager_(NULL), |
| 1482 fp_stubs_generated_(false), | 1490 fp_stubs_generated_(false), |
| 1483 has_installed_extensions_(false), | 1491 has_installed_extensions_(false), |
| 1484 string_tracker_(NULL), | 1492 string_tracker_(NULL), |
| 1485 regexp_stack_(NULL), | 1493 regexp_stack_(NULL), |
| 1486 date_cache_(NULL), | 1494 date_cache_(NULL), |
| 1487 context_exit_happened_(false) { | 1495 context_exit_happened_(false), |
| 1496 deferred_handles_head_(NULL) { | |
| 1488 TRACE_ISOLATE(constructor); | 1497 TRACE_ISOLATE(constructor); |
| 1489 | 1498 |
| 1490 memset(isolate_addresses_, 0, | 1499 memset(isolate_addresses_, 0, |
| 1491 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); | 1500 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); |
| 1492 | 1501 |
| 1493 heap_.isolate_ = this; | 1502 heap_.isolate_ = this; |
| 1494 stack_guard_.isolate_ = this; | 1503 stack_guard_.isolate_ = this; |
| 1495 | 1504 |
| 1496 // ThreadManager is initialized early to support locking an isolate | 1505 // ThreadManager is initialized early to support locking an isolate |
| 1497 // before it is entered. | 1506 // before it is entered. |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1982 PerIsolateThreadData* previous_thread_data = item->previous_thread_data; | 1991 PerIsolateThreadData* previous_thread_data = item->previous_thread_data; |
| 1983 Isolate* previous_isolate = item->previous_isolate; | 1992 Isolate* previous_isolate = item->previous_isolate; |
| 1984 | 1993 |
| 1985 delete item; | 1994 delete item; |
| 1986 | 1995 |
| 1987 // Reinit the current thread for the isolate it was running before this one. | 1996 // Reinit the current thread for the isolate it was running before this one. |
| 1988 SetIsolateThreadLocals(previous_isolate, previous_thread_data); | 1997 SetIsolateThreadLocals(previous_isolate, previous_thread_data); |
| 1989 } | 1998 } |
| 1990 | 1999 |
| 1991 | 2000 |
| 2001 void Isolate::DestroyDeferredHandles(DeferredHandles* deferred) { | |
| 2002 #ifdef DEBUG | |
| 2003 DeferredHandles* deferred_iterator = deferred; | |
| 2004 while (deferred_iterator->previous_ != NULL) { | |
| 2005 deferred_iterator = deferred_iterator->previous_; | |
| 2006 } | |
| 2007 ASSERT(deferred_handles_head_ == deferred_iterator); | |
| 2008 #endif | |
| 2009 if (deferred_handles_head_ == deferred) { | |
| 2010 deferred_handles_head_ = deferred_handles_head_->next_; | |
| 2011 } | |
| 2012 if (deferred->next_ != NULL) { | |
| 2013 deferred->next_->previous_ = deferred->previous_; | |
| 2014 } | |
| 2015 if (deferred->previous_ != NULL) { | |
| 2016 deferred->previous_->next_ = deferred->next_; | |
| 2017 } | |
| 2018 for (int i = 0; i < deferred->blocks_.length(); i++) { | |
| 2019 #ifdef DEBUG | |
| 2020 HandleScope::ZapRange(deferred->blocks_[i], | |
| 2021 &deferred->blocks_[i][kHandleBlockSize]); | |
| 2022 #endif | |
| 2023 handle_scope_implementer()->ReturnBlock(deferred->blocks_[i]); | |
| 2024 } | |
| 2025 } | |
| 2026 | |
| 2027 | |
| 1992 #ifdef DEBUG | 2028 #ifdef DEBUG |
| 1993 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2029 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 1994 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2030 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 1995 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2031 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 1996 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2032 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 1997 #undef ISOLATE_FIELD_OFFSET | 2033 #undef ISOLATE_FIELD_OFFSET |
| 1998 #endif | 2034 #endif |
| 1999 | 2035 |
| 2000 } } // namespace v8::internal | 2036 } } // namespace v8::internal |
| OLD | NEW |