Changeset 147353 in webkit


Ignore:
Timestamp:
Apr 1, 2013 1:01:41 PM (11 years ago)
Author:
benjamin@webkit.org
Message:

Remove a couple of malloc from ExceptionBase construction
https://bugs.webkit.org/show_bug.cgi?id=113681

Reviewed by Darin Adler.

  • dom/ExceptionBase.cpp:

(WebCore::ExceptionBase::ExceptionBase):
When the condition is true, we were creating a new String for
description.name. The constructor had already allocated a string for
that: m_name. Use that string instead of creating a new one.

When the condition is false, we were creating a String for typeName
just to use the string operators. This is a waste of time, we can use
makeString() to invoke the string concatenation functions directly.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r147350 r147353  
     12013-04-01  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        Remove a couple of malloc from ExceptionBase construction
     4        https://bugs.webkit.org/show_bug.cgi?id=113681
     5
     6        Reviewed by Darin Adler.
     7
     8        * dom/ExceptionBase.cpp:
     9        (WebCore::ExceptionBase::ExceptionBase):
     10        When the condition is true, we were creating a new String for
     11        description.name. The constructor had already allocated a string for
     12        that: m_name. Use that string instead of creating a new one.
     13
     14        When the condition is false, we were creating a String for typeName
     15        just to use the string operators. This is a waste of time, we can use
     16        makeString() to invoke the string concatenation functions directly.
     17
    1182013-04-01  Emil A Eklund  <eae@chromium.org>
    219
  • trunk/Source/WebCore/dom/ExceptionBase.cpp

    r86542 r147353  
    4141{
    4242    if (description.name)
    43         m_message = String(description.name) + ": " + description.typeName + " Exception " + String::number(description.code);
     43        m_message = m_name + ": " + description.typeName + " Exception " + String::number(description.code);
    4444    else
    45         m_message = String(description.typeName) + " Exception " + String::number(description.code);
     45        m_message = makeString(description.typeName, " Exception ", String::number(description.code));
    4646}
    4747
Note: See TracChangeset for help on using the changeset viewer.