Changeset 53241 in webkit


Ignore:
Timestamp:
Jan 13, 2010 11:35:01 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-13 Mads Ager <ager@chromium.org>

Reviewed by Dimitri Glazkov.

[V8] Slow named property lookup on DOMWindow because of missing fast case
https://bugs.webkit.org/show_bug.cgi?id=33584

Add fast case checks to V8 named property getter on DOMWindow
objects. If the property is not in the DOM there is no reason to
search the DOM for all occurrences.

Covered by layout tests.

  • bindings/v8/custom/V8DOMWindowCustom.cpp: (WebCore::V8DOMWindow::namedPropertyGetter):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r53240 r53241  
     12010-01-13  Mads Ager  <ager@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [V8] Slow named property lookup on DOMWindow because of missing fast case
     6        https://bugs.webkit.org/show_bug.cgi?id=33584
     7
     8        Add fast case checks to V8 named property getter on DOMWindow
     9        objects.  If the property is not in the DOM there is no reason to
     10        search the DOM for all occurrences.
     11
     12        Covered by layout tests.
     13
     14        * bindings/v8/custom/V8DOMWindowCustom.cpp:
     15        (WebCore::V8DOMWindow::namedPropertyGetter):
     16
    1172010-01-13  Gavin Barraclough  <barraclough@apple.com>
    218
  • trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r53164 r53241  
    4141#include "FrameView.h"
    4242#include "HTMLCollection.h"
     43#include "HTMLDocument.h"
    4344#include "MediaPlayer.h"
    4445#include "Page.h"
     
    813814    Document* doc = frame->document();
    814815
    815     if (doc) {
    816         RefPtr<HTMLCollection> items = doc->windowNamedItems(propName);
    817         if (items->length() >= 1) {
    818             if (items->length() == 1)
    819                 return V8DOMWrapper::convertNodeToV8Object(items->firstItem());
    820             else
     816    if (doc && doc->isHTMLDocument()) {
     817        if (static_cast<HTMLDocument*>(doc)->hasNamedItem(propName.impl()) || doc->hasElementWithId(propName.impl())) {
     818            RefPtr<HTMLCollection> items = doc->windowNamedItems(propName);
     819            if (items->length() >= 1) {
     820                if (items->length() == 1)
     821                    return V8DOMWrapper::convertNodeToV8Object(items->firstItem());
    821822                return V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, items.release());
     823            }
    822824        }
    823825    }
Note: See TracChangeset for help on using the changeset viewer.