OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return v8::internal::FixedArray::cast(value()->elements())->get(offset); | 105 return v8::internal::FixedArray::cast(value()->elements())->get(offset); |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 void NeanderObject::set(int offset, v8::internal::Object* value) { | 109 void NeanderObject::set(int offset, v8::internal::Object* value) { |
110 ASSERT(value_->HasFastElements()); | 110 ASSERT(value_->HasFastElements()); |
111 v8::internal::FixedArray::cast(value_->elements())->set(offset, value); | 111 v8::internal::FixedArray::cast(value_->elements())->set(offset, value); |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 template <typename T> static inline T ToCData(v8::internal::Object* obj) { | 115 template <typename T> inline T ToCData(v8::internal::Object* obj) { |
116 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); | 116 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); |
117 return reinterpret_cast<T>( | 117 return reinterpret_cast<T>( |
118 reinterpret_cast<intptr_t>( | 118 reinterpret_cast<intptr_t>( |
119 v8::internal::Foreign::cast(obj)->foreign_address())); | 119 v8::internal::Foreign::cast(obj)->foreign_address())); |
120 } | 120 } |
121 | 121 |
122 | 122 |
123 template <typename T> | 123 template <typename T> |
124 static inline v8::internal::Handle<v8::internal::Object> FromCData(T obj) { | 124 inline v8::internal::Handle<v8::internal::Object> FromCData(T obj) { |
125 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); | 125 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); |
126 return FACTORY->NewForeign( | 126 return FACTORY->NewForeign( |
127 reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj))); | 127 reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj))); |
128 } | 128 } |
129 | 129 |
130 | 130 |
131 class ApiFunction { | 131 class ApiFunction { |
132 public: | 132 public: |
133 explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { } | 133 explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { } |
134 v8::internal::Address address() { return addr_; } | 134 v8::internal::Address address() { return addr_; } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 static inline v8::internal::Handle<v8::internal::SignatureInfo> | 229 static inline v8::internal::Handle<v8::internal::SignatureInfo> |
230 OpenHandle(const v8::Signature* sig); | 230 OpenHandle(const v8::Signature* sig); |
231 static inline v8::internal::Handle<v8::internal::TypeSwitchInfo> | 231 static inline v8::internal::Handle<v8::internal::TypeSwitchInfo> |
232 OpenHandle(const v8::TypeSwitch* that); | 232 OpenHandle(const v8::TypeSwitch* that); |
233 static inline v8::internal::Handle<v8::internal::Foreign> | 233 static inline v8::internal::Handle<v8::internal::Foreign> |
234 OpenHandle(const v8::External* that); | 234 OpenHandle(const v8::External* that); |
235 }; | 235 }; |
236 | 236 |
237 | 237 |
238 template <class T> | 238 template <class T> |
239 static inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) { | 239 inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) { |
240 return reinterpret_cast<T*>(obj.location()); | 240 return reinterpret_cast<T*>(obj.location()); |
241 } | 241 } |
242 | 242 |
243 | 243 |
244 template <class T> | 244 template <class T> |
245 v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( | 245 v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( |
246 v8::HandleScope* scope) { | 246 v8::HandleScope* scope) { |
247 v8::internal::Handle<T> handle; | 247 v8::internal::Handle<T> handle; |
248 if (!is_null()) { | 248 if (!is_null()) { |
249 handle = *this; | 249 handle = *this; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 v8::ImplementationUtilities::HandleScopeData handle_scope_data_; | 470 v8::ImplementationUtilities::HandleScopeData handle_scope_data_; |
471 | 471 |
472 void IterateThis(ObjectVisitor* v); | 472 void IterateThis(ObjectVisitor* v); |
473 char* RestoreThreadHelper(char* from); | 473 char* RestoreThreadHelper(char* from); |
474 char* ArchiveThreadHelper(char* to); | 474 char* ArchiveThreadHelper(char* to); |
475 | 475 |
476 DISALLOW_COPY_AND_ASSIGN(HandleScopeImplementer); | 476 DISALLOW_COPY_AND_ASSIGN(HandleScopeImplementer); |
477 }; | 477 }; |
478 | 478 |
479 | 479 |
480 static const int kHandleBlockSize = v8::internal::KB - 2; // fit in one page | 480 const int kHandleBlockSize = v8::internal::KB - 2; // fit in one page |
481 | 481 |
482 | 482 |
483 void HandleScopeImplementer::SaveContext(Context* context) { | 483 void HandleScopeImplementer::SaveContext(Context* context) { |
484 saved_contexts_.Add(context); | 484 saved_contexts_.Add(context); |
485 } | 485 } |
486 | 486 |
487 | 487 |
488 Context* HandleScopeImplementer::RestoreContext() { | 488 Context* HandleScopeImplementer::RestoreContext() { |
489 return saved_contexts_.RemoveLast(); | 489 return saved_contexts_.RemoveLast(); |
490 } | 490 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 stress_type_ = stress_type; | 555 stress_type_ = stress_type; |
556 } | 556 } |
557 | 557 |
558 private: | 558 private: |
559 static v8::Testing::StressType stress_type_; | 559 static v8::Testing::StressType stress_type_; |
560 }; | 560 }; |
561 | 561 |
562 } } // namespace v8::internal | 562 } } // namespace v8::internal |
563 | 563 |
564 #endif // V8_API_H_ | 564 #endif // V8_API_H_ |
OLD | NEW |