Version 2.2.22
Added ES5 Object.isExtensible and Object.preventExtensions.
Enabled building V8 as a DLL.
Fixed a bug in date code where -0 was not interpreted as 0 (issue 736).
Performance improvements on all platforms.
git-svn-id: http://v8.googlecode.com/svn/trunk@5017 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/objects-inl.h b/src/objects-inl.h
index f9def82..79f2c97 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1335,6 +1335,21 @@
}
+bool JSObject::HasFastProperties() {
+ return !properties()->IsDictionary();
+}
+
+
+int JSObject::MaxFastProperties() {
+ // Allow extra fast properties if the object has more than
+ // kMaxFastProperties in-object properties. When this is the case,
+ // it is very unlikely that the object is being used as a dictionary
+ // and there is a good chance that allowing more map transitions
+ // will be worth it.
+ return Max(map()->inobject_properties(), kMaxFastProperties);
+}
+
+
void Struct::InitializeBody(int object_size) {
Object* value = Heap::undefined_value();
for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
@@ -1343,11 +1358,6 @@
}
-bool JSObject::HasFastProperties() {
- return !properties()->IsDictionary();
-}
-
-
bool Object::ToArrayIndex(uint32_t* index) {
if (IsSmi()) {
int value = Smi::cast(this)->value();
@@ -2189,6 +2199,20 @@
}
+void Map::set_is_extensible(bool value) {
+ if (value) {
+ set_bit_field2(bit_field2() | (1 << kIsExtensible));
+ } else {
+ set_bit_field2(bit_field2() & ~(1 << kIsExtensible));
+ }
+}
+
+bool Map::is_extensible() {
+ return ((1 << kIsExtensible) & bit_field2()) != 0;
+}
+
+
+
Code::Flags Code::flags() {
return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset));
}
@@ -2263,13 +2287,15 @@
InLoopFlag in_loop,
InlineCacheState ic_state,
PropertyType type,
- int argc) {
+ int argc,
+ InlineCacheHolderFlag holder) {
// Compute the bit mask.
int bits = kind << kFlagsKindShift;
if (in_loop) bits |= kFlagsICInLoopMask;
bits |= ic_state << kFlagsICStateShift;
bits |= type << kFlagsTypeShift;
bits |= argc << kFlagsArgumentsCountShift;
+ if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask;
// Cast to flags and validate result before returning it.
Flags result = static_cast<Flags>(bits);
ASSERT(ExtractKindFromFlags(result) == kind);
@@ -2283,9 +2309,10 @@
Code::Flags Code::ComputeMonomorphicFlags(Kind kind,
PropertyType type,
+ InlineCacheHolderFlag holder,
InLoopFlag in_loop,
int argc) {
- return ComputeFlags(kind, in_loop, MONOMORPHIC, type, argc);
+ return ComputeFlags(kind, in_loop, MONOMORPHIC, type, argc, holder);
}
@@ -2318,6 +2345,12 @@
}
+InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) {
+ int bits = (flags & kFlagsCacheInPrototypeMapMask);
+ return bits != 0 ? PROTOTYPE_MAP : OWN_MAP;
+}
+
+
Code::Flags Code::RemoveTypeFromFlags(Flags flags) {
int bits = flags & ~kFlagsTypeMask;
return static_cast<Flags>(bits);