From: ager@chromium.org Date: Wed, 17 Jun 2009 11:44:25 +0000 (+0000) Subject: Avoid needless creation of handles in regexp runtime routines and use X-Git-Tag: upstream/4.7.83~23879 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7c970c5292dddd416653725d9258d6389b7e682;p=platform%2Fupstream%2Fv8.git Avoid needless creation of handles in regexp runtime routines and use the stack instead. Review URL: http://codereview.chromium.org/126268 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2202 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/runtime.cc b/src/runtime.cc index 1e29f00b7..e6455483c 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -522,12 +522,9 @@ static Object* Runtime_IsConstructCall(Arguments args) { static Object* Runtime_RegExpCompile(Arguments args) { HandleScope scope; ASSERT(args.length() == 3); - CONVERT_CHECKED(JSRegExp, raw_re, args[0]); - Handle re(raw_re); - CONVERT_CHECKED(String, raw_pattern, args[1]); - Handle pattern(raw_pattern); - CONVERT_CHECKED(String, raw_flags, args[2]); - Handle flags(raw_flags); + CONVERT_ARG_CHECKED(JSRegExp, re, 0); + CONVERT_ARG_CHECKED(String, pattern, 1); + CONVERT_ARG_CHECKED(String, flags, 2); Handle result = RegExpImpl::Compile(re, pattern, flags); if (result.is_null()) return Failure::Exception(); return *result; @@ -537,8 +534,7 @@ static Object* Runtime_RegExpCompile(Arguments args) { static Object* Runtime_CreateApiFunction(Arguments args) { HandleScope scope; ASSERT(args.length() == 1); - CONVERT_CHECKED(FunctionTemplateInfo, raw_data, args[0]); - Handle data(raw_data); + CONVERT_ARG_CHECKED(FunctionTemplateInfo, data, 0); return *Factory::CreateApiFunction(data); } @@ -1066,15 +1062,12 @@ static Object* Runtime_InitializeConstContextSlot(Arguments args) { static Object* Runtime_RegExpExec(Arguments args) { HandleScope scope; ASSERT(args.length() == 4); - CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]); - Handle regexp(raw_regexp); - CONVERT_CHECKED(String, raw_subject, args[1]); - Handle subject(raw_subject); + CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); + CONVERT_ARG_CHECKED(String, subject, 1); // Due to the way the JS files are constructed this must be less than the // length of a string, i.e. it is always a Smi. We check anyway for security. CONVERT_CHECKED(Smi, index, args[2]); - CONVERT_CHECKED(JSArray, raw_last_match_info, args[3]); - Handle last_match_info(raw_last_match_info); + CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); RUNTIME_ASSERT(last_match_info->HasFastElements()); RUNTIME_ASSERT(index->value() >= 0); RUNTIME_ASSERT(index->value() <= subject->length()); @@ -1217,8 +1210,7 @@ static Object* Runtime_SetCode(Arguments args) { HandleScope scope; ASSERT(args.length() == 2); - CONVERT_CHECKED(JSFunction, raw_target, args[0]); - Handle target(raw_target); + CONVERT_ARG_CHECKED(JSFunction, target, 0); Handle code = args.at(1); Handle context(target->context()); @@ -2972,9 +2964,7 @@ static Object* Runtime_IsPropertyEnumerable(Arguments args) { static Object* Runtime_GetPropertyNames(Arguments args) { HandleScope scope; ASSERT(args.length() == 1); - - CONVERT_CHECKED(JSObject, raw_object, args[0]); - Handle object(raw_object); + CONVERT_ARG_CHECKED(JSObject, object, 0); return *GetKeysFor(object); } @@ -6663,8 +6653,8 @@ static Object* Runtime_GetBreakLocations(Arguments args) { HandleScope scope; ASSERT(args.length() == 1); - CONVERT_ARG_CHECKED(JSFunction, raw_fun, 0); - Handle shared(raw_fun->shared()); + CONVERT_ARG_CHECKED(JSFunction, fun, 0); + Handle shared(fun->shared()); // Find the number of break points Handle break_locations = Debug::GetSourceBreakLocations(shared); if (break_locations->IsUndefined()) return Heap::undefined_value(); @@ -6681,8 +6671,8 @@ static Object* Runtime_GetBreakLocations(Arguments args) { static Object* Runtime_SetFunctionBreakPoint(Arguments args) { HandleScope scope; ASSERT(args.length() == 3); - CONVERT_ARG_CHECKED(JSFunction, raw_fun, 0); - Handle shared(raw_fun->shared()); + CONVERT_ARG_CHECKED(JSFunction, fun, 0); + Handle shared(fun->shared()); CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); RUNTIME_ASSERT(source_position >= 0); Handle break_point_object_arg = args.at(2);