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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 Isolate* isolate = Isolate::Current(); | 61 Isolate* isolate = Isolate::Current(); |
62 if (token == NULL) return TokenEnumerator::kNoSecurityToken; | 62 if (token == NULL) return TokenEnumerator::kNoSecurityToken; |
63 for (int i = 0; i < token_locations_.length(); ++i) { | 63 for (int i = 0; i < token_locations_.length(); ++i) { |
64 if (*token_locations_[i] == token && !token_removed_[i]) return i; | 64 if (*token_locations_[i] == token && !token_removed_[i]) return i; |
65 } | 65 } |
66 Handle<Object> handle = isolate->global_handles()->Create(token); | 66 Handle<Object> handle = isolate->global_handles()->Create(token); |
67 // handle.location() points to a memory cell holding a pointer | 67 // handle.location() points to a memory cell holding a pointer |
68 // to a token object in the V8's heap. | 68 // to a token object in the V8's heap. |
69 isolate->global_handles()->MakeWeak(handle.location(), | 69 isolate->global_handles()->MakeWeak(handle.location(), |
70 this, | 70 this, |
71 NULL, | |
72 TokenRemovedCallback); | 71 TokenRemovedCallback); |
73 token_locations_.Add(handle.location()); | 72 token_locations_.Add(handle.location()); |
74 token_removed_.Add(false); | 73 token_removed_.Add(false); |
75 return token_locations_.length() - 1; | 74 return token_locations_.length() - 1; |
76 } | 75 } |
77 | 76 |
78 | 77 |
79 void TokenEnumerator::TokenRemovedCallback(v8::Isolate* isolate, | 78 void TokenEnumerator::TokenRemovedCallback(v8::Isolate* isolate, |
80 v8::Persistent<v8::Value> handle, | 79 v8::Persistent<v8::Value>* handle, |
81 void* parameter) { | 80 void* parameter) { |
82 reinterpret_cast<TokenEnumerator*>(parameter)->TokenRemoved( | 81 reinterpret_cast<TokenEnumerator*>(parameter)->TokenRemoved( |
83 Utils::OpenHandle(*handle).location()); | 82 Utils::OpenHandle(**handle).location()); |
84 handle.Dispose(isolate); | 83 handle->Dispose(isolate); |
85 } | 84 } |
86 | 85 |
87 | 86 |
88 void TokenEnumerator::TokenRemoved(Object** token_location) { | 87 void TokenEnumerator::TokenRemoved(Object** token_location) { |
89 for (int i = 0; i < token_locations_.length(); ++i) { | 88 for (int i = 0; i < token_locations_.length(); ++i) { |
90 if (token_locations_[i] == token_location && !token_removed_[i]) { | 89 if (token_locations_[i] == token_location && !token_removed_[i]) { |
91 token_removed_[i] = true; | 90 token_removed_[i] = true; |
92 return; | 91 return; |
93 } | 92 } |
94 } | 93 } |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 if (no_symbolized_entries) { | 956 if (no_symbolized_entries) { |
958 *entry++ = EntryForVMState(sample.state); | 957 *entry++ = EntryForVMState(sample.state); |
959 } | 958 } |
960 } | 959 } |
961 | 960 |
962 profiles_->AddPathToCurrentProfiles(entries); | 961 profiles_->AddPathToCurrentProfiles(entries); |
963 } | 962 } |
964 | 963 |
965 | 964 |
966 } } // namespace v8::internal | 965 } } // namespace v8::internal |
OLD | NEW |