Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(707)

Side by Side Diff: src/isolate.cc

Issue 10778036: The deferred handes list belongs to the Isolate and not to the (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/isolate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 != NULL;
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
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
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::LinkDeferredHandles(DeferredHandles* deferred) {
2002 deferred->next_ = deferred_handles_head_;
2003 if (deferred_handles_head_ != NULL) {
2004 deferred_handles_head_->previous_ = deferred;
2005 }
2006 deferred_handles_head_ = deferred;
2007 }
2008
2009
2010 void Isolate::UnlinkDeferredHandles(DeferredHandles* deferred) {
2011 #ifdef DEBUG
2012 // In debug mode assert that the linked list is well-formed.
2013 DeferredHandles* deferred_iterator = deferred;
2014 while (deferred_iterator->previous_ != NULL) {
2015 deferred_iterator = deferred_iterator->previous_;
2016 }
2017 ASSERT(deferred_handles_head_ == deferred_iterator);
2018 #endif
2019 if (deferred_handles_head_ == deferred) {
2020 deferred_handles_head_ = deferred_handles_head_->next_;
2021 }
2022 if (deferred->next_ != NULL) {
2023 deferred->next_->previous_ = deferred->previous_;
2024 }
2025 if (deferred->previous_ != NULL) {
2026 deferred->previous_->next_ = deferred->next_;
2027 }
2028 }
2029
2030
1992 #ifdef DEBUG 2031 #ifdef DEBUG
1993 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2032 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
1994 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2033 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
1995 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2034 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
1996 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2035 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
1997 #undef ISOLATE_FIELD_OFFSET 2036 #undef ISOLATE_FIELD_OFFSET
1998 #endif 2037 #endif
1999 2038
2000 } } // namespace v8::internal 2039 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698