source: webkit/trunk/JavaScriptCore/runtime/PropertySlot.cpp@ 58990

Last change on this file since 58990 was 55401, checked in by [email protected], 15 years ago

2010-03-01 Oliver Hunt <[email protected]>

Reviewed by Maciej Stachowiak.

Refactor named getter function signature to be in line with indexing getter signature
https://bugs.webkit.org/show_bug.cgi?id=35563

This removes the PropertySlot argument from getter functions, and makes them directly
pass the slot base. This makes the semantics for the functions match that of the
indexing getters.

On the down side, this means that we can no longer simply use a proxy function for
JS getters, so we now add another marker value to indicate that a getter is present
and branch accordingly.

Against all rationality sunspider reports this as a perf win, but i suspect it's just noise.

  • API/JSCallbackObject.h:
  • API/JSCallbackObjectFunctions.h: (JSC::::staticValueGetter): (JSC::::staticFunctionGetter): (JSC::::callbackGetter):
  • JavaScriptCore.exp:
  • runtime/JSActivation.cpp: (JSC::JSActivation::argumentsGetter):
  • runtime/JSActivation.h:
  • runtime/JSFunction.cpp: (JSC::JSFunction::argumentsGetter): (JSC::JSFunction::callerGetter): (JSC::JSFunction::lengthGetter):
  • runtime/JSFunction.h:
  • runtime/NumberConstructor.cpp: (JSC::numberConstructorNaNValue): (JSC::numberConstructorNegInfinity): (JSC::numberConstructorPosInfinity): (JSC::numberConstructorMaxValue): (JSC::numberConstructorMinValue):
  • runtime/PropertySlot.cpp: (JSC::PropertySlot::functionGetter):
  • runtime/PropertySlot.h: (JSC::PropertySlot::getValue): (JSC::PropertySlot::setGetterSlot): (JSC::PropertySlot::setCacheableGetterSlot):
  • runtime/RegExpConstructor.cpp: (JSC::regExpConstructorDollar1): (JSC::regExpConstructorDollar2): (JSC::regExpConstructorDollar3): (JSC::regExpConstructorDollar4): (JSC::regExpConstructorDollar5): (JSC::regExpConstructorDollar6): (JSC::regExpConstructorDollar7): (JSC::regExpConstructorDollar8): (JSC::regExpConstructorDollar9): (JSC::regExpConstructorInput): (JSC::regExpConstructorMultiline): (JSC::regExpConstructorLastMatch): (JSC::regExpConstructorLastParen): (JSC::regExpConstructorLeftContext): (JSC::regExpConstructorRightContext):
  • runtime/RegExpObject.cpp: (JSC::regExpObjectGlobal): (JSC::regExpObjectIgnoreCase): (JSC::regExpObjectMultiline): (JSC::regExpObjectSource): (JSC::regExpObjectLastIndex):

2010-03-01 Oliver Hunt <[email protected]>

Reviewed by Maciej Stachowiak.

Refactor named getter function signature to be in line with indexing getter signature
https://bugs.webkit.org/show_bug.cgi?id=35563

Fix method signature and update code as appropriate

  • UserObjectImp.cpp: (UserObjectImp::userObjectGetter):
  • UserObjectImp.h:

2010-03-01 Oliver Hunt <[email protected]>

Reviewed by Maciej Stachowiak.

Refactor named getter function signature to be in line with indexing getter signature
https://bugs.webkit.org/show_bug.cgi?id=35563

Fix up WebCore to use the new named getter function signature, update the
codegenerator to the new calling convention, and fix the custom bindings.

  • bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::nameGetter):
  • bindings/js/JSDOMBinding.cpp: (WebCore::objectToStringFunctionGetter):
  • bindings/js/JSDOMBinding.h:
  • bindings/js/JSDOMWindowCustom.cpp: (WebCore::nonCachingStaticFunctionGetter): (WebCore::childFrameGetter): (WebCore::namedItemGetter):
  • bindings/js/JSDataGridColumnListCustom.cpp: (WebCore::JSDataGridColumnList::nameGetter):
  • bindings/js/JSHTMLAllCollectionCustom.cpp: (WebCore::JSHTMLAllCollection::nameGetter):
  • bindings/js/JSHTMLCollectionCustom.cpp: (WebCore::JSHTMLCollection::nameGetter):
  • bindings/js/JSHTMLDocumentCustom.cpp: (WebCore::JSHTMLDocument::nameGetter):
  • bindings/js/JSHTMLFormElementCustom.cpp: (WebCore::JSHTMLFormElement::nameGetter):
  • bindings/js/JSHTMLFrameSetElementCustom.cpp: (WebCore::JSHTMLFrameSetElement::nameGetter):
  • bindings/js/JSHistoryCustom.cpp: (WebCore::nonCachingStaticBackFunctionGetter): (WebCore::nonCachingStaticForwardFunctionGetter): (WebCore::nonCachingStaticGoFunctionGetter):
  • bindings/js/JSLocationCustom.cpp: (WebCore::nonCachingStaticReplaceFunctionGetter): (WebCore::nonCachingStaticReloadFunctionGetter): (WebCore::nonCachingStaticAssignFunctionGetter):
  • bindings/js/JSMimeTypeArrayCustom.cpp: (WebCore::JSMimeTypeArray::nameGetter):
  • bindings/js/JSNamedNodeMapCustom.cpp: (WebCore::JSNamedNodeMap::nameGetter):
  • bindings/js/JSNodeListCustom.cpp: (WebCore::JSNodeList::nameGetter):
  • bindings/js/JSPluginArrayCustom.cpp: (WebCore::JSPluginArray::nameGetter):
  • bindings/js/JSPluginCustom.cpp: (WebCore::JSPlugin::nameGetter):
  • bindings/js/JSPluginElementFunctions.cpp: (WebCore::runtimeObjectPropertyGetter):
  • bindings/js/JSPluginElementFunctions.h:
  • bindings/js/JSStorageCustom.cpp: (WebCore::JSStorage::nameGetter):
  • bindings/js/JSStyleSheetListCustom.cpp: (WebCore::JSStyleSheetList::nameGetter):
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/runtime_array.cpp: (JSC::RuntimeArray::lengthGetter):
  • bridge/runtime_array.h:
  • bridge/runtime_method.cpp: (JSC::RuntimeMethod::lengthGetter):
  • bridge/runtime_method.h:
  • bridge/runtime_object.cpp: (JSC::Bindings::RuntimeObject::fallbackObjectGetter): (JSC::Bindings::RuntimeObject::fieldGetter): (JSC::Bindings::RuntimeObject::methodGetter):
  • bridge/runtime_object.h:
  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1/*
2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21#include "config.h"
22#include "PropertySlot.h"
23
24#include "JSFunction.h"
25#include "JSGlobalObject.h"
26
27namespace JSC {
28
29JSValue PropertySlot::functionGetter(ExecState* exec) const
30{
31 // Prevent getter functions from observing execution if an exception is pending.
32 if (exec->hadException())
33 return exec->exception();
34
35 CallData callData;
36 CallType callType = m_data.getterFunc->getCallData(callData);
37 if (callType == CallTypeHost)
38 return callData.native.function(exec, m_data.getterFunc, thisValue(), exec->emptyList());
39 ASSERT(callType == CallTypeJS);
40 // FIXME: Can this be done more efficiently using the callData?
41 return asFunction(m_data.getterFunc)->call(exec, thisValue(), exec->emptyList());
42}
43
44} // namespace JSC
Note: See TracBrowser for help on using the repository browser.