| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/isolate.h" | 5 #include "vm/isolate.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/text_buffer.h" | 10 #include "platform/text_buffer.h" |
| (...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 } | 1498 } |
| 1499 | 1499 |
| 1500 | 1500 |
| 1501 // If the linear lookup turns out to be too expensive, the list | 1501 // If the linear lookup turns out to be too expensive, the list |
| 1502 // of closures could be maintained in a hash map, with the key | 1502 // of closures could be maintained in a hash map, with the key |
| 1503 // being the token position of the closure. There are almost no | 1503 // being the token position of the closure. There are almost no |
| 1504 // collisions with this simple hash value. However, iterating over | 1504 // collisions with this simple hash value. However, iterating over |
| 1505 // all closure functions becomes more difficult, especially when | 1505 // all closure functions becomes more difficult, especially when |
| 1506 // the list/map changes while iterating over it. | 1506 // the list/map changes while iterating over it. |
| 1507 RawFunction* Isolate::LookupClosureFunction(const Function& parent, | 1507 RawFunction* Isolate::LookupClosureFunction(const Function& parent, |
| 1508 intptr_t token_pos) const { | 1508 TokenPosition token_pos) const { |
| 1509 const GrowableObjectArray& closures = | 1509 const GrowableObjectArray& closures = |
| 1510 GrowableObjectArray::Handle(object_store()->closure_functions()); | 1510 GrowableObjectArray::Handle(object_store()->closure_functions()); |
| 1511 ASSERT(!closures.IsNull()); | 1511 ASSERT(!closures.IsNull()); |
| 1512 Function& closure = Function::Handle(); | 1512 Function& closure = Function::Handle(); |
| 1513 intptr_t num_closures = closures.Length(); | 1513 intptr_t num_closures = closures.Length(); |
| 1514 for (intptr_t i = 0; i < num_closures; i++) { | 1514 for (intptr_t i = 0; i < num_closures; i++) { |
| 1515 closure ^= closures.At(i); | 1515 closure ^= closures.At(i); |
| 1516 if ((closure.token_pos() == token_pos) && | 1516 if ((closure.token_pos() == token_pos) && |
| 1517 (closure.parent_function() == parent.raw())) { | 1517 (closure.parent_function() == parent.raw())) { |
| 1518 return closure.raw(); | 1518 return closure.raw(); |
| (...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2632 void IsolateSpawnState::DecrementSpawnCount() { | 2632 void IsolateSpawnState::DecrementSpawnCount() { |
| 2633 ASSERT(spawn_count_monitor_ != NULL); | 2633 ASSERT(spawn_count_monitor_ != NULL); |
| 2634 ASSERT(spawn_count_ != NULL); | 2634 ASSERT(spawn_count_ != NULL); |
| 2635 MonitorLocker ml(spawn_count_monitor_); | 2635 MonitorLocker ml(spawn_count_monitor_); |
| 2636 ASSERT(*spawn_count_ > 0); | 2636 ASSERT(*spawn_count_ > 0); |
| 2637 *spawn_count_ = *spawn_count_ - 1; | 2637 *spawn_count_ = *spawn_count_ - 1; |
| 2638 ml.Notify(); | 2638 ml.Notify(); |
| 2639 } | 2639 } |
| 2640 | 2640 |
| 2641 } // namespace dart | 2641 } // namespace dart |
| OLD | NEW |