OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/debug/debug.h" | 7 #include "src/debug/debug.h" |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 if (start_position == RelocInfo::kNoPosition) { | 1521 if (start_position == RelocInfo::kNoPosition) { |
1522 start_position = shared->start_position(); | 1522 start_position = shared->start_position(); |
1523 } | 1523 } |
1524 | 1524 |
1525 if (start_position > target_position_) return; | 1525 if (start_position > target_position_) return; |
1526 if (target_position_ > shared->end_position()) return; | 1526 if (target_position_ > shared->end_position()) return; |
1527 | 1527 |
1528 if (current_candidate_ != NULL) { | 1528 if (current_candidate_ != NULL) { |
1529 if (current_start_position_ == start_position && | 1529 if (current_start_position_ == start_position && |
1530 shared->end_position() == current_candidate_->end_position()) { | 1530 shared->end_position() == current_candidate_->end_position()) { |
| 1531 // If we already have a matching closure, do not throw it away. |
| 1532 if (current_candidate_closure_ != NULL && closure == NULL) return; |
1531 // If a top-level function contains only one function | 1533 // If a top-level function contains only one function |
1532 // declaration the source for the top-level and the function | 1534 // declaration the source for the top-level and the function |
1533 // is the same. In that case prefer the non top-level function. | 1535 // is the same. In that case prefer the non top-level function. |
1534 if (shared->is_toplevel()) return; | 1536 if (!current_candidate_->is_toplevel() && shared->is_toplevel()) return; |
1535 } else if (start_position < current_start_position_ || | 1537 } else if (start_position < current_start_position_ || |
1536 current_candidate_->end_position() < shared->end_position()) { | 1538 current_candidate_->end_position() < shared->end_position()) { |
1537 return; | 1539 return; |
1538 } | 1540 } |
1539 } | 1541 } |
1540 | 1542 |
1541 current_start_position_ = start_position; | 1543 current_start_position_ = start_position; |
1542 current_candidate_ = shared; | 1544 current_candidate_ = shared; |
1543 current_candidate_closure_ = closure; | 1545 current_candidate_closure_ = closure; |
1544 } | 1546 } |
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2803 } | 2805 } |
2804 | 2806 |
2805 | 2807 |
2806 void LockingCommandMessageQueue::Clear() { | 2808 void LockingCommandMessageQueue::Clear() { |
2807 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2809 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2808 queue_.Clear(); | 2810 queue_.Clear(); |
2809 } | 2811 } |
2810 | 2812 |
2811 } // namespace internal | 2813 } // namespace internal |
2812 } // namespace v8 | 2814 } // namespace v8 |
OLD | NEW |