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

Side by Side Diff: src/api.cc

Issue 2751263003: Give v8::Eternal a direct reference to the handle. (Closed)
Patch Set: Merge branch 'master' into slim-eternal Created 3 years, 9 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
« no previous file with comments | « include/v8.h ('k') | no next file » | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 } 941 }
942 942
943 void* V8::ClearWeak(i::Object** location) { 943 void* V8::ClearWeak(i::Object** location) {
944 return i::GlobalHandles::ClearWeakness(location); 944 return i::GlobalHandles::ClearWeakness(location);
945 } 945 }
946 946
947 void V8::DisposeGlobal(i::Object** location) { 947 void V8::DisposeGlobal(i::Object** location) {
948 i::GlobalHandles::Destroy(location); 948 i::GlobalHandles::Destroy(location);
949 } 949 }
950 950
951 951 Value* V8::Eternalize(Isolate* v8_isolate, Value* value) {
952 void V8::Eternalize(Isolate* v8_isolate, Value* value, int* index) {
953 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 952 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
954 i::Object* object = *Utils::OpenHandle(value); 953 i::Object* object = *Utils::OpenHandle(value);
955 isolate->eternal_handles()->Create(isolate, object, index); 954 int index = -1;
955 isolate->eternal_handles()->Create(isolate, object, &index);
956 return reinterpret_cast<Value*>(
957 isolate->eternal_handles()->Get(index).location());
956 } 958 }
957 959
958 960
959 Local<Value> V8::GetEternal(Isolate* v8_isolate, int index) {
960 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
961 return Utils::ToLocal(isolate->eternal_handles()->Get(index));
962 }
963
964
965 void V8::FromJustIsNothing() { 961 void V8::FromJustIsNothing() {
966 Utils::ApiCheck(false, "v8::FromJust", "Maybe value is Nothing."); 962 Utils::ApiCheck(false, "v8::FromJust", "Maybe value is Nothing.");
967 } 963 }
968 964
969 965
970 void V8::ToLocalEmpty() { 966 void V8::ToLocalEmpty() {
971 Utils::ApiCheck(false, "v8::ToLocalChecked", "Empty MaybeLocal."); 967 Utils::ApiCheck(false, "v8::ToLocalChecked", "Empty MaybeLocal.");
972 } 968 }
973 969
974 void V8::InternalFieldOutOfBounds(int index) { 970 void V8::InternalFieldOutOfBounds(int index) {
(...skipping 9271 matching lines...) Expand 10 before | Expand all | Expand 10 after
10246 Address callback_address = 10242 Address callback_address =
10247 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10243 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10248 VMState<EXTERNAL> state(isolate); 10244 VMState<EXTERNAL> state(isolate);
10249 ExternalCallbackScope call_scope(isolate, callback_address); 10245 ExternalCallbackScope call_scope(isolate, callback_address);
10250 callback(info); 10246 callback(info);
10251 } 10247 }
10252 10248
10253 10249
10254 } // namespace internal 10250 } // namespace internal
10255 } // namespace v8 10251 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698