- Specialized jscre on the type of the string involved.

- Specialized jscre on the type of the string involved.


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@476 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4f7b6654
...@@ -223,7 +223,6 @@ void Heap::ReportStatisticsAfterGC() { ...@@ -223,7 +223,6 @@ void Heap::ReportStatisticsAfterGC() {
void Heap::GarbageCollectionPrologue() { void Heap::GarbageCollectionPrologue() {
RegExpImpl::NewSpaceCollectionPrologue();
gc_count_++; gc_count_++;
#ifdef DEBUG #ifdef DEBUG
ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC);
...@@ -424,7 +423,6 @@ void Heap::MarkCompact(GCTracer* tracer) { ...@@ -424,7 +423,6 @@ void Heap::MarkCompact(GCTracer* tracer) {
void Heap::MarkCompactPrologue() { void Heap::MarkCompactPrologue() {
CompilationCache::MarkCompactPrologue(); CompilationCache::MarkCompactPrologue();
RegExpImpl::OldSpaceCollectionPrologue();
Top::MarkCompactPrologue(); Top::MarkCompactPrologue();
ThreadManager::MarkCompactPrologue(); ThreadManager::MarkCompactPrologue();
} }
......
This diff is collapsed.
...@@ -79,32 +79,24 @@ class RegExpImpl { ...@@ -79,32 +79,24 @@ class RegExpImpl {
Handle<String> subject, Handle<String> subject,
Handle<Object> index); Handle<Object> index);
template <typename T>
static Handle<Object> JsreExecGlobal(Handle<JSRegExp> regexp, static Handle<Object> JsreExecGlobal(Handle<JSRegExp> regexp,
Handle<String> subject); Handle<String> subject,
Vector<const T> contents);
static void NewSpaceCollectionPrologue();
static void OldSpaceCollectionPrologue();
private: private:
// Converts a source string to a 16 bit flat string. The string
// will be either sequential or it will be a SlicedString backed
// by a flat string.
static Handle<String> StringToTwoByte(Handle<String> pattern);
static Handle<String> CachedStringToTwoByte(Handle<String> pattern);
static String* last_ascii_string_;
static String* two_byte_cached_string_;
// Returns the caputure from the re. // Returns the caputure from the re.
static int JsreCapture(Handle<JSRegExp> re); static int JsreCapture(Handle<JSRegExp> re);
static ByteArray* JsreInternal(Handle<JSRegExp> re); static ByteArray* JsreInternal(Handle<JSRegExp> re);
// Call jsRegExpExecute once // Call jsRegExpExecute once
template <typename T>
static Handle<Object> JsreExecOnce(Handle<JSRegExp> regexp, static Handle<Object> JsreExecOnce(Handle<JSRegExp> regexp,
int num_captures, int num_captures,
Handle<String> subject, Handle<String> subject,
int previous_index, int previous_index,
const uc16* utf8_subject, Vector<const T> contents,
int* ovector, int* ovector,
int ovector_length); int ovector_length);
......
This diff is collapsed.
...@@ -1303,26 +1303,9 @@ class JSObject: public HeapObject { ...@@ -1303,26 +1303,9 @@ class JSObject: public HeapObject {
JSFunction* function, JSFunction* function,
PropertyAttributes attributes); PropertyAttributes attributes);
Object* ReplaceSlowProperty(String* name, // Replace a constant function property on a fast-case object.
Object* value, Object* ReplaceConstantFunctionProperty(String* name,
PropertyAttributes attributes); Object* value);
// Converts a descriptor of any other type to a real field,
// backed by the properties array. Descriptors of visible
// types, such as CONSTANT_FUNCTION, keep their enumeration order.
// Converts the descriptor on the original object's map to a
// map transition, and the the new field is on the object's new map.
Object* ConvertDescriptorToFieldAndMapTransition(
String* name,
Object* new_value,
PropertyAttributes attributes);
// Converts a descriptor of any other type to a real field,
// backed by the properties array. Descriptors of visible
// types, such as CONSTANT_FUNCTION, keep their enumeration order.
Object* ConvertDescriptorToField(String* name,
Object* new_value,
PropertyAttributes attributes);
// Add a property to a fast-case object. // Add a property to a fast-case object.
Object* AddFastProperty(String* name, Object* AddFastProperty(String* name,
...@@ -1394,10 +1377,6 @@ class JSObject: public HeapObject { ...@@ -1394,10 +1377,6 @@ class JSObject: public HeapObject {
static const uint32_t kMaxGap = 1024; static const uint32_t kMaxGap = 1024;
static const int kMaxFastElementsLength = 5000; static const int kMaxFastElementsLength = 5000;
static const int kMaxFastProperties = 8; static const int kMaxFastProperties = 8;
// When extending the backing storage for property values, we increase
// its size by more than the 1 entry necessary, so sequentially adding fields
// to the same object requires fewer allocations and copies.
static const int kFieldsAdded = 3;
// Layout description. // Layout description.
static const int kPropertiesOffset = HeapObject::kHeaderSize; static const int kPropertiesOffset = HeapObject::kHeaderSize;
...@@ -1583,6 +1562,7 @@ class DescriptorArray: public FixedArray { ...@@ -1583,6 +1562,7 @@ class DescriptorArray: public FixedArray {
inline void Get(int descriptor_number, Descriptor* desc); inline void Get(int descriptor_number, Descriptor* desc);
inline void Set(int descriptor_number, Descriptor* desc); inline void Set(int descriptor_number, Descriptor* desc);
void ReplaceConstantFunction(int descriptor_number, JSFunction* value);
// Copy the descriptor array, insert a new descriptor and optionally // Copy the descriptor array, insert a new descriptor and optionally
// remove map transitions. If the descriptor is already present, it is // remove map transitions. If the descriptor is already present, it is
...@@ -1592,6 +1572,20 @@ class DescriptorArray: public FixedArray { ...@@ -1592,6 +1572,20 @@ class DescriptorArray: public FixedArray {
// a transition, they must not be removed. All null descriptors are removed. // a transition, they must not be removed. All null descriptors are removed.
Object* CopyInsert(Descriptor* descriptor, TransitionFlag transition_flag); Object* CopyInsert(Descriptor* descriptor, TransitionFlag transition_flag);
// Makes a copy of the descriptor array with the descriptor with key name
// removed. If name is the empty string, the descriptor array is copied.
// Transitions are removed if TransitionFlag is REMOVE_TRANSITIONS.
// All null descriptors are removed.
Object* CopyRemove(TransitionFlag remove_transitions, String* name);
// Copy the descriptor array, replace the property index and attributes
// of the named property, but preserve its enumeration index.
Object* CopyReplace(String* name, int index, PropertyAttributes attributes);
// Copy the descriptor array, removing the property index and attributes
// of the named property.
Object* CopyRemove(String* name);
// Remove all transitions. Return a copy of the array with all transitions // Remove all transitions. Return a copy of the array with all transitions
// removed, or a Failure object if the new array could not be allocated. // removed, or a Failure object if the new array could not be allocated.
Object* RemoveTransitions(); Object* RemoveTransitions();
......
...@@ -66,13 +66,15 @@ const int JSRegExpErrorInternal = -4; ...@@ -66,13 +66,15 @@ const int JSRegExpErrorInternal = -4;
typedef void* malloc_t(size_t size); typedef void* malloc_t(size_t size);
typedef void free_t(void* address); typedef void free_t(void* address);
JSRegExp* jsRegExpCompile(const UChar* pattern, int patternLength, template <typename Char>
JSRegExp* jsRegExpCompile(const Char* pattern, int patternLength,
JSRegExpIgnoreCaseOption, JSRegExpMultilineOption, JSRegExpIgnoreCaseOption, JSRegExpMultilineOption,
unsigned* numSubpatterns, const char** errorMessage, unsigned* numSubpatterns, const char** errorMessage,
malloc_t* allocate_function, free_t* free_function); malloc_t* allocate_function, free_t* free_function);
template <typename Char>
int jsRegExpExecute(const JSRegExp*, int jsRegExpExecute(const JSRegExp*,
const UChar* subject, int subjectLength, int startOffset, const Char* subject, int subjectLength, int startOffset,
int* offsetsVector, int offsetsVectorLength); int* offsetsVector, int offsetsVectorLength);
void jsRegExpFree(JSRegExp*); void jsRegExpFree(JSRegExp*);
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment