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

Side by Side Diff: src/api.cc

Issue 10837122: Make AdjustAmountOfExternalAllocatedMemory() more robust. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 | « no previous file | src/heap.cc » ('j') | src/heap.cc » ('J')
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 5257 matching lines...) Expand 10 before | Expand all | Expand 10 after
5268 i::Isolate* isolate = i::Isolate::Current(); 5268 i::Isolate* isolate = i::Isolate::Current();
5269 if (IsDeadCheck(isolate, "v8::V8::AddImplicitReferences()")) return; 5269 if (IsDeadCheck(isolate, "v8::V8::AddImplicitReferences()")) return;
5270 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); 5270 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
5271 isolate->global_handles()->AddImplicitReferences( 5271 isolate->global_handles()->AddImplicitReferences(
5272 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(*parent)).location(), 5272 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(*parent)).location(),
5273 reinterpret_cast<i::Object***>(children), length); 5273 reinterpret_cast<i::Object***>(children), length);
5274 } 5274 }
5275 5275
5276 5276
5277 intptr_t V8::AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes) { 5277 intptr_t V8::AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes) {
5278 i::Isolate* isolate = i::Isolate::Current(); 5278 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5279 if (IsDeadCheck(isolate, "v8::V8::AdjustAmountOfExternalAllocatedMemory()")) { 5279 if (isolate == NULL || !isolate->IsInitialized() ||
Erik Corry 2012/08/07 07:32:13 This seems a bit fragile. If we are silently igno
ulan 2012/08/07 09:05:52 It's tricky with all those transfers between threa
5280 IsDeadCheck(isolate, "v8::V8::AdjustAmountOfExternalAllocatedMemory()")) {
5280 return 0; 5281 return 0;
5281 } 5282 }
5282 return isolate->heap()->AdjustAmountOfExternalAllocatedMemory( 5283 return isolate->heap()->AdjustAmountOfExternalAllocatedMemory(
5283 change_in_bytes); 5284 change_in_bytes);
5284 } 5285 }
5285 5286
5286 5287
5287 void V8::SetGlobalGCPrologueCallback(GCCallback callback) { 5288 void V8::SetGlobalGCPrologueCallback(GCCallback callback) {
5288 i::Isolate* isolate = i::Isolate::Current(); 5289 i::Isolate* isolate = i::Isolate::Current();
5289 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return; 5290 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return;
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
6521 6522
6522 v->VisitPointers(blocks_.first(), first_block_limit_); 6523 v->VisitPointers(blocks_.first(), first_block_limit_);
6523 6524
6524 for (int i = 1; i < blocks_.length(); i++) { 6525 for (int i = 1; i < blocks_.length(); i++) {
6525 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6526 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6526 } 6527 }
6527 } 6528 }
6528 6529
6529 6530
6530 } } // namespace v8::internal 6531 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698