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

Unified Diff: src/objects-inl.h

Issue 1413033006: Reland "[es6] Better support for built-ins subclassing." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: We don't need TypedArray map smashing anymore 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index bfdf7b66d0b321c6d840f8a630b4bc5a1e260b99..6dc3d38365e688529fb00e6268b21ce51763cf79 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2134,8 +2134,10 @@ void WeakCell::clear_next(Heap* heap) {
bool WeakCell::next_cleared() { return next()->IsTheHole(); }
-int JSObject::GetHeaderSize() {
- InstanceType type = map()->instance_type();
+int JSObject::GetHeaderSize() { return GetHeaderSize(map()->instance_type()); }
+
+
+int JSObject::GetHeaderSize(InstanceType type) {
// Check for the most common kind of JavaScript object before
// falling into the generic switch. This speeds up the internal
// field operations considerably on average.
@@ -2192,15 +2194,18 @@ int JSObject::GetHeaderSize() {
}
-int JSObject::GetInternalFieldCount() {
- DCHECK(1 << kPointerSizeLog2 == kPointerSize);
- // Make sure to adjust for the number of in-object properties. These
- // properties do contribute to the size, but are not internal fields.
- return ((Size() - GetHeaderSize()) >> kPointerSizeLog2) -
- map()->GetInObjectProperties();
+int JSObject::GetInternalFieldCount(Map* map) {
+ int instance_size = map->instance_size();
+ if (instance_size == kVariableSizeSentinel) return 0;
+ InstanceType instance_type = map->instance_type();
+ return ((instance_size - GetHeaderSize(instance_type)) >> kPointerSizeLog2) -
+ map->GetInObjectProperties();
}
+int JSObject::GetInternalFieldCount() { return GetInternalFieldCount(map()); }
+
+
int JSObject::GetInternalFieldOffset(int index) {
DCHECK(index < GetInternalFieldCount() && index >= 0);
return GetHeaderSize() + (kPointerSize * index);
@@ -5624,6 +5629,12 @@ void Map::SetConstructor(Object* constructor, WriteBarrierMode mode) {
}
+Handle<Map> Map::CopyInitialMap(Handle<Map> map) {
+ return CopyInitialMap(map, map->instance_size(), map->GetInObjectProperties(),
+ map->unused_property_fields());
+}
+
+
ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset)
ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset)
« 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