OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 template <class T> | 238 template <class T> |
239 v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( | 239 v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( |
240 v8::HandleScope* scope) { | 240 v8::HandleScope* scope) { |
241 return Utils::OpenHandle(*scope->Close(Utils::ToLocal(*this))); | 241 return Utils::OpenHandle(*scope->Close(Utils::ToLocal(*this))); |
242 } | 242 } |
243 | 243 |
244 | 244 |
245 // Implementations of ToLocal | 245 // Implementations of ToLocal |
246 | 246 |
247 #define MAKE_TO_LOCAL(Name, From, To) \ | 247 #define MAKE_TO_LOCAL(Name, From, To) \ |
248 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ | 248 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ |
249 return Local<To>(reinterpret_cast<To*>(obj.location())); \ | 249 ASSERT(!obj->IsTheHole()); \ |
| 250 return Local<To>(reinterpret_cast<To*>(obj.location())); \ |
250 } | 251 } |
251 | 252 |
252 MAKE_TO_LOCAL(ToLocal, Context, Context) | 253 MAKE_TO_LOCAL(ToLocal, Context, Context) |
253 MAKE_TO_LOCAL(ToLocal, Object, Value) | 254 MAKE_TO_LOCAL(ToLocal, Object, Value) |
254 MAKE_TO_LOCAL(ToLocal, JSFunction, Function) | 255 MAKE_TO_LOCAL(ToLocal, JSFunction, Function) |
255 MAKE_TO_LOCAL(ToLocal, String, String) | 256 MAKE_TO_LOCAL(ToLocal, String, String) |
256 MAKE_TO_LOCAL(ToLocal, JSObject, Object) | 257 MAKE_TO_LOCAL(ToLocal, JSObject, Object) |
257 MAKE_TO_LOCAL(ToLocal, JSArray, Array) | 258 MAKE_TO_LOCAL(ToLocal, JSArray, Array) |
258 MAKE_TO_LOCAL(ToLocal, Proxy, External) | 259 MAKE_TO_LOCAL(ToLocal, Proxy, External) |
259 MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate) | 260 MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate) |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 #ifdef DEBUG | 446 #ifdef DEBUG |
446 v8::ImplementationUtilities::ZapHandleRange( | 447 v8::ImplementationUtilities::ZapHandleRange( |
447 reinterpret_cast<void**>(spare), | 448 reinterpret_cast<void**>(spare), |
448 reinterpret_cast<void**>(&spare[kHandleBlockSize])); | 449 reinterpret_cast<void**>(&spare[kHandleBlockSize])); |
449 #endif | 450 #endif |
450 } | 451 } |
451 | 452 |
452 } } // namespace v8::internal | 453 } } // namespace v8::internal |
453 | 454 |
454 #endif // V8_API_H_ | 455 #endif // V8_API_H_ |
OLD | NEW |