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

Side by Side Diff: src/api.h

Issue 141363005: A64: Synchronize with r15204. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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 | « src/a64/stub-cache-a64.cc ('k') | src/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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 static inline Local<DeclaredAccessorDescriptor> ToLocal( 266 static inline Local<DeclaredAccessorDescriptor> ToLocal(
267 v8::internal::Handle<v8::internal::DeclaredAccessorDescriptor> obj); 267 v8::internal::Handle<v8::internal::DeclaredAccessorDescriptor> obj);
268 268
269 #define DECLARE_OPEN_HANDLE(From, To) \ 269 #define DECLARE_OPEN_HANDLE(From, To) \
270 static inline v8::internal::Handle<v8::internal::To> \ 270 static inline v8::internal::Handle<v8::internal::To> \
271 OpenHandle(const From* that, bool allow_empty_handle = false); 271 OpenHandle(const From* that, bool allow_empty_handle = false);
272 272
273 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) 273 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE)
274 274
275 #undef DECLARE_OPEN_HANDLE 275 #undef DECLARE_OPEN_HANDLE
276
277 template<class From, class To>
278 static inline Local<To> Convert(v8::internal::Handle<From> obj) {
279 ASSERT(obj.is_null() || !obj->IsTheHole());
280 return Local<To>(reinterpret_cast<To*>(obj.location()));
281 }
282
283 template <class T>
284 static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
285 const v8::Persistent<T>& persistent) {
286 return v8::internal::Handle<v8::internal::Object>(
287 reinterpret_cast<v8::internal::Object**>(persistent.val_));
288 }
289
290 template <class T>
291 static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
292 v8::Persistent<T>* persistent) {
293 return OpenPersistent(*persistent);
294 }
295
296 template <class From, class To>
297 static inline v8::internal::Handle<To> OpenHandle(v8::Local<From> handle) {
298 return OpenHandle(*handle);
299 }
276 }; 300 };
277 301
278 302
279 template <class T> 303 template <class T>
280 inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) {
281 return reinterpret_cast<T*>(obj.location());
282 }
283
284
285 template <class T>
286 v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( 304 v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom(
287 v8::HandleScope* scope) { 305 v8::HandleScope* scope) {
288 v8::internal::Handle<T> handle; 306 v8::internal::Handle<T> handle;
289 if (!is_null()) { 307 if (!is_null()) {
290 handle = *this; 308 handle = *this;
291 } 309 }
292 return Utils::OpenHandle(*scope->Close(Utils::ToLocal(handle)), true); 310 return Utils::OpenHandle(*scope->Close(Utils::ToLocal(handle)), true);
293 } 311 }
294 312
295 313
296 class InternalHandleHelper { 314 template <class T>
297 public: 315 inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) {
298 template<class From, class To> 316 return reinterpret_cast<T*>(obj.location());
299 static inline Local<To> Convert(v8::internal::Handle<From> obj) { 317 }
300 return Local<To>(reinterpret_cast<To*>(obj.location())); 318
301 } 319 template <class T>
302 }; 320 inline v8::Local<T> ToApiHandle(
321 v8::internal::Handle<v8::internal::Object> obj) {
322 return Utils::Convert<v8::internal::Object, T>(obj);
323 }
303 324
304 325
305 // Implementations of ToLocal 326 // Implementations of ToLocal
306 327
307 #define MAKE_TO_LOCAL(Name, From, To) \ 328 #define MAKE_TO_LOCAL(Name, From, To) \
308 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ 329 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \
309 ASSERT(obj.is_null() || !obj->IsTheHole()); \ 330 return Convert<v8::internal::From, v8::To>(obj); \
310 return InternalHandleHelper::Convert<v8::internal::From, v8::To>(obj); \
311 } 331 }
312 332
313 333
314 #define MAKE_TO_LOCAL_TYPED_ARRAY(TypedArray, typeConst) \ 334 #define MAKE_TO_LOCAL_TYPED_ARRAY(TypedArray, typeConst) \
315 Local<v8::TypedArray> Utils::ToLocal##TypedArray( \ 335 Local<v8::TypedArray> Utils::ToLocal##TypedArray( \
316 v8::internal::Handle<v8::internal::JSTypedArray> obj) { \ 336 v8::internal::Handle<v8::internal::JSTypedArray> obj) { \
317 ASSERT(obj.is_null() || !obj->IsTheHole()); \
318 ASSERT(obj->type() == typeConst); \ 337 ASSERT(obj->type() == typeConst); \
319 return InternalHandleHelper:: \ 338 return Convert<v8::internal::JSTypedArray, v8::TypedArray>(obj); \
320 Convert<v8::internal::JSTypedArray, v8::TypedArray>(obj); \
321 } 339 }
322 340
323 341
324 MAKE_TO_LOCAL(ToLocal, Context, Context) 342 MAKE_TO_LOCAL(ToLocal, Context, Context)
325 MAKE_TO_LOCAL(ToLocal, Object, Value) 343 MAKE_TO_LOCAL(ToLocal, Object, Value)
326 MAKE_TO_LOCAL(ToLocal, JSFunction, Function) 344 MAKE_TO_LOCAL(ToLocal, JSFunction, Function)
327 MAKE_TO_LOCAL(ToLocal, String, String) 345 MAKE_TO_LOCAL(ToLocal, String, String)
328 MAKE_TO_LOCAL(ToLocal, Symbol, Symbol) 346 MAKE_TO_LOCAL(ToLocal, Symbol, Symbol)
329 MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp) 347 MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp)
330 MAKE_TO_LOCAL(ToLocal, JSObject, Object) 348 MAKE_TO_LOCAL(ToLocal, JSObject, Object)
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 if (spare_ != NULL) { 673 if (spare_ != NULL) {
656 DeleteArray(spare_); 674 DeleteArray(spare_);
657 } 675 }
658 spare_ = block_start; 676 spare_ = block_start;
659 } 677 }
660 ASSERT((blocks_.is_empty() && prev_limit == NULL) || 678 ASSERT((blocks_.is_empty() && prev_limit == NULL) ||
661 (!blocks_.is_empty() && prev_limit != NULL)); 679 (!blocks_.is_empty() && prev_limit != NULL));
662 } 680 }
663 681
664 682
683 // Interceptor functions called from generated inline caches to notify
684 // CPU profiler that external callbacks are invoked.
685 v8::Handle<v8::Value> InvokeAccessorGetter(
686 v8::Local<v8::String> property,
687 const v8::AccessorInfo& info,
688 v8::AccessorGetter getter);
689
690
691 void InvokeAccessorGetterCallback(
692 v8::Local<v8::String> property,
693 const v8::PropertyCallbackInfo<v8::Value>& info,
694 v8::AccessorGetterCallback getter);
695
696 v8::Handle<v8::Value> InvokeInvocationCallback(const v8::Arguments& args,
697 v8::InvocationCallback callback);
698 void InvokeFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
699 v8::FunctionCallback callback);
700
665 class Testing { 701 class Testing {
666 public: 702 public:
667 static v8::Testing::StressType stress_type() { return stress_type_; } 703 static v8::Testing::StressType stress_type() { return stress_type_; }
668 static void set_stress_type(v8::Testing::StressType stress_type) { 704 static void set_stress_type(v8::Testing::StressType stress_type) {
669 stress_type_ = stress_type; 705 stress_type_ = stress_type;
670 } 706 }
671 707
672 private: 708 private:
673 static v8::Testing::StressType stress_type_; 709 static v8::Testing::StressType stress_type_;
674 }; 710 };
675 711
676 } } // namespace v8::internal 712 } } // namespace v8::internal
677 713
678 #endif // V8_API_H_ 714 #endif // V8_API_H_
OLDNEW
« no previous file with comments | « src/a64/stub-cache-a64.cc ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698