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 3957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3968 return representation == kExternalTwoByteRepresentationTag; | 3968 return representation == kExternalTwoByteRepresentationTag; |
3969 } | 3969 } |
3970 | 3970 |
3971 static inline bool IsInitialized(v8::Isolate* isolate) { | 3971 static inline bool IsInitialized(v8::Isolate* isolate) { |
3972 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateStateOffset; | 3972 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateStateOffset; |
3973 return *reinterpret_cast<int*>(addr) == 1; | 3973 return *reinterpret_cast<int*>(addr) == 1; |
3974 } | 3974 } |
3975 | 3975 |
3976 static inline internal::Object** GetRoot(v8::Isolate* isolate, int index) { | 3976 static inline internal::Object** GetRoot(v8::Isolate* isolate, int index) { |
3977 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset; | 3977 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset; |
3978 return &reinterpret_cast<internal::Object**>(addr)[index]; | 3978 return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize); |
3979 } | 3979 } |
3980 | 3980 |
3981 template <typename T> | 3981 template <typename T> |
3982 static inline T ReadField(Object* ptr, int offset) { | 3982 static inline T ReadField(Object* ptr, int offset) { |
3983 uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag; | 3983 uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag; |
3984 return *reinterpret_cast<T*>(addr); | 3984 return *reinterpret_cast<T*>(addr); |
3985 } | 3985 } |
3986 | 3986 |
3987 static inline bool CanCastToHeapObject(void* o) { return false; } | 3987 static inline bool CanCastToHeapObject(void* o) { return false; } |
3988 static inline bool CanCastToHeapObject(Context* o) { return true; } | 3988 static inline bool CanCastToHeapObject(Context* o) { return true; } |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4449 | 4449 |
4450 | 4450 |
4451 } // namespace v8 | 4451 } // namespace v8 |
4452 | 4452 |
4453 | 4453 |
4454 #undef V8EXPORT | 4454 #undef V8EXPORT |
4455 #undef TYPE_CHECK | 4455 #undef TYPE_CHECK |
4456 | 4456 |
4457 | 4457 |
4458 #endif // V8_H_ | 4458 #endif // V8_H_ |
OLD | NEW |