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

Side by Side Diff: runtime/vm/isolate.cc

Issue 1644793002: Replace intptr_t with TokenDescriptor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
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 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 } 1501 }
1502 1502
1503 1503
1504 // If the linear lookup turns out to be too expensive, the list 1504 // If the linear lookup turns out to be too expensive, the list
1505 // of closures could be maintained in a hash map, with the key 1505 // of closures could be maintained in a hash map, with the key
1506 // being the token position of the closure. There are almost no 1506 // being the token position of the closure. There are almost no
1507 // collisions with this simple hash value. However, iterating over 1507 // collisions with this simple hash value. However, iterating over
1508 // all closure functions becomes more difficult, especially when 1508 // all closure functions becomes more difficult, especially when
1509 // the list/map changes while iterating over it. 1509 // the list/map changes while iterating over it.
1510 RawFunction* Isolate::LookupClosureFunction(const Function& parent, 1510 RawFunction* Isolate::LookupClosureFunction(const Function& parent,
1511 intptr_t token_pos) const { 1511 TokenDescriptor token_pos) const {
1512 const GrowableObjectArray& closures = 1512 const GrowableObjectArray& closures =
1513 GrowableObjectArray::Handle(object_store()->closure_functions()); 1513 GrowableObjectArray::Handle(object_store()->closure_functions());
1514 ASSERT(!closures.IsNull()); 1514 ASSERT(!closures.IsNull());
1515 Function& closure = Function::Handle(); 1515 Function& closure = Function::Handle();
1516 intptr_t num_closures = closures.Length(); 1516 intptr_t num_closures = closures.Length();
1517 for (intptr_t i = 0; i < num_closures; i++) { 1517 for (intptr_t i = 0; i < num_closures; i++) {
1518 closure ^= closures.At(i); 1518 closure ^= closures.At(i);
1519 if ((closure.token_pos() == token_pos) && 1519 if ((closure.token_pos() == token_pos) &&
1520 (closure.parent_function() == parent.raw())) { 1520 (closure.parent_function() == parent.raw())) {
1521 return closure.raw(); 1521 return closure.raw();
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 void IsolateSpawnState::DecrementSpawnCount() { 2559 void IsolateSpawnState::DecrementSpawnCount() {
2560 ASSERT(spawn_count_monitor_ != NULL); 2560 ASSERT(spawn_count_monitor_ != NULL);
2561 ASSERT(spawn_count_ != NULL); 2561 ASSERT(spawn_count_ != NULL);
2562 MonitorLocker ml(spawn_count_monitor_); 2562 MonitorLocker ml(spawn_count_monitor_);
2563 ASSERT(*spawn_count_ > 0); 2563 ASSERT(*spawn_count_ > 0);
2564 *spawn_count_ = *spawn_count_ - 1; 2564 *spawn_count_ = *spawn_count_ - 1;
2565 ml.Notify(); 2565 ml.Notify();
2566 } 2566 }
2567 2567
2568 } // namespace dart 2568 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698