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

Side by Side Diff: src/api.cc

Issue 27512003: Enable calling the SetReference* & SetObjectGroupId functions with a Persistent<SubclassOfValue>. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | « include/v8.h ('k') | test/cctest/test-api.cc » ('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 6332 matching lines...) Expand 10 before | Expand all | Expand 10 after
6343 // to deal more gracefully with out of memory situations. 6343 // to deal more gracefully with out of memory situations.
6344 if (value.IsEmpty()) { 6344 if (value.IsEmpty()) {
6345 isolate->ScheduleThrow(isolate->heap()->undefined_value()); 6345 isolate->ScheduleThrow(isolate->heap()->undefined_value());
6346 } else { 6346 } else {
6347 isolate->ScheduleThrow(*Utils::OpenHandle(*value)); 6347 isolate->ScheduleThrow(*Utils::OpenHandle(*value));
6348 } 6348 }
6349 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); 6349 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
6350 } 6350 }
6351 6351
6352 6352
6353 void Isolate::SetObjectGroupId(const Persistent<Value>& object, 6353 void Isolate::SetObjectGroupId(internal::Object** object, UniqueId id) {
6354 UniqueId id) {
6355 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); 6354 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6356 internal_isolate->global_handles()->SetObjectGroupId( 6355 internal_isolate->global_handles()->SetObjectGroupId(
6357 Utils::OpenPersistent(object).location(), 6356 v8::internal::Handle<v8::internal::Object>(object).location(),
6358 id); 6357 id);
6358 internal_isolate->global_handles()->SetObjectGroupId(object, id);
6359 } 6359 }
6360 6360
6361 6361
6362 void Isolate::SetReferenceFromGroup(UniqueId id, 6362 void Isolate::SetReferenceFromGroup(UniqueId id, internal::Object** object) {
6363 const Persistent<Value>& object) {
6364 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); 6363 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6365 internal_isolate->global_handles()->SetReferenceFromGroup( 6364 internal_isolate->global_handles()->SetReferenceFromGroup(
6366 id, 6365 id,
6367 Utils::OpenPersistent(object).location()); 6366 v8::internal::Handle<v8::internal::Object>(object).location());
6367 internal_isolate->global_handles()->SetReferenceFromGroup(id, object);
6368 } 6368 }
6369 6369
6370 6370
6371 void Isolate::SetReference(const Persistent<Object>& parent, 6371 void Isolate::SetReference(internal::Object** parent,
6372 const Persistent<Value>& child) { 6372 internal::Object** child) {
6373 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); 6373 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6374 i::Object** parent_location = Utils::OpenPersistent(parent).location(); 6374 i::Object** parent_location =
6375 v8::internal::Handle<v8::internal::Object>(parent).location();
6375 internal_isolate->global_handles()->SetReference( 6376 internal_isolate->global_handles()->SetReference(
6376 reinterpret_cast<i::HeapObject**>(parent_location), 6377 reinterpret_cast<i::HeapObject**>(parent_location),
6377 Utils::OpenPersistent(child).location()); 6378 v8::internal::Handle<v8::internal::Object>(child).location());
6378 } 6379 }
6379 6380
6380 6381
6381 void Isolate::AddGCPrologueCallback(GCPrologueCallback callback, 6382 void Isolate::AddGCPrologueCallback(GCPrologueCallback callback,
6382 GCType gc_type) { 6383 GCType gc_type) {
6383 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6384 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6384 isolate->heap()->AddGCPrologueCallback(callback, gc_type); 6385 isolate->heap()->AddGCPrologueCallback(callback, gc_type);
6385 } 6386 }
6386 6387
6387 6388
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
7544 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7545 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7545 Address callback_address = 7546 Address callback_address =
7546 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7547 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7547 VMState<EXTERNAL> state(isolate); 7548 VMState<EXTERNAL> state(isolate);
7548 ExternalCallbackScope call_scope(isolate, callback_address); 7549 ExternalCallbackScope call_scope(isolate, callback_address);
7549 callback(info); 7550 callback(info);
7550 } 7551 }
7551 7552
7552 7553
7553 } } // namespace v8::internal 7554 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698