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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
500 | 500 |
501 void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) { | 501 void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) { |
502 for (DeferredHandles* deferred = deferred_handles_head_; | 502 for (DeferredHandles* deferred = deferred_handles_head_; |
503 deferred != NULL; | 503 deferred != NULL; |
504 deferred = deferred->next_) { | 504 deferred = deferred->next_) { |
505 deferred->Iterate(visitor); | 505 deferred->Iterate(visitor); |
506 } | 506 } |
507 } | 507 } |
508 | 508 |
509 | 509 |
510 #ifdef DEBUG | |
511 bool Isolate::IsDeferredHandle(Object** location) { | |
Sven Panne
2013/04/23 06:42:13
Some comment would be very appropriate here: It is
| |
512 for (DeferredHandles* deferred = deferred_handles_head_; | |
513 deferred != NULL; | |
514 deferred = deferred->next_) { | |
515 List<Object**>* blocks = &deferred->blocks_; | |
516 if (blocks->first() <= location && | |
517 location < deferred->first_block_limit_) { | |
518 return true; | |
519 } | |
520 for (int i = 1; i < blocks->length(); i++) { | |
Sven Panne
2013/04/23 06:42:13
Why 1 and not 0? Could be correct, but I don't hav
| |
521 if (blocks->at(i) <= location && | |
522 location <= blocks->at(i) + kHandleBlockSize) { | |
523 return true; | |
524 } | |
525 } | |
526 } | |
527 return false; | |
528 } | |
529 #endif // DEBUG | |
530 | |
531 | |
510 void Isolate::RegisterTryCatchHandler(v8::TryCatch* that) { | 532 void Isolate::RegisterTryCatchHandler(v8::TryCatch* that) { |
511 // The ARM simulator has a separate JS stack. We therefore register | 533 // The ARM simulator has a separate JS stack. We therefore register |
512 // the C++ try catch handler with the simulator and get back an | 534 // the C++ try catch handler with the simulator and get back an |
513 // address that can be used for comparisons with addresses into the | 535 // address that can be used for comparisons with addresses into the |
514 // JS stack. When running without the simulator, the address | 536 // JS stack. When running without the simulator, the address |
515 // returned will be the address of the C++ try catch handler itself. | 537 // returned will be the address of the C++ try catch handler itself. |
516 Address address = reinterpret_cast<Address>( | 538 Address address = reinterpret_cast<Address>( |
517 SimulatorStack::RegisterCTryCatch(reinterpret_cast<uintptr_t>(that))); | 539 SimulatorStack::RegisterCTryCatch(reinterpret_cast<uintptr_t>(that))); |
518 thread_local_top()->set_try_catch_handler_address(address); | 540 thread_local_top()->set_try_catch_handler_address(address); |
519 } | 541 } |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1750 simulator_i_cache_ = NULL; | 1772 simulator_i_cache_ = NULL; |
1751 simulator_redirection_ = NULL; | 1773 simulator_redirection_ = NULL; |
1752 #endif | 1774 #endif |
1753 | 1775 |
1754 #ifdef DEBUG | 1776 #ifdef DEBUG |
1755 // heap_histograms_ initializes itself. | 1777 // heap_histograms_ initializes itself. |
1756 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); | 1778 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); |
1757 memset(code_kind_statistics_, 0, | 1779 memset(code_kind_statistics_, 0, |
1758 sizeof(code_kind_statistics_[0]) * Code::NUMBER_OF_KINDS); | 1780 sizeof(code_kind_statistics_[0]) * Code::NUMBER_OF_KINDS); |
1759 | 1781 |
1760 allow_compiler_thread_handle_deref_ = true; | 1782 compiler_thread_handle_deref_state_ = HandleDereferenceGuard::ALLOW; |
1761 allow_execution_thread_handle_deref_ = true; | 1783 execution_thread_handle_deref_state_ = HandleDereferenceGuard::ALLOW; |
1762 #endif | 1784 #endif |
1763 | 1785 |
1764 #ifdef ENABLE_DEBUGGER_SUPPORT | 1786 #ifdef ENABLE_DEBUGGER_SUPPORT |
1765 debug_ = NULL; | 1787 debug_ = NULL; |
1766 debugger_ = NULL; | 1788 debugger_ = NULL; |
1767 #endif | 1789 #endif |
1768 | 1790 |
1769 handle_scope_data_.Initialize(); | 1791 handle_scope_data_.Initialize(); |
1770 | 1792 |
1771 #define ISOLATE_INIT_EXECUTE(type, name, initial_value) \ | 1793 #define ISOLATE_INIT_EXECUTE(type, name, initial_value) \ |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2372 if (deferred->next_ != NULL) { | 2394 if (deferred->next_ != NULL) { |
2373 deferred->next_->previous_ = deferred->previous_; | 2395 deferred->next_->previous_ = deferred->previous_; |
2374 } | 2396 } |
2375 if (deferred->previous_ != NULL) { | 2397 if (deferred->previous_ != NULL) { |
2376 deferred->previous_->next_ = deferred->next_; | 2398 deferred->previous_->next_ = deferred->next_; |
2377 } | 2399 } |
2378 } | 2400 } |
2379 | 2401 |
2380 | 2402 |
2381 #ifdef DEBUG | 2403 #ifdef DEBUG |
2382 bool Isolate::AllowHandleDereference() { | 2404 HandleDereferenceGuard::State Isolate::HandleDereferenceGuardState() { |
2383 if (allow_execution_thread_handle_deref_ && | 2405 if (execution_thread_handle_deref_state_ == HandleDereferenceGuard::ALLOW && |
2384 allow_compiler_thread_handle_deref_) { | 2406 compiler_thread_handle_deref_state_ == HandleDereferenceGuard::ALLOW) { |
2385 // Short-cut to avoid polling thread id. | 2407 // Short-cut to avoid polling thread id. |
2386 return true; | 2408 return HandleDereferenceGuard::ALLOW; |
2387 } | 2409 } |
2388 if (FLAG_parallel_recompilation && | 2410 if (FLAG_parallel_recompilation && |
2389 optimizing_compiler_thread()->IsOptimizerThread()) { | 2411 optimizing_compiler_thread()->IsOptimizerThread()) { |
2390 return allow_compiler_thread_handle_deref_; | 2412 return compiler_thread_handle_deref_state_; |
2391 } else { | 2413 } else { |
2392 return allow_execution_thread_handle_deref_; | 2414 return execution_thread_handle_deref_state_; |
2393 } | 2415 } |
2394 } | 2416 } |
2395 | 2417 |
2396 | 2418 |
2397 void Isolate::SetAllowHandleDereference(bool allow) { | 2419 void Isolate::SetHandleDereferenceGuardState( |
2420 HandleDereferenceGuard::State state) { | |
2398 if (FLAG_parallel_recompilation && | 2421 if (FLAG_parallel_recompilation && |
2399 optimizing_compiler_thread()->IsOptimizerThread()) { | 2422 optimizing_compiler_thread()->IsOptimizerThread()) { |
2400 allow_compiler_thread_handle_deref_ = allow; | 2423 compiler_thread_handle_deref_state_ = state; |
2401 } else { | 2424 } else { |
2402 allow_execution_thread_handle_deref_ = allow; | 2425 execution_thread_handle_deref_state_ = state; |
2403 } | 2426 } |
2404 } | 2427 } |
2405 #endif | 2428 #endif |
2406 | 2429 |
2407 | 2430 |
2408 HStatistics* Isolate::GetHStatistics() { | 2431 HStatistics* Isolate::GetHStatistics() { |
2409 if (hstatistics() == NULL) set_hstatistics(new HStatistics()); | 2432 if (hstatistics() == NULL) set_hstatistics(new HStatistics()); |
2410 return hstatistics(); | 2433 return hstatistics(); |
2411 } | 2434 } |
2412 | 2435 |
(...skipping 12 matching lines...) Expand all Loading... | |
2425 | 2448 |
2426 #ifdef DEBUG | 2449 #ifdef DEBUG |
2427 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2450 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2428 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2451 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2429 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2452 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2430 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2453 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2431 #undef ISOLATE_FIELD_OFFSET | 2454 #undef ISOLATE_FIELD_OFFSET |
2432 #endif | 2455 #endif |
2433 | 2456 |
2434 } } // namespace v8::internal | 2457 } } // namespace v8::internal |
OLD | NEW |