| OLD | NEW |
| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 template <typename T> inline T ToCData(v8::internal::Object* obj) { | 119 template <typename T> inline T ToCData(v8::internal::Object* obj) { |
| 120 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); | 120 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); |
| 121 return reinterpret_cast<T>( | 121 return reinterpret_cast<T>( |
| 122 reinterpret_cast<intptr_t>( | 122 reinterpret_cast<intptr_t>( |
| 123 v8::internal::Foreign::cast(obj)->foreign_address())); | 123 v8::internal::Foreign::cast(obj)->foreign_address())); |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 template <typename T> | 127 template <typename T> |
| 128 inline v8::internal::Handle<v8::internal::Object> FromCData(T obj) { | 128 inline v8::internal::Handle<v8::internal::Object> FromCData( |
| 129 v8::internal::Isolate* isolate = v8::internal::Isolate::Current(); | 129 v8::internal::Isolate* isolate, T obj) { |
| 130 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); | 130 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); |
| 131 return isolate->factory()->NewForeign( | 131 return isolate->factory()->NewForeign( |
| 132 reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj))); | 132 reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj))); |
| 133 } | 133 } |
| 134 | 134 |
| 135 | 135 |
| 136 class ApiFunction { | 136 class ApiFunction { |
| 137 public: | 137 public: |
| 138 explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { } | 138 explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { } |
| 139 v8::internal::Address address() { return addr_; } | 139 v8::internal::Address address() { return addr_; } |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 stress_type_ = stress_type; | 705 stress_type_ = stress_type; |
| 706 } | 706 } |
| 707 | 707 |
| 708 private: | 708 private: |
| 709 static v8::Testing::StressType stress_type_; | 709 static v8::Testing::StressType stress_type_; |
| 710 }; | 710 }; |
| 711 | 711 |
| 712 } } // namespace v8::internal | 712 } } // namespace v8::internal |
| 713 | 713 |
| 714 #endif // V8_API_H_ | 714 #endif // V8_API_H_ |
| OLD | NEW |