Commit ead696dc authored by bmeurer's avatar bmeurer Committed by Commit bot

[cleanup] The %StringAdd runtime function is always called on Strings.

There's no point in trying to convert to a string, as this runtime
function must always be called with Strings, otherwise there's a bug.

R=yangguo@chromium.org

Review-Url: https://codereview.chromium.org/2748253004
Cr-Commit-Position: refs/heads/master@{#43830}
parent 9fca3ad7
...@@ -191,15 +191,9 @@ RUNTIME_FUNCTION(Runtime_SubString) { ...@@ -191,15 +191,9 @@ RUNTIME_FUNCTION(Runtime_SubString) {
RUNTIME_FUNCTION(Runtime_StringAdd) { RUNTIME_FUNCTION(Runtime_StringAdd) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(2, args.length()); DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, obj1, 0); CONVERT_ARG_HANDLE_CHECKED(String, str1, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, obj2, 1); CONVERT_ARG_HANDLE_CHECKED(String, str2, 1);
isolate->counters()->string_add_runtime()->Increment(); isolate->counters()->string_add_runtime()->Increment();
MaybeHandle<String> maybe_str1(Object::ToString(isolate, obj1));
MaybeHandle<String> maybe_str2(Object::ToString(isolate, obj2));
Handle<String> str1;
Handle<String> str2;
maybe_str1.ToHandle(&str1);
maybe_str2.ToHandle(&str2);
RETURN_RESULT_OR_FAILURE(isolate, RETURN_RESULT_OR_FAILURE(isolate,
isolate->factory()->NewConsString(str1, str2)); isolate->factory()->NewConsString(str1, str2));
} }
......
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