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

Side by Side Diff: include/v8.h

Issue 14137026: Defer slow branch of GetAlignedPointerFromInternalField (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 8 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 | « no previous file | no next file » | 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
96 #define V8_UNLIKELY(condition) __builtin_expect(condition, 0)
97 #define V8_LIKELY(condition) __builtin_expect(condition, 1)
98 #else
99 #define V8_UNLIKELY(condition) (condition)
100 #define V8_LIKELY(condition) (condition)
101 #endif
102
95 /** 103 /**
96 * The v8 JavaScript engine. 104 * The v8 JavaScript engine.
97 */ 105 */
98 namespace v8 { 106 namespace v8 {
99 107
100 class AccessorInfo; 108 class AccessorInfo;
101 class AccessorSignature; 109 class AccessorSignature;
102 class Array; 110 class Array;
103 class Boolean; 111 class Boolean;
104 class BooleanObject; 112 class BooleanObject;
(...skipping 4767 matching lines...) Expand 10 before | Expand all | Expand 10 after
4872 } 4880 }
4873 4881
4874 4882
4875 void* Object::GetAlignedPointerFromInternalField(int index) { 4883 void* Object::GetAlignedPointerFromInternalField(int index) {
4876 #ifndef V8_ENABLE_CHECKS 4884 #ifndef V8_ENABLE_CHECKS
4877 typedef internal::Object O; 4885 typedef internal::Object O;
4878 typedef internal::Internals I; 4886 typedef internal::Internals I;
4879 O* obj = *reinterpret_cast<O**>(this); 4887 O* obj = *reinterpret_cast<O**>(this);
4880 // Fast path: If the object is a plain JSObject, which is the common case, we 4888 // 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. 4889 // know where to find the internal fields and can return the value directly.
4882 if (I::GetInstanceType(obj) == I::kJSObjectType) { 4890 if (V8_LIKELY(I::GetInstanceType(obj) == I::kJSObjectType)) {
4883 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); 4891 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
4884 return I::ReadField<void*>(obj, offset); 4892 return I::ReadField<void*>(obj, offset);
4885 } 4893 }
4886 #endif 4894 #endif
4887 return SlowGetAlignedPointerFromInternalField(index); 4895 return SlowGetAlignedPointerFromInternalField(index);
4888 } 4896 }
4889 4897
4890 4898
4891 String* String::Cast(v8::Value* value) { 4899 String* String::Cast(v8::Value* value) {
4892 #ifdef V8_ENABLE_CHECKS 4900 #ifdef V8_ENABLE_CHECKS
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
5229 5237
5230 5238
5231 } // namespace v8 5239 } // namespace v8
5232 5240
5233 5241
5234 #undef V8EXPORT 5242 #undef V8EXPORT
5235 #undef TYPE_CHECK 5243 #undef TYPE_CHECK
5236 5244
5237 5245
5238 #endif // V8_H_ 5246 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698