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

Side by Side Diff: src/objects-inl.h

Issue 1416943005: Revert of [es6] Better support for built-ins subclassing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 2125
2126 2126
2127 void WeakCell::clear_next(Heap* heap) { 2127 void WeakCell::clear_next(Heap* heap) {
2128 set_next(heap->the_hole_value(), SKIP_WRITE_BARRIER); 2128 set_next(heap->the_hole_value(), SKIP_WRITE_BARRIER);
2129 } 2129 }
2130 2130
2131 2131
2132 bool WeakCell::next_cleared() { return next()->IsTheHole(); } 2132 bool WeakCell::next_cleared() { return next()->IsTheHole(); }
2133 2133
2134 2134
2135 int JSObject::GetHeaderSize() { return GetHeaderSize(map()->instance_type()); } 2135 int JSObject::GetHeaderSize() {
2136 2136 InstanceType type = map()->instance_type();
2137
2138 int JSObject::GetHeaderSize(InstanceType type) {
2139 // Check for the most common kind of JavaScript object before 2137 // Check for the most common kind of JavaScript object before
2140 // falling into the generic switch. This speeds up the internal 2138 // falling into the generic switch. This speeds up the internal
2141 // field operations considerably on average. 2139 // field operations considerably on average.
2142 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; 2140 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize;
2143 switch (type) { 2141 switch (type) {
2144 case JS_GENERATOR_OBJECT_TYPE: 2142 case JS_GENERATOR_OBJECT_TYPE:
2145 return JSGeneratorObject::kSize; 2143 return JSGeneratorObject::kSize;
2146 case JS_MODULE_TYPE: 2144 case JS_MODULE_TYPE:
2147 return JSModule::kSize; 2145 return JSModule::kSize;
2148 case JS_GLOBAL_PROXY_TYPE: 2146 case JS_GLOBAL_PROXY_TYPE:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2185 return JSObject::kHeaderSize; 2183 return JSObject::kHeaderSize;
2186 case JS_MESSAGE_OBJECT_TYPE: 2184 case JS_MESSAGE_OBJECT_TYPE:
2187 return JSMessageObject::kSize; 2185 return JSMessageObject::kSize;
2188 default: 2186 default:
2189 UNREACHABLE(); 2187 UNREACHABLE();
2190 return 0; 2188 return 0;
2191 } 2189 }
2192 } 2190 }
2193 2191
2194 2192
2195 int JSObject::GetInternalFieldCount(Map* map) { 2193 int JSObject::GetInternalFieldCount() {
2196 int instance_size = map->instance_size(); 2194 DCHECK(1 << kPointerSizeLog2 == kPointerSize);
2197 if (instance_size == kVariableSizeSentinel) return 0; 2195 // Make sure to adjust for the number of in-object properties. These
2198 InstanceType instance_type = map->instance_type(); 2196 // properties do contribute to the size, but are not internal fields.
2199 return ((instance_size - GetHeaderSize(instance_type)) >> kPointerSizeLog2) - 2197 return ((Size() - GetHeaderSize()) >> kPointerSizeLog2) -
2200 map->GetInObjectProperties(); 2198 map()->GetInObjectProperties();
2201 } 2199 }
2202 2200
2203 2201
2204 int JSObject::GetInternalFieldCount() { return GetInternalFieldCount(map()); }
2205
2206
2207 int JSObject::GetInternalFieldOffset(int index) { 2202 int JSObject::GetInternalFieldOffset(int index) {
2208 DCHECK(index < GetInternalFieldCount() && index >= 0); 2203 DCHECK(index < GetInternalFieldCount() && index >= 0);
2209 return GetHeaderSize() + (kPointerSize * index); 2204 return GetHeaderSize() + (kPointerSize * index);
2210 } 2205 }
2211 2206
2212 2207
2213 Object* JSObject::GetInternalField(int index) { 2208 Object* JSObject::GetInternalField(int index) {
2214 DCHECK(index < GetInternalFieldCount() && index >= 0); 2209 DCHECK(index < GetInternalFieldCount() && index >= 0);
2215 // Internal objects do follow immediately after the header, whereas in-object 2210 // Internal objects do follow immediately after the header, whereas in-object
2216 // properties are at the end of the object. Therefore there is no need 2211 // properties are at the end of the object. Therefore there is no need
(...skipping 3403 matching lines...) Expand 10 before | Expand all | Expand 10 after
5620 } 5615 }
5621 5616
5622 5617
5623 void Map::SetConstructor(Object* constructor, WriteBarrierMode mode) { 5618 void Map::SetConstructor(Object* constructor, WriteBarrierMode mode) {
5624 // Never overwrite a back pointer with a constructor. 5619 // Never overwrite a back pointer with a constructor.
5625 DCHECK(!constructor_or_backpointer()->IsMap()); 5620 DCHECK(!constructor_or_backpointer()->IsMap());
5626 set_constructor_or_backpointer(constructor, mode); 5621 set_constructor_or_backpointer(constructor, mode);
5627 } 5622 }
5628 5623
5629 5624
5630 Handle<Map> Map::CopyInitialMap(Handle<Map> map) {
5631 return CopyInitialMap(map, map->instance_size(), map->GetInObjectProperties(),
5632 map->unused_property_fields());
5633 }
5634
5635
5636 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) 5625 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
5637 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) 5626 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset)
5638 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) 5627 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset)
5639 5628
5640 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) 5629 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
5641 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) 5630 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset)
5642 ACCESSORS(GlobalObject, global_proxy, JSObject, kGlobalProxyOffset) 5631 ACCESSORS(GlobalObject, global_proxy, JSObject, kGlobalProxyOffset)
5643 5632
5644 ACCESSORS(JSGlobalProxy, native_context, Object, kNativeContextOffset) 5633 ACCESSORS(JSGlobalProxy, native_context, Object, kNativeContextOffset)
5645 ACCESSORS(JSGlobalProxy, hash, Object, kHashOffset) 5634 ACCESSORS(JSGlobalProxy, hash, Object, kHashOffset)
(...skipping 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after
8143 #undef WRITE_INT64_FIELD 8132 #undef WRITE_INT64_FIELD
8144 #undef READ_BYTE_FIELD 8133 #undef READ_BYTE_FIELD
8145 #undef WRITE_BYTE_FIELD 8134 #undef WRITE_BYTE_FIELD
8146 #undef NOBARRIER_READ_BYTE_FIELD 8135 #undef NOBARRIER_READ_BYTE_FIELD
8147 #undef NOBARRIER_WRITE_BYTE_FIELD 8136 #undef NOBARRIER_WRITE_BYTE_FIELD
8148 8137
8149 } // namespace internal 8138 } // namespace internal
8150 } // namespace v8 8139 } // namespace v8
8151 8140
8152 #endif // V8_OBJECTS_INL_H_ 8141 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698