diff options
author | Steve Block <steveblock@google.com> | 2010-05-10 14:33:55 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-10 15:08:22 +0100 |
commit | 6ded16be15dd865a9b21ea304d5273c8be299c87 (patch) | |
tree | b3661ae5d929e233f7024223f3fad0f2a284cd6e /src/objects-inl.h | |
parent | 6599b9dd3411791c9d89ab7efbfb4131e5664c48 (diff) | |
download | android_external_v8-6ded16be15dd865a9b21ea304d5273c8be299c87.tar.gz android_external_v8-6ded16be15dd865a9b21ea304d5273c8be299c87.tar.bz2 android_external_v8-6ded16be15dd865a9b21ea304d5273c8be299c87.zip |
Update V8 to r4588
We're using WebKit r58033, as used by
http://src.chromium.org/svn/releases/5.0.387.0/DEPS
This requires http://v8.googlecode.com/svn/trunk@4465 but this version has a
crashing bug for ARM. Instead we use http://v8.googlecode.com/svn/trunk@4588,
which is used by http://src.chromium.org/svn/releases/6.0.399.0/DEPS
Note that a trivial bug fix was required in arm/codegen-arm.cc. This is guarded
with ANDROID. See http://code.google.com/p/v8/issues/detail?id=703
Change-Id: I459647a8286c4f8c7405f0c5581ecbf051a6f1e8
Diffstat (limited to 'src/objects-inl.h')
-rw-r--r-- | src/objects-inl.h | 168 |
1 files changed, 142 insertions, 26 deletions
diff --git a/src/objects-inl.h b/src/objects-inl.h index cc971f31..ae7d2c2a 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -255,6 +255,16 @@ bool String::IsTwoByteRepresentation() { } +bool String::IsExternalTwoByteStringWithAsciiChars() { + if (!IsExternalTwoByteString()) return false; + const uc16* data = ExternalTwoByteString::cast(this)->resource()->data(); + for (int i = 0, len = length(); i < len; i++) { + if (data[i] > kMaxAsciiCharCode) return false; + } + return true; +} + + bool StringShape::IsCons() { return (type_ & kStringRepresentationMask) == kConsStringTag; } @@ -559,11 +569,32 @@ bool Object::IsSymbolTable() { } +bool Object::IsJSFunctionResultCache() { + if (!IsFixedArray()) return false; + FixedArray* self = FixedArray::cast(this); + int length = self->length(); + if (length < JSFunctionResultCache::kEntriesIndex) return false; + if ((length - JSFunctionResultCache::kEntriesIndex) + % JSFunctionResultCache::kEntrySize != 0) { + return false; + } +#ifdef DEBUG + reinterpret_cast<JSFunctionResultCache*>(this)->JSFunctionResultCacheVerify(); +#endif + return true; +} + + bool Object::IsCompilationCacheTable() { return IsHashTable(); } +bool Object::IsCodeCacheHashTable() { + return IsHashTable(); +} + + bool Object::IsMapCache() { return IsHashTable(); } @@ -727,7 +758,8 @@ Object* Object::GetProperty(String* key, PropertyAttributes* attributes) { } else { \ ASSERT(mode == SKIP_WRITE_BARRIER); \ ASSERT(Heap::InNewSpace(object) || \ - !Heap::InNewSpace(READ_FIELD(object, offset))); \ + !Heap::InNewSpace(READ_FIELD(object, offset)) || \ + Page::IsRSetSet(object->address(), offset)); \ } #define READ_DOUBLE_FIELD(p, offset) \ @@ -840,15 +872,17 @@ Failure* Failure::OutOfMemoryException() { intptr_t Failure::value() const { - return reinterpret_cast<intptr_t>(this) >> kFailureTagSize; + return static_cast<intptr_t>( + reinterpret_cast<uintptr_t>(this) >> kFailureTagSize); } Failure* Failure::RetryAfterGC(int requested_bytes) { // Assert that the space encoding fits in the three bytes allotted for it. ASSERT((LAST_SPACE & ~kSpaceTagMask) == 0); - intptr_t requested = requested_bytes >> kObjectAlignmentBits; - int tag_bits = kSpaceTagSize + kFailureTypeTagSize; + uintptr_t requested = + static_cast<uintptr_t>(requested_bytes >> kObjectAlignmentBits); + int tag_bits = kSpaceTagSize + kFailureTypeTagSize + kFailureTagSize; if (((requested << tag_bits) >> tag_bits) != requested) { // No room for entire requested size in the bits. Round down to // maximally representable size. @@ -861,7 +895,8 @@ Failure* Failure::RetryAfterGC(int requested_bytes) { Failure* Failure::Construct(Type type, intptr_t value) { - intptr_t info = (static_cast<intptr_t>(value) << kFailureTypeTagSize) | type; + uintptr_t info = + (static_cast<uintptr_t>(value) << kFailureTypeTagSize) | type; ASSERT(((info << kFailureTagSize) >> kFailureTagSize) == info); return reinterpret_cast<Failure*>((info << kFailureTagSize) | kFailureTag); } @@ -1113,6 +1148,17 @@ void HeapNumber::set_value(double value) { } +int HeapNumber::get_exponent() { + return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >> + kExponentShift) - kExponentBias; +} + + +int HeapNumber::get_sign() { + return READ_INT_FIELD(this, kExponentOffset) & kSignMask; +} + + ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) @@ -1394,6 +1440,11 @@ void FixedArray::set_the_hole(int index) { } +Object** FixedArray::data_start() { + return HeapObject::RawField(this, kHeaderSize); +} + + bool DescriptorArray::IsEmpty() { ASSERT(this == Heap::empty_descriptor_array() || this->length() > 2); @@ -1559,7 +1610,9 @@ void NumberDictionary::set_requires_slow_elements() { CAST_ACCESSOR(FixedArray) CAST_ACCESSOR(DescriptorArray) CAST_ACCESSOR(SymbolTable) +CAST_ACCESSOR(JSFunctionResultCache) CAST_ACCESSOR(CompilationCacheTable) +CAST_ACCESSOR(CodeCacheHashTable) CAST_ACCESSOR(MapCache) CAST_ACCESSOR(String) CAST_ACCESSOR(SeqString) @@ -1615,7 +1668,7 @@ HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { INT_ACCESSORS(Array, length, kLengthOffset) -INT_ACCESSORS(String, length, kLengthOffset) +SMI_ACCESSORS(String, length, kLengthOffset) uint32_t String::hash_field() { @@ -1637,13 +1690,11 @@ bool String::Equals(String* other) { } -Object* String::TryFlattenIfNotFlat() { +Object* String::TryFlatten(PretenureFlag pretenure) { // We don't need to flatten strings that are already flat. Since this code // is inlined, it can be helpful in the flat case to not call out to Flatten. - if (!IsFlat()) { - return TryFlatten(); - } - return this; + if (IsFlat()) return this; + return SlowTryFlatten(pretenure); } @@ -1739,14 +1790,12 @@ void SeqTwoByteString::SeqTwoByteStringSet(int index, uint16_t value) { int SeqTwoByteString::SeqTwoByteStringSize(InstanceType instance_type) { - uint32_t length = READ_INT_FIELD(this, kLengthOffset); - return SizeFor(length); + return SizeFor(length()); } int SeqAsciiString::SeqAsciiStringSize(InstanceType instance_type) { - uint32_t length = READ_INT_FIELD(this, kLengthOffset); - return SizeFor(length); + return SizeFor(length()); } @@ -1804,6 +1853,20 @@ void ExternalTwoByteString::set_resource( } +void JSFunctionResultCache::MakeZeroSize() { + set(kFingerIndex, Smi::FromInt(kEntriesIndex)); + set(kCacheSizeIndex, Smi::FromInt(kEntriesIndex)); +} + + +void JSFunctionResultCache::Clear() { + int cache_size = Smi::cast(get(kCacheSizeIndex))->value(); + Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex)); + MemsetPointer(entries_start, Heap::the_hole_value(), cache_size); + MakeZeroSize(); +} + + byte ByteArray::get(int index) { ASSERT(index >= 0 && index < this->length()); return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); @@ -2079,6 +2142,20 @@ bool Map::has_non_instance_prototype() { } +void Map::set_function_with_prototype(bool value) { + if (value) { + set_bit_field2(bit_field2() | (1 << kFunctionWithPrototype)); + } else { + set_bit_field2(bit_field2() & ~(1 << kFunctionWithPrototype)); + } +} + + +bool Map::function_with_prototype() { + return ((1 << kFunctionWithPrototype) & bit_field2()) != 0; +} + + void Map::set_is_access_check_needed(bool access_check_needed) { if (access_check_needed) { set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded)); @@ -2143,14 +2220,14 @@ int Code::arguments_count() { CodeStub::Major Code::major_key() { - ASSERT(kind() == STUB); + ASSERT(kind() == STUB || kind() == BINARY_OP_IC); return static_cast<CodeStub::Major>(READ_BYTE_FIELD(this, kStubMajorKeyOffset)); } void Code::set_major_key(CodeStub::Major major) { - ASSERT(kind() == STUB); + ASSERT(kind() == STUB || kind() == BINARY_OP_IC); ASSERT(0 <= major && major < 256); WRITE_BYTE_FIELD(this, kStubMajorKeyOffset, major); } @@ -2252,7 +2329,7 @@ void Map::set_prototype(Object* value, WriteBarrierMode mode) { ACCESSORS(Map, instance_descriptors, DescriptorArray, kInstanceDescriptorsOffset) -ACCESSORS(Map, code_cache, FixedArray, kCodeCacheOffset) +ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) ACCESSORS(Map, constructor, Object, kConstructorOffset) ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) @@ -2345,12 +2422,11 @@ ACCESSORS(BreakPointInfo, statement_position, Smi, kStatementPositionIndex) ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) #endif -ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) +ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) ACCESSORS(SharedFunctionInfo, instance_class_name, Object, kInstanceClassNameOffset) -ACCESSORS(SharedFunctionInfo, function_data, Object, - kExternalReferenceDataOffset) +ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) @@ -2379,6 +2455,7 @@ INT_ACCESSORS(SharedFunctionInfo, formal_parameter_count, kFormalParameterCountOffset) INT_ACCESSORS(SharedFunctionInfo, expected_nof_properties, kExpectedNofPropertiesOffset) +INT_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset) INT_ACCESSORS(SharedFunctionInfo, start_position_and_type, kStartPositionAndTypeOffset) INT_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) @@ -2390,6 +2467,9 @@ INT_ACCESSORS(SharedFunctionInfo, this_property_assignments_count, kThisPropertyAssignmentsCountOffset) +ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) +ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) + bool Script::HasValidSource() { Object* src = this->source(); if (!src->IsString()) return true; @@ -2438,8 +2518,19 @@ bool SharedFunctionInfo::is_compiled() { } -bool JSFunction::IsBoilerplate() { - return map() == Heap::boilerplate_function_map(); +bool SharedFunctionInfo::IsApiFunction() { + return function_data()->IsFunctionTemplateInfo(); +} + + +FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { + ASSERT(IsApiFunction()); + return FunctionTemplateInfo::cast(function_data()); +} + + +bool SharedFunctionInfo::HasCustomCallGenerator() { + return function_data()->IsProxy(); } @@ -2520,6 +2611,10 @@ Object* JSFunction::prototype() { return instance_prototype(); } +bool JSFunction::should_have_prototype() { + return map()->function_with_prototype(); +} + bool JSFunction::is_compiled() { return shared()->is_compiled(); @@ -2533,15 +2628,29 @@ int JSFunction::NumberOfLiterals() { Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { ASSERT(0 <= id && id < kJSBuiltinsCount); - return READ_FIELD(this, kJSBuiltinsOffset + (id * kPointerSize)); + return READ_FIELD(this, OffsetOfFunctionWithId(id)); } void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id, Object* value) { ASSERT(0 <= id && id < kJSBuiltinsCount); - WRITE_FIELD(this, kJSBuiltinsOffset + (id * kPointerSize), value); - WRITE_BARRIER(this, kJSBuiltinsOffset + (id * kPointerSize)); + WRITE_FIELD(this, OffsetOfFunctionWithId(id), value); + WRITE_BARRIER(this, OffsetOfFunctionWithId(id)); +} + + +Code* JSBuiltinsObject::javascript_builtin_code(Builtins::JavaScript id) { + ASSERT(0 <= id && id < kJSBuiltinsCount); + return Code::cast(READ_FIELD(this, OffsetOfCodeWithId(id))); +} + + +void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, + Code* value) { + ASSERT(0 <= id && id < kJSBuiltinsCount); + WRITE_FIELD(this, OffsetOfCodeWithId(id), value); + ASSERT(!Heap::InNewSpace(value)); } @@ -2768,6 +2877,13 @@ bool JSObject::HasIndexedInterceptor() { } +bool JSObject::AllowsSetElementsLength() { + bool result = elements()->IsFixedArray(); + ASSERT(result == (!HasPixelElements() && !HasExternalArrayElements())); + return result; +} + + StringDictionary* JSObject::property_dictionary() { ASSERT(!HasFastProperties()); return StringDictionary::cast(properties()); |