Chromium Code Reviews

Side by Side Diff: src/api.cc

Issue 14007008: New GC APIs, try 2. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: . Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 5907 matching lines...)
5918 RetainedObjectInfo* info) { 5918 RetainedObjectInfo* info) {
5919 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate); 5919 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate);
5920 ASSERT(isolate == i::Isolate::Current()); 5920 ASSERT(isolate == i::Isolate::Current());
5921 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return; 5921 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return;
5922 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); 5922 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
5923 isolate->global_handles()->AddObjectGroup( 5923 isolate->global_handles()->AddObjectGroup(
5924 reinterpret_cast<i::Object***>(objects), length, info); 5924 reinterpret_cast<i::Object***>(objects), length, info);
5925 } 5925 }
5926 5926
5927 5927
5928 void V8::SetObjectGroupId(Isolate* exported_isolate,
5929 const Persistent<Value>& object,
5930 UniqueId id) {
5931 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate);
5932 isolate->global_handles()->SetObjectGroupId(
5933 reinterpret_cast<i::Object**>(*object), id);
5934 }
5935
5936
5937 void V8::SetRetainedObjectInfo(Isolate* exported_isolate,
5938 UniqueId id,
5939 RetainedObjectInfo* info) {
5940 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate);
5941 isolate->global_handles()->SetRetainedObjectInfo(id, info);
5942 }
5943
5944
5928 void V8::AddImplicitReferences(Persistent<Object> parent, 5945 void V8::AddImplicitReferences(Persistent<Object> parent,
5929 Persistent<Value>* children, 5946 Persistent<Value>* children,
5930 size_t length) { 5947 size_t length) {
5931 i::Isolate* isolate = i::Isolate::Current(); 5948 i::Isolate* isolate = i::Isolate::Current();
5932 if (IsDeadCheck(isolate, "v8::V8::AddImplicitReferences()")) return; 5949 if (IsDeadCheck(isolate, "v8::V8::AddImplicitReferences()")) return;
5933 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); 5950 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
5934 isolate->global_handles()->AddImplicitReferences( 5951 isolate->global_handles()->AddImplicitReferences(
5935 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(*parent)).location(), 5952 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(*parent)).location(),
5936 reinterpret_cast<i::Object***>(children), length); 5953 reinterpret_cast<i::Object***>(children), length);
5937 } 5954 }
5938 5955
5939 5956
5957 void V8::AddImplicitReference(Isolate* exported_isolate,
5958 UniqueId id,
5959 const Persistent<Value>& object) {
5960 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate);
5961 isolate->global_handles()
5962 ->AddImplicitReference(id, reinterpret_cast<i::Object**>(*object));
5963 }
5964
5965
5940 intptr_t Isolate::AdjustAmountOfExternalAllocatedMemory( 5966 intptr_t Isolate::AdjustAmountOfExternalAllocatedMemory(
5941 intptr_t change_in_bytes) { 5967 intptr_t change_in_bytes) {
5942 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap(); 5968 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap();
5943 return heap->AdjustAmountOfExternalAllocatedMemory(change_in_bytes); 5969 return heap->AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
5944 } 5970 }
5945 5971
5946 5972
5947 intptr_t V8::AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes) { 5973 intptr_t V8::AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes) {
5948 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 5974 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5949 if (isolate == NULL || !isolate->IsInitialized() || 5975 if (isolate == NULL || !isolate->IsInitialized() ||
(...skipping 1428 matching lines...)
7378 7404
7379 v->VisitPointers(blocks_.first(), first_block_limit_); 7405 v->VisitPointers(blocks_.first(), first_block_limit_);
7380 7406
7381 for (int i = 1; i < blocks_.length(); i++) { 7407 for (int i = 1; i < blocks_.length(); i++) {
7382 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7408 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7383 } 7409 }
7384 } 7410 }
7385 7411
7386 7412
7387 } } // namespace v8::internal 7413 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine