diff --git a/deps/v8/ChangeLog b/deps/v8/ChangeLog index a15cce80d0..0de330847b 100644 --- a/deps/v8/ChangeLog +++ b/deps/v8/ChangeLog @@ -1,10 +1,3 @@ -2010-03-29: Version 2.2.0 - - Fixed a few minor bugs. - - Performance improvements for string operations. - - 2010-03-26: Version 2.1.10 Fixed scons build issues. diff --git a/deps/v8/src/SConscript b/deps/v8/src/SConscript index 1f1c1c1833..a1d4796b7f 100755 --- a/deps/v8/src/SConscript +++ b/deps/v8/src/SConscript @@ -102,7 +102,6 @@ SOURCES = { stub-cache.cc token.cc top.cc - type-info.cc unicode.cc utils.cc v8-counters.cc diff --git a/deps/v8/src/bootstrapper.cc b/deps/v8/src/bootstrapper.cc index 82a63f0ae6..8a9fa4bf69 100644 --- a/deps/v8/src/bootstrapper.cc +++ b/deps/v8/src/bootstrapper.cc @@ -723,68 +723,8 @@ void Genesis::InitializeGlobal(Handle inner_global, InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, Top::initial_object_prototype(), Builtins::Illegal, true); - global_context()->set_regexp_function(*regexp_fun); - - ASSERT(regexp_fun->has_initial_map()); - Handle initial_map(regexp_fun->initial_map()); - - ASSERT_EQ(0, initial_map->inobject_properties()); - Handle descriptors = Factory::NewDescriptorArray(5); - PropertyAttributes final = - static_cast(DONT_ENUM | DONT_DELETE | READ_ONLY); - int enum_index = 0; - { - // ECMA-262, section 15.10.7.1. - FieldDescriptor field(Heap::source_symbol(), - JSRegExp::kSourceFieldIndex, - final, - enum_index++); - descriptors->Set(0, &field); - } - { - // ECMA-262, section 15.10.7.2. - FieldDescriptor field(Heap::global_symbol(), - JSRegExp::kGlobalFieldIndex, - final, - enum_index++); - descriptors->Set(1, &field); - } - { - // ECMA-262, section 15.10.7.3. - FieldDescriptor field(Heap::ignore_case_symbol(), - JSRegExp::kIgnoreCaseFieldIndex, - final, - enum_index++); - descriptors->Set(2, &field); - } - { - // ECMA-262, section 15.10.7.4. - FieldDescriptor field(Heap::multiline_symbol(), - JSRegExp::kMultilineFieldIndex, - final, - enum_index++); - descriptors->Set(3, &field); - } - { - // ECMA-262, section 15.10.7.5. - PropertyAttributes writable = - static_cast(DONT_ENUM | DONT_DELETE); - FieldDescriptor field(Heap::last_index_symbol(), - JSRegExp::kLastIndexFieldIndex, - writable, - enum_index++); - descriptors->Set(4, &field); - } - descriptors->SetNextEnumerationIndex(enum_index); - descriptors->Sort(); - - initial_map->set_inobject_properties(5); - initial_map->set_pre_allocated_property_fields(5); - initial_map->set_unused_property_fields(0); - initial_map->set_instance_size( - initial_map->instance_size() + 5 * kPointerSize); - initial_map->set_instance_descriptors(*descriptors); + global_context()->set_regexp_function(*regexp_fun); } { // -- J S O N diff --git a/deps/v8/src/builtins.cc b/deps/v8/src/builtins.cc index feb912f414..122fbba2c4 100644 --- a/deps/v8/src/builtins.cc +++ b/deps/v8/src/builtins.cc @@ -495,9 +495,7 @@ BUILTIN(ArrayShift) { } if (Heap::new_space()->Contains(elms)) { - // As elms still in the same space they used to be (new space), - // there is no need to update remembered set. - array->set_elements(LeftTrimFixedArray(elms), SKIP_WRITE_BARRIER); + array->set_elements(LeftTrimFixedArray(elms)); } else { // Shift the elements. AssertNoAllocation no_gc; diff --git a/deps/v8/src/frame-element.h b/deps/v8/src/frame-element.h index 48bb354aa8..83db5c3342 100644 --- a/deps/v8/src/frame-element.h +++ b/deps/v8/src/frame-element.h @@ -28,7 +28,7 @@ #ifndef V8_FRAME_ELEMENT_H_ #define V8_FRAME_ELEMENT_H_ -#include "type-info.h" +#include "type-info-inl.h" #include "macro-assembler.h" #include "zone.h" diff --git a/deps/v8/src/heap.cc b/deps/v8/src/heap.cc index 5421dcc195..1f1599a79b 100644 --- a/deps/v8/src/heap.cc +++ b/deps/v8/src/heap.cc @@ -1961,9 +1961,8 @@ Object* Heap::AllocateConsString(String* first, String* second) { return MakeOrFindTwoCharacterString(c1, c2); } - bool first_is_ascii = first->IsAsciiRepresentation(); - bool second_is_ascii = second->IsAsciiRepresentation(); - bool is_ascii = first_is_ascii && second_is_ascii; + bool is_ascii = first->IsAsciiRepresentation() + && second->IsAsciiRepresentation(); // Make sure that an out of memory exception is thrown if the length // of the new cons string is too large. @@ -1998,25 +1997,6 @@ Object* Heap::AllocateConsString(String* first, String* second) { for (int i = 0; i < second_length; i++) *dest++ = src[i]; return result; } else { - // For short external two-byte strings we check whether they can - // be represented using ascii. - if (!first_is_ascii) { - first_is_ascii = first->IsExternalTwoByteStringWithAsciiChars(); - } - if (first_is_ascii && !second_is_ascii) { - second_is_ascii = second->IsExternalTwoByteStringWithAsciiChars(); - } - if (first_is_ascii && second_is_ascii) { - Object* result = AllocateRawAsciiString(length); - if (result->IsFailure()) return result; - // Copy the characters into the new object. - char* dest = SeqAsciiString::cast(result)->GetChars(); - String::WriteToFlat(first, dest, 0, first_length); - String::WriteToFlat(second, dest + first_length, 0, second_length); - Counters::string_add_runtime_ext_to_ascii.Increment(); - return result; - } - Object* result = AllocateRawTwoByteString(length); if (result->IsFailure()) return result; // Copy the characters into the new object. diff --git a/deps/v8/src/heap.h b/deps/v8/src/heap.h index 494c99b1f4..2a0de236ee 100644 --- a/deps/v8/src/heap.h +++ b/deps/v8/src/heap.h @@ -149,11 +149,6 @@ class ZoneScopeInfo; V(number_symbol, "number") \ V(Number_symbol, "Number") \ V(RegExp_symbol, "RegExp") \ - V(source_symbol, "source") \ - V(global_symbol, "global") \ - V(ignore_case_symbol, "ignoreCase") \ - V(multiline_symbol, "multiline") \ - V(last_index_symbol, "lastIndex") \ V(object_symbol, "object") \ V(prototype_symbol, "prototype") \ V(string_symbol, "string") \ diff --git a/deps/v8/src/objects-inl.h b/deps/v8/src/objects-inl.h index 6d7bad7512..a26da7dd62 100644 --- a/deps/v8/src/objects-inl.h +++ b/deps/v8/src/objects-inl.h @@ -255,16 +255,6 @@ 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; } diff --git a/deps/v8/src/objects.cc b/deps/v8/src/objects.cc index 02ea5b0455..a1fbc99277 100644 --- a/deps/v8/src/objects.cc +++ b/deps/v8/src/objects.cc @@ -4660,38 +4660,13 @@ bool String::IsEqualTo(Vector str) { } -template -static inline uint32_t HashSequentialString(const schar* chars, int length) { - StringHasher hasher(length); - if (!hasher.has_trivial_hash()) { - int i; - for (i = 0; hasher.is_array_index() && (i < length); i++) { - hasher.AddCharacter(chars[i]); - } - for (; i < length; i++) { - hasher.AddCharacterNoIndex(chars[i]); - } - } - return hasher.GetHashField(); -} - - uint32_t String::ComputeAndSetHash() { // Should only be called if hash code has not yet been computed. ASSERT(!(hash_field() & kHashComputedMask)); - const int len = length(); - // Compute the hash code. - uint32_t field = 0; - if (StringShape(this).IsSequentialAscii()) { - field = HashSequentialString(SeqAsciiString::cast(this)->GetChars(), len); - } else if (StringShape(this).IsSequentialTwoByte()) { - field = HashSequentialString(SeqTwoByteString::cast(this)->GetChars(), len); - } else { - StringInputBuffer buffer(this); - field = ComputeHashField(&buffer, len); - } + StringInputBuffer buffer(this); + uint32_t field = ComputeHashField(&buffer, length()); // Store the hash code in the object. set_hash_field(field); diff --git a/deps/v8/src/objects.h b/deps/v8/src/objects.h index 9197466e85..01977f0929 100644 --- a/deps/v8/src/objects.h +++ b/deps/v8/src/objects.h @@ -3667,13 +3667,6 @@ class JSRegExp: public JSObject { FixedArray::kHeaderSize + kIrregexpUC16CodeIndex * kPointerSize; static const int kIrregexpCaptureCountOffset = FixedArray::kHeaderSize + kIrregexpCaptureCountIndex * kPointerSize; - - // In-object fields. - static const int kSourceFieldIndex = 0; - static const int kGlobalFieldIndex = 1; - static const int kIgnoreCaseFieldIndex = 2; - static const int kMultilineFieldIndex = 3; - static const int kLastIndexFieldIndex = 4; }; @@ -3926,13 +3919,6 @@ class String: public HeapObject { inline bool IsAsciiRepresentation(); inline bool IsTwoByteRepresentation(); - // Check whether this string is an external two-byte string that in - // fact contains only ascii characters. - // - // Such strings may appear when the embedder prefers two-byte - // representations even for ascii data. - inline bool IsExternalTwoByteStringWithAsciiChars(); - // Get and set individual two byte chars in the string. inline void Set(int index, uint16_t value); // Get individual two byte char in the string. Repeated calls diff --git a/deps/v8/src/regexp.js b/deps/v8/src/regexp.js index cc9723c816..dc1b0429f7 100644 --- a/deps/v8/src/regexp.js +++ b/deps/v8/src/regexp.js @@ -71,10 +71,32 @@ function DoConstructRegExp(object, pattern, flags, isConstructorCall) { } } - if (!isConstructorCall) { + if (isConstructorCall) { + // ECMA-262, section 15.10.7.1. + %SetProperty(object, 'source', pattern, + DONT_DELETE | READ_ONLY | DONT_ENUM); + + // ECMA-262, section 15.10.7.2. + %SetProperty(object, 'global', global, DONT_DELETE | READ_ONLY | DONT_ENUM); + + // ECMA-262, section 15.10.7.3. + %SetProperty(object, 'ignoreCase', ignoreCase, + DONT_DELETE | READ_ONLY | DONT_ENUM); + + // ECMA-262, section 15.10.7.4. + %SetProperty(object, 'multiline', multiline, + DONT_DELETE | READ_ONLY | DONT_ENUM); + + // ECMA-262, section 15.10.7.5. + %SetProperty(object, 'lastIndex', 0, DONT_DELETE | DONT_ENUM); + } else { // RegExp is being recompiled via RegExp.prototype.compile. + %IgnoreAttributesAndSetProperty(object, 'source', pattern); + %IgnoreAttributesAndSetProperty(object, 'global', global); + %IgnoreAttributesAndSetProperty(object, 'ignoreCase', ignoreCase); + %IgnoreAttributesAndSetProperty(object, 'multiline', multiline); + %IgnoreAttributesAndSetProperty(object, 'lastIndex', 0); regExpCache.type = 'none'; } - %RegExpInitializeObject(object, pattern, global, ignoreCase, multiline); // Call internal function to compile the pattern. %RegExpCompile(object, pattern, flags); diff --git a/deps/v8/src/register-allocator.h b/deps/v8/src/register-allocator.h index 4564533911..0fbc83b821 100644 --- a/deps/v8/src/register-allocator.h +++ b/deps/v8/src/register-allocator.h @@ -29,7 +29,7 @@ #define V8_REGISTER_ALLOCATOR_H_ #include "macro-assembler.h" -#include "type-info.h" +#include "type-info-inl.h" #if V8_TARGET_ARCH_IA32 #include "ia32/register-allocator-ia32.h" diff --git a/deps/v8/src/runtime.cc b/deps/v8/src/runtime.cc index 7d104fa3b4..c77d518371 100644 --- a/deps/v8/src/runtime.cc +++ b/deps/v8/src/runtime.cc @@ -1228,62 +1228,6 @@ static Object* Runtime_RegExpExec(Arguments args) { } -static Object* Runtime_RegExpInitializeObject(Arguments args) { - AssertNoAllocation no_alloc; - ASSERT(args.length() == 5); - CONVERT_CHECKED(JSRegExp, regexp, args[0]); - CONVERT_CHECKED(String, source, args[1]); - - Object* global = args[2]; - if (!global->IsTrue()) global = Heap::false_value(); - - Object* ignoreCase = args[3]; - if (!ignoreCase->IsTrue()) ignoreCase = Heap::false_value(); - - Object* multiline = args[4]; - if (!multiline->IsTrue()) multiline = Heap::false_value(); - - Map* map = regexp->map(); - Object* constructor = map->constructor(); - if (constructor->IsJSFunction() && - JSFunction::cast(constructor)->initial_map() == map) { - // If we still have the original map, set in-object properties directly. - regexp->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex, source); - // TODO(lrn): Consider skipping write barrier on booleans as well. - // Both true and false should be in oldspace at all times. - regexp->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex, global); - regexp->InObjectPropertyAtPut(JSRegExp::kIgnoreCaseFieldIndex, ignoreCase); - regexp->InObjectPropertyAtPut(JSRegExp::kMultilineFieldIndex, multiline); - regexp->InObjectPropertyAtPut(JSRegExp::kLastIndexFieldIndex, - Smi::FromInt(0), - SKIP_WRITE_BARRIER); - return regexp; - } - - // Map has changed, so use generic, but slower, method. - PropertyAttributes final = - static_cast(READ_ONLY | DONT_ENUM | DONT_DELETE); - PropertyAttributes writable = - static_cast(DONT_ENUM | DONT_DELETE); - regexp->IgnoreAttributesAndSetLocalProperty(Heap::source_symbol(), - source, - final); - regexp->IgnoreAttributesAndSetLocalProperty(Heap::global_symbol(), - global, - final); - regexp->IgnoreAttributesAndSetLocalProperty(Heap::ignore_case_symbol(), - ignoreCase, - final); - regexp->IgnoreAttributesAndSetLocalProperty(Heap::multiline_symbol(), - multiline, - final); - regexp->IgnoreAttributesAndSetLocalProperty(Heap::last_index_symbol(), - Smi::FromInt(0), - writable); - return regexp; -} - - static Object* Runtime_FinishArrayPrototypeSetup(Arguments args) { HandleScope scope; ASSERT(args.length() == 1); diff --git a/deps/v8/src/runtime.h b/deps/v8/src/runtime.h index a55a27135b..42af3df88a 100644 --- a/deps/v8/src/runtime.h +++ b/deps/v8/src/runtime.h @@ -154,7 +154,6 @@ namespace internal { F(RegExpCompile, 3, 1) \ F(RegExpExec, 4, 1) \ F(RegExpExecMultiple, 4, 1) \ - F(RegExpInitializeObject, 5, 1) \ \ /* Strings */ \ F(StringCharCodeAt, 2, 1) \ diff --git a/deps/v8/src/type-info.cc b/deps/v8/src/type-info-inl.h similarity index 95% rename from deps/v8/src/type-info.cc rename to deps/v8/src/type-info-inl.h index b1bde599f4..90d3f55f9b 100644 --- a/deps/v8/src/type-info.cc +++ b/deps/v8/src/type-info-inl.h @@ -25,7 +25,9 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "v8.h" +#ifndef V8_TYPE_INFO_INL_H_ +#define V8_TYPE_INFO_INL_H_ + #include "type-info.h" #include "objects-inl.h" @@ -49,3 +51,5 @@ TypeInfo TypeInfo::TypeFromValue(Handle value) { } } // namespace v8::internal + +#endif // V8_TYPE_INFO_INL_H_ diff --git a/deps/v8/src/type-info.h b/deps/v8/src/type-info.h index 1d82634092..15bc128023 100644 --- a/deps/v8/src/type-info.h +++ b/deps/v8/src/type-info.h @@ -130,7 +130,7 @@ class TypeInfo { return false; } - static TypeInfo TypeFromValue(Handle value); + static inline TypeInfo TypeFromValue(Handle value); inline bool IsUnknown() { return type_ == kUnknownType; diff --git a/deps/v8/src/v8-counters.h b/deps/v8/src/v8-counters.h index bd671a13fe..a5f3594ca7 100644 --- a/deps/v8/src/v8-counters.h +++ b/deps/v8/src/v8-counters.h @@ -166,7 +166,6 @@ namespace internal { SC(generic_binary_stub_calls_regs, V8.GenericBinaryStubCallsRegs) \ SC(string_add_runtime, V8.StringAddRuntime) \ SC(string_add_native, V8.StringAddNative) \ - SC(string_add_runtime_ext_to_ascii, V8.StringAddRuntimeExtToAscii) \ SC(sub_string_runtime, V8.SubStringRuntime) \ SC(sub_string_native, V8.SubStringNative) \ SC(string_compare_native, V8.StringCompareNative) \ diff --git a/deps/v8/src/version.cc b/deps/v8/src/version.cc index 66e79013d6..e3d0887552 100644 --- a/deps/v8/src/version.cc +++ b/deps/v8/src/version.cc @@ -33,8 +33,8 @@ // NOTE these macros are used by the SCons build script so their names // cannot be changed without changing the SCons build script. #define MAJOR_VERSION 2 -#define MINOR_VERSION 2 -#define BUILD_NUMBER 0 +#define MINOR_VERSION 1 +#define BUILD_NUMBER 10 #define PATCH_LEVEL 0 #define CANDIDATE_VERSION false diff --git a/deps/v8/test/mjsunit/mirror-regexp.js b/deps/v8/test/mjsunit/mirror-regexp.js index d6a9d71024..8c834bf38b 100644 --- a/deps/v8/test/mjsunit/mirror-regexp.js +++ b/deps/v8/test/mjsunit/mirror-regexp.js @@ -70,8 +70,8 @@ function testRegExpMirror(r) { assertEquals('regexp', mirror.type()); assertFalse(mirror.isPrimitive()); for (var p in expected_attributes) { - assertEquals(expected_attributes[p], - mirror.property(p).attributes(), + assertEquals(mirror.property(p).attributes(), + expected_attributes[p], p + ' attributes'); } diff --git a/deps/v8/test/mjsunit/regexp.js b/deps/v8/test/mjsunit/regexp.js index c8dcc6fe89..0a23d00acc 100644 --- a/deps/v8/test/mjsunit/regexp.js +++ b/deps/v8/test/mjsunit/regexp.js @@ -388,51 +388,3 @@ try { assertTrue(String(e).indexOf("Stack overflow") >= 0, "overflow"); } - -// Test that compile works on modified objects -var re = /re+/; -assertEquals("re+", re.source); -assertFalse(re.global); -assertFalse(re.ignoreCase); -assertFalse(re.multiline); -assertEquals(0, re.lastIndex); - -re.compile("ro+", "gim"); -assertEquals("ro+", re.source); -assertTrue(re.global); -assertTrue(re.ignoreCase); -assertTrue(re.multiline); -assertEquals(0, re.lastIndex); - -re.lastIndex = 42; -re.someOtherProperty = 42; -re.someDeletableProperty = 42; -re[37] = 37; -re[42] = 42; - -re.compile("ra+", "i"); -assertEquals("ra+", re.source); -assertFalse(re.global); -assertTrue(re.ignoreCase); -assertFalse(re.multiline); -assertEquals(0, re.lastIndex); - -assertEquals(42, re.someOtherProperty); -assertEquals(42, re.someDeletableProperty); -assertEquals(37, re[37]); -assertEquals(42, re[42]); - -re.lastIndex = -1; -re.someOtherProperty = 37; -re[42] = 37; -assertTrue(delete re[37]); -assertTrue(delete re.someDeletableProperty); -re.compile("ri+", "gm"); - -assertEquals("ri+", re.source); -assertTrue(re.global); -assertFalse(re.ignoreCase); -assertTrue(re.multiline); -assertEquals(0, re.lastIndex); -assertEquals(37, re.someOtherProperty); -assertEquals(37, re[42]); diff --git a/deps/v8/tools/gyp/v8.gyp b/deps/v8/tools/gyp/v8.gyp index 7d0e699528..d5bb0cb764 100644 --- a/deps/v8/tools/gyp/v8.gyp +++ b/deps/v8/tools/gyp/v8.gyp @@ -388,7 +388,7 @@ '../../src/token.h', '../../src/top.cc', '../../src/top.h', - '../../src/type-info.cc', + '../../src/type-info-inl.h', '../../src/type-info.h', '../../src/unicode-inl.h', '../../src/unicode.cc', diff --git a/deps/v8/tools/visual_studio/v8_base.vcproj b/deps/v8/tools/visual_studio/v8_base.vcproj index 5fa08f7038..58bf92f8ff 100644 --- a/deps/v8/tools/visual_studio/v8_base.vcproj +++ b/deps/v8/tools/visual_studio/v8_base.vcproj @@ -945,7 +945,7 @@ >