Reviewers: Kasper Lund, Description: Faster handling of string indexing using [] with a SMI index.
Instead of falling back to calling GetObjectProperty we call GetCharAt directly if the object is a string and the key in a SMI. Please review this at http://codereview.chromium.org/522015 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/runtime.cc Index: src/runtime.cc =================================================================== --- src/runtime.cc (revision 3521) +++ src/runtime.cc (working copy) @@ -2724,7 +2724,6 @@ } - // KeyedStringGetProperty is called from KeyedLoadIC::GenerateGeneric. static Object* Runtime_KeyedGetProperty(Arguments args) { NoHandleAllocation ha; @@ -2776,6 +2775,14 @@ // If value is the hole do the general lookup. } } + } else if (args[0]->IsString() && + args[1]->IsSmi()) { + // Fast case for string indexing using [] with a SMI index. + HandleScope scope; + Handle<String> str = args.at<String>(0); + int index = Smi::cast(args[1])->value(); + Handle<Object> result = GetCharAt(str, index); + return *result; } // Fall back to GetObjectProperty. -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
