Revision: 4302
Author: [email protected]
Date: Mon Mar 29 00:44:58 2010
Log: Version 2.2.0.
Fixed a few minor bugs.
Performance improvements for string operations.
http://code.google.com/p/v8/source/detail?r=4302
Added:
/trunk/src/type-info.cc
Deleted:
/trunk/src/type-info-inl.h
Modified:
/trunk/ChangeLog
/trunk/src/SConscript
/trunk/src/bootstrapper.cc
/trunk/src/builtins.cc
/trunk/src/frame-element.h
/trunk/src/heap.cc
/trunk/src/heap.h
/trunk/src/objects-inl.h
/trunk/src/objects.cc
/trunk/src/objects.h
/trunk/src/regexp.js
/trunk/src/register-allocator.h
/trunk/src/runtime.cc
/trunk/src/runtime.h
/trunk/src/type-info.h
/trunk/src/v8-counters.h
/trunk/src/version.cc
/trunk/test/mjsunit/mirror-regexp.js
/trunk/test/mjsunit/regexp.js
/trunk/tools/gyp/v8.gyp
/trunk/tools/visual_studio/v8_base.vcproj
/trunk/tools/visual_studio/v8_base_arm.vcproj
/trunk/tools/visual_studio/v8_base_x64.vcproj
=======================================
--- /dev/null
+++ /trunk/src/type-info.cc Mon Mar 29 00:44:58 2010
@@ -0,0 +1,51 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (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"
+#include "type-info.h"
+#include "objects-inl.h"
+
+namespace v8 {
+namespace internal {
+
+
+TypeInfo TypeInfo::TypeFromValue(Handle<Object> value) {
+ TypeInfo info;
+ if (value->IsSmi()) {
+ info = TypeInfo::Smi();
+ } else if (value->IsHeapNumber()) {
+ info = TypeInfo::IsInt32Double(HeapNumber::cast(*value)->value())
+ ? TypeInfo::Integer32()
+ : TypeInfo::Double();
+ } else {
+ info = TypeInfo::Unknown();
+ }
+ return info;
+}
+
+
+} } // namespace v8::internal
=======================================
--- /trunk/src/type-info-inl.h Thu Mar 25 07:34:15 2010
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef V8_TYPE_INFO_INL_H_
-#define V8_TYPE_INFO_INL_H_
-
-#include "type-info.h"
-#include "objects-inl.h"
-
-namespace v8 {
-namespace internal {
-
-
-TypeInfo TypeInfo::TypeFromValue(Handle<Object> value) {
- TypeInfo info;
- if (value->IsSmi()) {
- info = TypeInfo::Smi();
- } else if (value->IsHeapNumber()) {
- info = TypeInfo::IsInt32Double(HeapNumber::cast(*value)->value())
- ? TypeInfo::Integer32()
- : TypeInfo::Double();
- } else {
- info = TypeInfo::Unknown();
- }
- return info;
-}
-
-
-} } // namespace v8::internal
-
-#endif // V8_TYPE_INFO_INL_H_
=======================================
--- /trunk/ChangeLog Fri Mar 26 02:27:16 2010
+++ /trunk/ChangeLog Mon Mar 29 00:44:58 2010
@@ -1,3 +1,10 @@
+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.
=======================================
--- /trunk/src/SConscript Fri Mar 26 02:27:16 2010
+++ /trunk/src/SConscript Mon Mar 29 00:44:58 2010
@@ -102,6 +102,7 @@
stub-cache.cc
token.cc
top.cc
+ type-info.cc
unicode.cc
utils.cc
v8-counters.cc
=======================================
--- /trunk/src/bootstrapper.cc Thu Mar 25 07:34:15 2010
+++ /trunk/src/bootstrapper.cc Mon Mar 29 00:44:58 2010
@@ -723,8 +723,68 @@
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<Map> initial_map(regexp_fun->initial_map());
+
+ ASSERT_EQ(0, initial_map->inobject_properties());
+
+ Handle<DescriptorArray> descriptors = Factory::NewDescriptorArray(5);
+ PropertyAttributes final =
+ static_cast<PropertyAttributes>(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<PropertyAttributes>(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);
}
{ // -- J S O N
=======================================
--- /trunk/src/builtins.cc Wed Mar 24 01:21:20 2010
+++ /trunk/src/builtins.cc Mon Mar 29 00:44:58 2010
@@ -495,7 +495,9 @@
}
if (Heap::new_space()->Contains(elms)) {
- array->set_elements(LeftTrimFixedArray(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);
} else {
// Shift the elements.
AssertNoAllocation no_gc;
=======================================
--- /trunk/src/frame-element.h Thu Mar 25 07:34:15 2010
+++ /trunk/src/frame-element.h Mon Mar 29 00:44:58 2010
@@ -28,7 +28,7 @@
#ifndef V8_FRAME_ELEMENT_H_
#define V8_FRAME_ELEMENT_H_
-#include "type-info-inl.h"
+#include "type-info.h"
#include "macro-assembler.h"
#include "zone.h"
=======================================
--- /trunk/src/heap.cc Fri Mar 26 02:27:16 2010
+++ /trunk/src/heap.cc Mon Mar 29 00:44:58 2010
@@ -1961,8 +1961,9 @@
return MakeOrFindTwoCharacterString(c1, c2);
}
- bool is_ascii = first->IsAsciiRepresentation()
- && second->IsAsciiRepresentation();
+ bool first_is_ascii = first->IsAsciiRepresentation();
+ bool second_is_ascii = second->IsAsciiRepresentation();
+ bool is_ascii = first_is_ascii && second_is_ascii;
// Make sure that an out of memory exception is thrown if the length
// of the new cons string is too large.
@@ -1997,6 +1998,25 @@
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.
=======================================
--- /trunk/src/heap.h Fri Mar 26 02:27:16 2010
+++ /trunk/src/heap.h Mon Mar 29 00:44:58 2010
@@ -149,6 +149,11 @@
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") \
=======================================
--- /trunk/src/objects-inl.h Wed Mar 24 01:21:20 2010
+++ /trunk/src/objects-inl.h Mon Mar 29 00:44:58 2010
@@ -253,6 +253,16 @@
}
return (type & kStringEncodingMask) == kTwoByteStringTag;
}
+
+
+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() {
=======================================
--- /trunk/src/objects.cc Wed Mar 24 01:21:20 2010
+++ /trunk/src/objects.cc Mon Mar 29 00:44:58 2010
@@ -4658,15 +4658,40 @@
}
return i == slen && !decoder->has_more();
}
+
+
+template <typename schar>
+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.
- StringInputBuffer buffer(this);
- uint32_t field = ComputeHashField(&buffer, length());
+ 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);
+ }
// Store the hash code in the object.
set_hash_field(field);
=======================================
--- /trunk/src/objects.h Wed Mar 24 01:21:20 2010
+++ /trunk/src/objects.h Mon Mar 29 00:44:58 2010
@@ -3667,6 +3667,13 @@
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;
};
@@ -3919,6 +3926,13 @@
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
=======================================
--- /trunk/src/regexp.js Thu Mar 25 07:34:15 2010
+++ /trunk/src/regexp.js Mon Mar 29 00:44:58 2010
@@ -71,32 +71,10 @@
}
}
- 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);
+ if (!isConstructorCall) {
regExpCache.type = 'none';
}
+ %RegExpInitializeObject(object, pattern, global, ignoreCase, multiline);
// Call internal function to compile the pattern.
%RegExpCompile(object, pattern, flags);
=======================================
--- /trunk/src/register-allocator.h Thu Mar 25 07:34:15 2010
+++ /trunk/src/register-allocator.h Mon Mar 29 00:44:58 2010
@@ -29,7 +29,7 @@
#define V8_REGISTER_ALLOCATOR_H_
#include "macro-assembler.h"
-#include "type-info-inl.h"
+#include "type-info.h"
#if V8_TARGET_ARCH_IA32
#include "ia32/register-allocator-ia32.h"
=======================================
--- /trunk/src/runtime.cc Thu Mar 25 07:34:15 2010
+++ /trunk/src/runtime.cc Mon Mar 29 00:44:58 2010
@@ -1226,6 +1226,62 @@
if (result.is_null()) return Failure::Exception();
return *result;
}
+
+
+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<PropertyAttributes>(READ_ONLY | DONT_ENUM | DONT_DELETE);
+ PropertyAttributes writable =
+ static_cast<PropertyAttributes>(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) {
=======================================
--- /trunk/src/runtime.h Thu Mar 25 07:34:15 2010
+++ /trunk/src/runtime.h Mon Mar 29 00:44:58 2010
@@ -154,6 +154,7 @@
F(RegExpCompile, 3, 1) \
F(RegExpExec, 4, 1) \
F(RegExpExecMultiple, 4, 1) \
+ F(RegExpInitializeObject, 5, 1) \
\
/* Strings */ \
F(StringCharCodeAt, 2, 1) \
=======================================
--- /trunk/src/type-info.h Thu Mar 25 07:34:15 2010
+++ /trunk/src/type-info.h Mon Mar 29 00:44:58 2010
@@ -130,7 +130,7 @@
return false;
}
- static inline TypeInfo TypeFromValue(Handle<Object> value);
+ static TypeInfo TypeFromValue(Handle<Object> value);
inline bool IsUnknown() {
return type_ == kUnknownType;
=======================================
--- /trunk/src/v8-counters.h Wed Mar 24 01:21:20 2010
+++ /trunk/src/v8-counters.h Mon Mar 29 00:44:58 2010
@@ -166,6 +166,7 @@
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) \
=======================================
--- /trunk/src/version.cc Fri Mar 26 02:27:16 2010
+++ /trunk/src/version.cc Mon Mar 29 00:44:58 2010
@@ -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 1
-#define BUILD_NUMBER 10
+#define MINOR_VERSION 2
+#define BUILD_NUMBER 0
#define PATCH_LEVEL 0
#define CANDIDATE_VERSION false
=======================================
--- /trunk/test/mjsunit/mirror-regexp.js Sun May 17 23:12:45 2009
+++ /trunk/test/mjsunit/mirror-regexp.js Mon Mar 29 00:44:58 2010
@@ -70,8 +70,8 @@
assertEquals('regexp', mirror.type());
assertFalse(mirror.isPrimitive());
for (var p in expected_attributes) {
- assertEquals(mirror.property(p).attributes(),
- expected_attributes[p],
+ assertEquals(expected_attributes[p],
+ mirror.property(p).attributes(),
p + ' attributes');
}
=======================================
--- /trunk/test/mjsunit/regexp.js Fri May 29 04:04:38 2009
+++ /trunk/test/mjsunit/regexp.js Mon Mar 29 00:44:58 2010
@@ -388,3 +388,51 @@
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]);
=======================================
--- /trunk/tools/gyp/v8.gyp Fri Mar 26 02:27:16 2010
+++ /trunk/tools/gyp/v8.gyp Mon Mar 29 00:44:58 2010
@@ -388,7 +388,7 @@
'../../src/token.h',
'../../src/top.cc',
'../../src/top.h',
- '../../src/type-info-inl.h',
+ '../../src/type-info.cc',
'../../src/type-info.h',
'../../src/unicode-inl.h',
'../../src/unicode.cc',
=======================================
--- /trunk/tools/visual_studio/v8_base.vcproj Fri Mar 26 02:27:16 2010
+++ /trunk/tools/visual_studio/v8_base.vcproj Mon Mar 29 00:44:58 2010
@@ -945,7 +945,7 @@
>
</File>
<File
- RelativePath="..\..\src\type-info-inl.h"
+ RelativePath="..\..\src\type-info.cc"
>
</File>
<File
=======================================
--- /trunk/tools/visual_studio/v8_base_arm.vcproj Fri Mar 26 02:27:16 2010
+++ /trunk/tools/visual_studio/v8_base_arm.vcproj Mon Mar 29 00:44:58 2010
@@ -937,7 +937,7 @@
>
</File>
<File
- RelativePath="..\..\src\type-info-inl.h"
+ RelativePath="..\..\src\type-info.cc"
>
</File>
<File
=======================================
--- /trunk/tools/visual_studio/v8_base_x64.vcproj Fri Mar 26 02:27:16 2010
+++ /trunk/tools/visual_studio/v8_base_x64.vcproj Mon Mar 29 00:44:58 2010
@@ -922,7 +922,7 @@
>
</File>
<File
- RelativePath="..\..\src\type-info-inl.h"
+ RelativePath="..\..\src\type-info.cc"
>
</File>
<File
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
To unsubscribe from this group, send email to v8-dev+unsubscribegooglegroups.com or reply
to this email with the words "REMOVE ME" as the subject.