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

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

Issue 3418033: [Isolates] Add isolate parameter to 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') | 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 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 22 matching lines...) Expand all
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 template<class T> 40 template<class T>
41 Handle<T>::Handle(T* obj) { 41 Handle<T>::Handle(T* obj) {
42 ASSERT(!obj->IsFailure()); 42 ASSERT(!obj->IsFailure());
43 location_ = HandleScope::CreateHandle(obj); 43 location_ = HandleScope::CreateHandle(obj, Isolate::Current());
44 } 44 }
45 45
46 46
47 template<class T>
48 Handle<T>::Handle(T* obj, Isolate* isolate) {
49 ASSERT(!obj->IsFailure());
50 location_ = HandleScope::CreateHandle(obj, isolate);
51 }
52
53
47 template <class T> 54 template <class T>
48 inline T* Handle<T>::operator*() const { 55 inline T* Handle<T>::operator*() const {
49 ASSERT(location_ != NULL); 56 ASSERT(location_ != NULL);
50 ASSERT(reinterpret_cast<Address>(*location_) != kHandleZapValue); 57 ASSERT(reinterpret_cast<Address>(*location_) != kHandleZapValue);
51 return *BitCast<T**>(location_); 58 return *BitCast<T**>(location_);
52 } 59 }
53 60
54 61
55 HandleScope::HandleScope() 62 HandleScope::HandleScope()
56 : previous_(*Isolate::Current()->handle_scope_data()) { 63 : previous_(*Isolate::Current()->handle_scope_data()) {
57 Isolate::Current()->handle_scope_data()->extensions = 0; 64 Isolate::Current()->handle_scope_data()->extensions = 0;
58 } 65 }
59 66
60 67
61 template <typename T> 68 template <typename T>
62 T** HandleScope::CreateHandle(T* value) { 69 T** HandleScope::CreateHandle(T* value, Isolate* isolate) {
70 ASSERT(isolate == Isolate::Current());
63 v8::ImplementationUtilities::HandleScopeData* current = 71 v8::ImplementationUtilities::HandleScopeData* current =
64 Isolate::Current()->handle_scope_data(); 72 isolate->handle_scope_data();
65 73
66 internal::Object** cur = current->next; 74 internal::Object** cur = current->next;
67 if (cur == current->limit) cur = Extend(); 75 if (cur == current->limit) cur = Extend();
68 // Update the current next field, set the value in the created 76 // Update the current next field, set the value in the created
69 // handle, and return the result. 77 // handle, and return the result.
70 ASSERT(cur < current->limit); 78 ASSERT(cur < current->limit);
71 current->next = cur + 1; 79 current->next = cur + 1;
72 80
73 T** result = reinterpret_cast<T**>(cur); 81 T** result = reinterpret_cast<T**>(cur);
74 *result = value; 82 *result = value;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Restore state in current handle scope to re-enable handle 124 // Restore state in current handle scope to re-enable handle
117 // allocations. 125 // allocations.
118 Isolate::Current()->handle_scope_data()->extensions = extensions_; 126 Isolate::Current()->handle_scope_data()->extensions = extensions_;
119 } 127 }
120 #endif 128 #endif
121 129
122 130
123 } } // namespace v8::internal 131 } } // namespace v8::internal
124 132
125 #endif // V8_HANDLES_INL_H_ 133 #endif // V8_HANDLES_INL_H_
OLDNEW
« no previous file with comments | « src/handles.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698