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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 #endif | 85 #endif |
86 | 86 |
87 #if defined(__GNUC__) && !V8_DISABLE_DEPRECATIONS | 87 #if defined(__GNUC__) && !V8_DISABLE_DEPRECATIONS |
88 #define V8_DEPRECATED(declarator) declarator __attribute__ ((deprecated)) | 88 #define V8_DEPRECATED(declarator) declarator __attribute__ ((deprecated)) |
89 #elif defined(_MSC_VER) && !V8_DISABLE_DEPRECATIONS | 89 #elif defined(_MSC_VER) && !V8_DISABLE_DEPRECATIONS |
90 #define V8_DEPRECATED(declarator) __declspec(deprecated) declarator | 90 #define V8_DEPRECATED(declarator) __declspec(deprecated) declarator |
91 #else | 91 #else |
92 #define V8_DEPRECATED(declarator) declarator | 92 #define V8_DEPRECATED(declarator) declarator |
93 #endif | 93 #endif |
94 | 94 |
95 #ifdef __GNUC__ | |
Sven Panne
2013/04/26 07:09:28
An undefined preprocessor symbol evaluates to 0 by
| |
96 #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) | |
97 #define V8_UNLIKELY(x) __builtin_expect(!!(x), 0) | |
Sven Panne
2013/04/26 07:09:28
According to http://gcc.gnu.org/onlinedocs/gcc/Oth
| |
98 #define V8_LIKELY(x) __builtin_expect(!!(x), 1) | |
99 #else | |
100 #define V8_UNLIKELY(x) (x) | |
101 #define V8_LIKELY(x) (x) | |
102 #endif | |
103 #else | |
104 #define V8_UNLIKELY(x) (x) | |
105 #define V8_LIKELY(x) (x) | |
106 #endif | |
107 | |
95 /** | 108 /** |
96 * The v8 JavaScript engine. | 109 * The v8 JavaScript engine. |
97 */ | 110 */ |
98 namespace v8 { | 111 namespace v8 { |
99 | 112 |
100 class AccessorInfo; | 113 class AccessorInfo; |
101 class AccessorSignature; | 114 class AccessorSignature; |
102 class Array; | 115 class Array; |
103 class Boolean; | 116 class Boolean; |
104 class BooleanObject; | 117 class BooleanObject; |
(...skipping 4767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4872 } | 4885 } |
4873 | 4886 |
4874 | 4887 |
4875 void* Object::GetAlignedPointerFromInternalField(int index) { | 4888 void* Object::GetAlignedPointerFromInternalField(int index) { |
4876 #ifndef V8_ENABLE_CHECKS | 4889 #ifndef V8_ENABLE_CHECKS |
4877 typedef internal::Object O; | 4890 typedef internal::Object O; |
4878 typedef internal::Internals I; | 4891 typedef internal::Internals I; |
4879 O* obj = *reinterpret_cast<O**>(this); | 4892 O* obj = *reinterpret_cast<O**>(this); |
4880 // Fast path: If the object is a plain JSObject, which is the common case, we | 4893 // Fast path: If the object is a plain JSObject, which is the common case, we |
4881 // know where to find the internal fields and can return the value directly. | 4894 // know where to find the internal fields and can return the value directly. |
4882 if (I::GetInstanceType(obj) == I::kJSObjectType) { | 4895 if (V8_LIKELY(I::GetInstanceType(obj) == I::kJSObjectType)) { |
4883 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); | 4896 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); |
4884 return I::ReadField<void*>(obj, offset); | 4897 return I::ReadField<void*>(obj, offset); |
4885 } | 4898 } |
4886 #endif | 4899 #endif |
4887 return SlowGetAlignedPointerFromInternalField(index); | 4900 return SlowGetAlignedPointerFromInternalField(index); |
4888 } | 4901 } |
4889 | 4902 |
4890 | 4903 |
4891 String* String::Cast(v8::Value* value) { | 4904 String* String::Cast(v8::Value* value) { |
4892 #ifdef V8_ENABLE_CHECKS | 4905 #ifdef V8_ENABLE_CHECKS |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5229 | 5242 |
5230 | 5243 |
5231 } // namespace v8 | 5244 } // namespace v8 |
5232 | 5245 |
5233 | 5246 |
5234 #undef V8EXPORT | 5247 #undef V8EXPORT |
5235 #undef TYPE_CHECK | 5248 #undef TYPE_CHECK |
5236 | 5249 |
5237 | 5250 |
5238 #endif // V8_H_ | 5251 #endif // V8_H_ |
OLD | NEW |