diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-08-17 08:37:25 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-08-17 08:37:25 -0700 |
commit | 91757fa8400654b69de18e3840c402e369521b68 (patch) | |
tree | 0ee925b614e1efda3821a313f9b77b7152752704 /deps/v8/src/objects-inl.h | |
parent | d4f4380f7ea04ee045fae1661242a5a7f2f1267a (diff) | |
download | node-new-91757fa8400654b69de18e3840c402e369521b68.tar.gz |
Upgrade V8 to 2.3.8
Diffstat (limited to 'deps/v8/src/objects-inl.h')
-rw-r--r-- | deps/v8/src/objects-inl.h | 112 |
1 files changed, 86 insertions, 26 deletions
diff --git a/deps/v8/src/objects-inl.h b/deps/v8/src/objects-inl.h index 101096d6c9..5e8022e51f 100644 --- a/deps/v8/src/objects-inl.h +++ b/deps/v8/src/objects-inl.h @@ -1493,6 +1493,16 @@ int DescriptorArray::Search(String* name) { } +int DescriptorArray::SearchWithCache(String* name) { + int number = DescriptorLookupCache::Lookup(this, name); + if (number == DescriptorLookupCache::kAbsent) { + number = Search(name); + DescriptorLookupCache::Update(this, name, number); + } + return number; +} + + String* DescriptorArray::GetKey(int descriptor_number) { ASSERT(descriptor_number < number_of_descriptors()); return String::cast(get(ToKeyIndex(descriptor_number))); @@ -2060,21 +2070,8 @@ void ExternalFloatArray::set(int index, float value) { ptr[index] = value; } -inline Scavenger Map::scavenger() { - Scavenger callback = reinterpret_cast<Scavenger>( - READ_INTPTR_FIELD(this, kScavengerCallbackOffset)); - - ASSERT(callback == Heap::GetScavenger(instance_type(), - instance_size())); - - return callback; -} -inline void Map::set_scavenger(Scavenger callback) { - WRITE_INTPTR_FIELD(this, - kScavengerCallbackOffset, - reinterpret_cast<intptr_t>(callback)); -} +INT_ACCESSORS(Map, visitor_id, kScavengerCallbackOffset) int Map::instance_size() { return READ_BYTE_FIELD(this, kInstanceSizeOffset) << kPointerSizeLog2; @@ -2099,7 +2096,7 @@ int HeapObject::SizeFromMap(Map* map) { (kStringTag | kConsStringTag) || instance_type == JS_ARRAY_TYPE) return map->instance_size(); if (instance_type == FIXED_ARRAY_TYPE) { - return reinterpret_cast<FixedArray*>(this)->FixedArraySize(); + return FixedArray::BodyDescriptor::SizeOf(map, this); } if (instance_type == BYTE_ARRAY_TYPE) { return reinterpret_cast<ByteArray*>(this)->ByteArraySize(); @@ -2661,8 +2658,7 @@ void SharedFunctionInfo::set_scope_info(SerializedScopeInfo* value, bool SharedFunctionInfo::is_compiled() { - // TODO(1242782): Create a code kind for uncompiled code. - return code()->kind() != Code::STUB; + return code() != Builtins::builtin(Builtins::LazyCompile); } @@ -2694,12 +2690,14 @@ bool JSFunction::IsBuiltin() { Code* JSFunction::code() { - return shared()->code(); + return Code::cast(READ_FIELD(this, kCodeOffset)); } void JSFunction::set_code(Code* value) { - shared()->set_code(value); + // Skip the write barrier because code is never in new space. + ASSERT(!Heap::InNewSpace(value)); + WRITE_FIELD(this, kCodeOffset, value); } @@ -2771,7 +2769,7 @@ bool JSFunction::should_have_prototype() { bool JSFunction::is_compiled() { - return shared()->is_compiled(); + return code() != Builtins::builtin(Builtins::LazyCompile); } @@ -2818,12 +2816,6 @@ void Proxy::set_proxy(Address value) { } -void Proxy::ProxyIterateBody(ObjectVisitor* visitor) { - visitor->VisitExternalReference( - reinterpret_cast<Address *>(FIELD_ADDR(this, kProxyOffset))); -} - - ACCESSORS(JSValue, value, Object, kValueOffset) @@ -3307,6 +3299,74 @@ Object* FixedArray::Copy() { } +int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) { + return map->instance_size(); +} + + +void Proxy::ProxyIterateBody(ObjectVisitor* v) { + v->VisitExternalReference( + reinterpret_cast<Address *>(FIELD_ADDR(this, kProxyOffset))); +} + + +template<typename StaticVisitor> +void Proxy::ProxyIterateBody() { + StaticVisitor::VisitExternalReference( + reinterpret_cast<Address *>(FIELD_ADDR(this, kProxyOffset))); +} + + +void ExternalAsciiString::ExternalAsciiStringIterateBody(ObjectVisitor* v) { + typedef v8::String::ExternalAsciiStringResource Resource; + v->VisitExternalAsciiString( + reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); +} + + +template<typename StaticVisitor> +void ExternalAsciiString::ExternalAsciiStringIterateBody() { + typedef v8::String::ExternalAsciiStringResource Resource; + StaticVisitor::VisitExternalAsciiString( + reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); +} + + +void ExternalTwoByteString::ExternalTwoByteStringIterateBody(ObjectVisitor* v) { + typedef v8::String::ExternalStringResource Resource; + v->VisitExternalTwoByteString( + reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); +} + + +template<typename StaticVisitor> +void ExternalTwoByteString::ExternalTwoByteStringIterateBody() { + typedef v8::String::ExternalStringResource Resource; + StaticVisitor::VisitExternalTwoByteString( + reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); +} + +#define SLOT_ADDR(obj, offset) \ + reinterpret_cast<Object**>((obj)->address() + offset) + +template<int start_offset, int end_offset, int size> +void FixedBodyDescriptor<start_offset, end_offset, size>::IterateBody( + HeapObject* obj, + ObjectVisitor* v) { + v->VisitPointers(SLOT_ADDR(obj, start_offset), SLOT_ADDR(obj, end_offset)); +} + + +template<int start_offset> +void FlexibleBodyDescriptor<start_offset>::IterateBody(HeapObject* obj, + int object_size, + ObjectVisitor* v) { + v->VisitPointers(SLOT_ADDR(obj, start_offset), SLOT_ADDR(obj, object_size)); +} + +#undef SLOT_ADDR + + #undef CAST_ACCESSOR #undef INT_ACCESSORS #undef SMI_ACCESSORS |