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

Side by Side Diff: src/handles-inl.h

Issue 3788008: [Isolates] Fix auto extraction of isolate from heap objects in handle constructor. (Closed)
Patch Set: Created 10 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
« no previous file with comments | « src/handles.h ('k') | src/heap-inl.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 19 matching lines...) Expand all
30 #define V8_HANDLES_INL_H_ 30 #define V8_HANDLES_INL_H_
31 31
32 #include "api.h" 32 #include "api.h"
33 #include "apiutils.h" 33 #include "apiutils.h"
34 #include "handles.h" 34 #include "handles.h"
35 #include "isolate.h" 35 #include "isolate.h"
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 inline Isolate* GetIsolateForHandle(Object* obj) {
41 return Isolate::Current();
42 }
43
44 inline Isolate* GetIsolateForHandle(HeapObject* obj) {
45 return obj->GetIsolate();
46 }
47
40 template<class T> 48 template<class T>
41 Handle<T>::Handle(T* obj) { 49 Handle<T>::Handle(T* obj) {
42 ASSERT(!obj->IsFailure()); 50 ASSERT(!obj->IsFailure());
43 location_ = HandleScope::CreateHandle(obj, Isolate::Current()); 51 location_ = HandleScope::CreateHandle(obj, GetIsolateForHandle(obj));
44 }
45
46 template<class T>
47 Handle<T>::Handle(HeapObject* obj) {
48 location_ = HandleScope::CreateHandle<T>(obj, obj->GetIsolate());
49 } 52 }
50 53
51 54
52 template<class T> 55 template<class T>
53 Handle<T>::Handle(T* obj, Isolate* isolate) { 56 Handle<T>::Handle(T* obj, Isolate* isolate) {
54 ASSERT(!obj->IsFailure()); 57 ASSERT(!obj->IsFailure());
55 location_ = HandleScope::CreateHandle(obj, isolate); 58 location_ = HandleScope::CreateHandle(obj, isolate);
56 } 59 }
57 60
58 61
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // Restore state in current handle scope to re-enable handle 160 // Restore state in current handle scope to re-enable handle
158 // allocations. 161 // allocations.
159 Isolate::Current()->handle_scope_data()->extensions = extensions_; 162 Isolate::Current()->handle_scope_data()->extensions = extensions_;
160 } 163 }
161 #endif 164 #endif
162 165
163 166
164 } } // namespace v8::internal 167 } } // namespace v8::internal
165 168
166 #endif // V8_HANDLES_INL_H_ 169 #endif // V8_HANDLES_INL_H_
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698