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

Side by Side Diff: src/profile-generator.cc

Issue 12033011: Add Isolate parameter to Persistent class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added explicit Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/cctest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 int TokenEnumerator::GetTokenId(Object* token) { 60 int TokenEnumerator::GetTokenId(Object* token) {
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(), this, 69 isolate->global_handles()->MakeWeak(handle.location(),
70 this,
71 NULL,
70 TokenRemovedCallback); 72 TokenRemovedCallback);
71 token_locations_.Add(handle.location()); 73 token_locations_.Add(handle.location());
72 token_removed_.Add(false); 74 token_removed_.Add(false);
73 return token_locations_.length() - 1; 75 return token_locations_.length() - 1;
74 } 76 }
75 77
76 78
77 void TokenEnumerator::TokenRemovedCallback(v8::Persistent<v8::Value> handle, 79 void TokenEnumerator::TokenRemovedCallback(v8::Isolate* isolate,
80 v8::Persistent<v8::Value> handle,
78 void* parameter) { 81 void* parameter) {
79 reinterpret_cast<TokenEnumerator*>(parameter)->TokenRemoved( 82 reinterpret_cast<TokenEnumerator*>(parameter)->TokenRemoved(
80 Utils::OpenHandle(*handle).location()); 83 Utils::OpenHandle(*handle).location());
81 handle.Dispose(); 84 handle.Dispose(isolate);
82 } 85 }
83 86
84 87
85 void TokenEnumerator::TokenRemoved(Object** token_location) { 88 void TokenEnumerator::TokenRemoved(Object** token_location) {
86 for (int i = 0; i < token_locations_.length(); ++i) { 89 for (int i = 0; i < token_locations_.length(); ++i) {
87 if (token_locations_[i] == token_location && !token_removed_[i]) { 90 if (token_locations_[i] == token_location && !token_removed_[i]) {
88 token_removed_[i] = true; 91 token_removed_[i] = true;
89 return; 92 return;
90 } 93 }
91 } 94 }
(...skipping 3490 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 3585
3583 3586
3584 void HeapSnapshotJSONSerializer::SortHashMap( 3587 void HeapSnapshotJSONSerializer::SortHashMap(
3585 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3588 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3586 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3589 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3587 sorted_entries->Add(p); 3590 sorted_entries->Add(p);
3588 sorted_entries->Sort(SortUsingEntryValue); 3591 sorted_entries->Sort(SortUsingEntryValue);
3589 } 3592 }
3590 3593
3591 } } // namespace v8::internal 3594 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/cctest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698