Changeset 86727 in webkit


Ignore:
Timestamp:
May 17, 2011 7:39:00 PM (13 years ago)
Author:
ggaren@apple.com
Message:

Source/JavaScriptCore: Rolling back in r86653 with build fixed.

Reviewed by Gavin Barraclough and Oliver Hunt.

Global object initialization is expensive
https://bugs.webkit.org/show_bug.cgi?id=60933

Changed a bunch of globals to allocate their properties lazily, and changed
the global object to allocate a bunch of its globals lazily.

This reduces the footprint of a global object from 287 objects with 58
functions for 24K to 173 objects with 20 functions for 15K.

Large patch, but it's all mechanical.

  • create_hash_table: Added a special case for fromCharCode, since it uses

a custom "thunk generator".

  • heap/Heap.cpp:

(JSC::TypeCounter::operator()): Fixed a bug where the type counter would
overcount objects that were owned through more than one mechanism because
it was getting in the way of counting the results for this patch.

  • interpreter/CallFrame.h:

(JSC::ExecState::arrayConstructorTable):
(JSC::ExecState::arrayPrototypeTable):
(JSC::ExecState::booleanPrototypeTable):
(JSC::ExecState::dateConstructorTable):
(JSC::ExecState::errorPrototypeTable):
(JSC::ExecState::globalObjectTable):
(JSC::ExecState::numberConstructorTable):
(JSC::ExecState::numberPrototypeTable):
(JSC::ExecState::objectPrototypeTable):
(JSC::ExecState::regExpPrototypeTable):
(JSC::ExecState::stringConstructorTable): Added new tables.

  • runtime/ArrayConstructor.cpp:

(JSC::ArrayConstructor::ArrayConstructor):
(JSC::ArrayConstructor::getOwnPropertySlot):
(JSC::ArrayConstructor::getOwnPropertyDescriptor):

  • runtime/ArrayConstructor.h:

(JSC::ArrayConstructor::createStructure):

  • runtime/ArrayPrototype.cpp:

(JSC::ArrayPrototype::getOwnPropertySlot):
(JSC::ArrayPrototype::getOwnPropertyDescriptor):

  • runtime/ArrayPrototype.h:
  • runtime/BooleanPrototype.cpp:

(JSC::BooleanPrototype::BooleanPrototype):
(JSC::BooleanPrototype::getOwnPropertySlot):
(JSC::BooleanPrototype::getOwnPropertyDescriptor):

  • runtime/BooleanPrototype.h:

(JSC::BooleanPrototype::createStructure):

  • runtime/DateConstructor.cpp:

(JSC::DateConstructor::DateConstructor):
(JSC::DateConstructor::getOwnPropertySlot):
(JSC::DateConstructor::getOwnPropertyDescriptor):

  • runtime/DateConstructor.h:

(JSC::DateConstructor::createStructure):

  • runtime/ErrorPrototype.cpp:

(JSC::ErrorPrototype::ErrorPrototype):
(JSC::ErrorPrototype::getOwnPropertySlot):
(JSC::ErrorPrototype::getOwnPropertyDescriptor):

  • runtime/ErrorPrototype.h:

(JSC::ErrorPrototype::createStructure): Standardized these objects
to use static tables for function properties.

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::~JSGlobalData):

  • runtime/JSGlobalData.h: Added new tables.
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::addStaticGlobals):
(JSC::JSGlobalObject::getOwnPropertySlot):
(JSC::JSGlobalObject::getOwnPropertyDescriptor):

  • runtime/JSGlobalObject.h:
  • runtime/JSGlobalObjectFunctions.cpp:
  • runtime/JSGlobalObjectFunctions.h: Changed JSGlobalObject to use a

static table for its global functions. This required uninlining some
things to avoid a circular header dependency. However, those things
probably shouldn't have been inlined in the first place.

Even more global object properties can be made lazy, but that requires
more in-depth changes.

  • runtime/MathObject.cpp:
  • runtime/NumberConstructor.cpp:

(JSC::NumberConstructor::getOwnPropertySlot):
(JSC::NumberConstructor::getOwnPropertyDescriptor):

  • runtime/NumberPrototype.cpp:

(JSC::NumberPrototype::NumberPrototype):
(JSC::NumberPrototype::getOwnPropertySlot):
(JSC::NumberPrototype::getOwnPropertyDescriptor):

  • runtime/NumberPrototype.h:

(JSC::NumberPrototype::createStructure):

  • runtime/ObjectPrototype.cpp:

(JSC::ObjectPrototype::ObjectPrototype):
(JSC::ObjectPrototype::put):
(JSC::ObjectPrototype::getOwnPropertySlot):
(JSC::ObjectPrototype::getOwnPropertyDescriptor):

  • runtime/ObjectPrototype.h:

(JSC::ObjectPrototype::createStructure):

  • runtime/RegExpPrototype.cpp:

(JSC::RegExpPrototype::RegExpPrototype):
(JSC::RegExpPrototype::getOwnPropertySlot):
(JSC::RegExpPrototype::getOwnPropertyDescriptor):

  • runtime/RegExpPrototype.h:

(JSC::RegExpPrototype::createStructure):

  • runtime/StringConstructor.cpp:

(JSC::StringConstructor::StringConstructor):
(JSC::StringConstructor::getOwnPropertySlot):
(JSC::StringConstructor::getOwnPropertyDescriptor):

  • runtime/StringConstructor.h:

(JSC::StringConstructor::createStructure): Standardized these objects
to use static tables for function properties.

LayoutTests: Global object initialization is expensive
https://bugs.webkit.org/show_bug.cgi?id=60933

Reviewed by Gavin Barraclough.

Added a few more expected failures, now that more code uses static hash
tables.

The fact that built-ins are not deletable, but should be, is covered by
https://bugs.webkit.org/show_bug.cgi?id=61014

  • sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.2/S15.6.2.1_A4-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.3/15.6.3.1_Boolean.prototype/S15.6.3.1_A1-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.4/S15.6.4_A1-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.2/S15.7.2.1_A4-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.3/15.7.3.1_Number.prototype/S15.7.3.1_A2_T1-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.4/S15.7.4_A1-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.4/15.9.4.2_Date.parse/S15.9.4.2_A1_T2-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.4/15.9.4.3_Date.UTC/S15.9.4.3_A1_T2-expected.txt:
Location:
trunk
Files:
47 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86725 r86727  
     12011-05-17  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Global object initialization is expensive
     6        https://bugs.webkit.org/show_bug.cgi?id=60933
     7       
     8        Added a few more expected failures, now that more code uses static hash
     9        tables.
     10       
     11        The fact that built-ins are not deletable, but should be, is covered by
     12        https://bugs.webkit.org/show_bug.cgi?id=61014
     13
     14        * sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.2/S15.6.2.1_A4-expected.txt:
     15        * sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.3/15.6.3.1_Boolean.prototype/S15.6.3.1_A1-expected.txt:
     16        * sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.4/S15.6.4_A1-expected.txt:
     17        * sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.2/S15.7.2.1_A4-expected.txt:
     18        * sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.3/15.7.3.1_Number.prototype/S15.7.3.1_A2_T1-expected.txt:
     19        * sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.4/S15.7.4_A1-expected.txt:
     20        * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.4/15.9.4.2_Date.parse/S15.9.4.2_A1_T2-expected.txt:
     21        * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.4/15.9.4.3_Date.UTC/S15.9.4.3_A1_T2-expected.txt:
     22
    1232011-05-17  Cris Neckar  <cdn@chromium.org>
    224
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.2/S15.6.2.1_A4-expected.txt

    r58534 r86727  
    11S15.6.2.1_A4
    22
    3 PASS
     3FAIL SputnikError: #1: The [[Class]] property of the newly constructed object is set to "Boolean"
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.3/15.6.3.1_Boolean.prototype/S15.6.3.1_A1-expected.txt

    r58534 r86727  
    11S15.6.3.1_A1
    22
    3 PASS
     3FAIL SputnikError: #3: The [[Class]] property of the Boolean prototype object is set to "Boolean"
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.4/S15.6.4_A1-expected.txt

    r58534 r86727  
    11S15.6.4_A1
    22
    3 PASS
     3FAIL SputnikError: #3: The [[Class]] property of the Boolean prototype object is set to "Boolean"
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.2/S15.7.2.1_A4-expected.txt

    r58534 r86727  
    11S15.7.2.1_A4
    22
    3 PASS
     3FAIL SputnikError: #1: The [[Class]] property of the newly constructed object is set to "Number"
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.3/15.7.3.1_Number.prototype/S15.7.3.1_A2_T1-expected.txt

    r58534 r86727  
    11S15.7.3.1_A2_T1
    22
    3 PASS
     3FAIL SputnikError: #3: The [[Class]] property of the Number prototype object is set to "Number"
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.4/S15.7.4_A1-expected.txt

    r58534 r86727  
    11S15.7.4_A1
    22
    3 PASS
     3FAIL SputnikError: #3: The [[Class]] property of the Number prototype object is set to "Number"
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.4/15.9.4.2_Date.parse/S15.9.4.2_A1_T2-expected.txt

    r58534 r86727  
    11S15.9.4.2_A1_T2
    22
    3 PASS
     3FAIL SputnikError: #2: The Date.parse property has not the attributes DontDelete
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.4/15.9.4.3_Date.UTC/S15.9.4.3_A1_T2-expected.txt

    r58534 r86727  
    11S15.9.4.3_A1_T2
    22
    3 PASS
     3FAIL SputnikError: #2: The Date.UTC property has not the attributes DontDelete
    44
    55TEST COMPLETE
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r83792 r86727  
    177177
    178178SET(JavaScriptCore_LUT_FILES
     179    runtime/ArrayConstructor.cpp
    179180    runtime/ArrayPrototype.cpp
     181    runtime/BooleanPrototype.cpp
     182    runtime/DateConstructor.cpp
    180183    runtime/DatePrototype.cpp
     184    runtime/ErrorPrototype.cpp
     185    runtime/JSGlobalObject.cpp
    181186    runtime/JSONObject.cpp
    182187    runtime/MathObject.cpp
    183188    runtime/NumberConstructor.cpp
     189    runtime/NumberPrototype.cpp
    184190    runtime/ObjectConstructor.cpp
     191    runtime/ObjectPrototype.cpp
    185192    runtime/RegExpConstructor.cpp
    186193    runtime/RegExpObject.cpp
     194    runtime/RegExpPrototype.cpp
     195    runtime/StringConstructor.cpp
    187196    runtime/StringPrototype.cpp
    188197)
  • trunk/Source/JavaScriptCore/ChangeLog

    r86712 r86727  
     12011-05-16  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Rolling back in r86653 with build fixed.
     4
     5        Reviewed by Gavin Barraclough and Oliver Hunt.
     6
     7        Global object initialization is expensive
     8        https://bugs.webkit.org/show_bug.cgi?id=60933
     9       
     10        Changed a bunch of globals to allocate their properties lazily, and changed
     11        the global object to allocate a bunch of its globals lazily.
     12       
     13        This reduces the footprint of a global object from 287 objects with 58
     14        functions for 24K to 173 objects with 20 functions for 15K.
     15
     16        Large patch, but it's all mechanical.
     17
     18        * DerivedSources.make:
     19        * JavaScriptCore.exp: Build!
     20
     21        * create_hash_table: Added a special case for fromCharCode, since it uses
     22        a custom "thunk generator".
     23
     24        * heap/Heap.cpp:
     25        (JSC::TypeCounter::operator()): Fixed a bug where the type counter would
     26        overcount objects that were owned through more than one mechanism because
     27        it was getting in the way of counting the results for this patch.
     28
     29        * interpreter/CallFrame.h:
     30        (JSC::ExecState::arrayConstructorTable):
     31        (JSC::ExecState::arrayPrototypeTable):
     32        (JSC::ExecState::booleanPrototypeTable):
     33        (JSC::ExecState::dateConstructorTable):
     34        (JSC::ExecState::errorPrototypeTable):
     35        (JSC::ExecState::globalObjectTable):
     36        (JSC::ExecState::numberConstructorTable):
     37        (JSC::ExecState::numberPrototypeTable):
     38        (JSC::ExecState::objectPrototypeTable):
     39        (JSC::ExecState::regExpPrototypeTable):
     40        (JSC::ExecState::stringConstructorTable): Added new tables.
     41
     42        * runtime/ArrayConstructor.cpp:
     43        (JSC::ArrayConstructor::ArrayConstructor):
     44        (JSC::ArrayConstructor::getOwnPropertySlot):
     45        (JSC::ArrayConstructor::getOwnPropertyDescriptor):
     46        * runtime/ArrayConstructor.h:
     47        (JSC::ArrayConstructor::createStructure):
     48        * runtime/ArrayPrototype.cpp:
     49        (JSC::ArrayPrototype::getOwnPropertySlot):
     50        (JSC::ArrayPrototype::getOwnPropertyDescriptor):
     51        * runtime/ArrayPrototype.h:
     52        * runtime/BooleanPrototype.cpp:
     53        (JSC::BooleanPrototype::BooleanPrototype):
     54        (JSC::BooleanPrototype::getOwnPropertySlot):
     55        (JSC::BooleanPrototype::getOwnPropertyDescriptor):
     56        * runtime/BooleanPrototype.h:
     57        (JSC::BooleanPrototype::createStructure):
     58        * runtime/DateConstructor.cpp:
     59        (JSC::DateConstructor::DateConstructor):
     60        (JSC::DateConstructor::getOwnPropertySlot):
     61        (JSC::DateConstructor::getOwnPropertyDescriptor):
     62        * runtime/DateConstructor.h:
     63        (JSC::DateConstructor::createStructure):
     64        * runtime/ErrorPrototype.cpp:
     65        (JSC::ErrorPrototype::ErrorPrototype):
     66        (JSC::ErrorPrototype::getOwnPropertySlot):
     67        (JSC::ErrorPrototype::getOwnPropertyDescriptor):
     68        * runtime/ErrorPrototype.h:
     69        (JSC::ErrorPrototype::createStructure): Standardized these objects
     70        to use static tables for function properties.
     71
     72        * runtime/JSGlobalData.cpp:
     73        (JSC::JSGlobalData::JSGlobalData):
     74        (JSC::JSGlobalData::~JSGlobalData):
     75        * runtime/JSGlobalData.h: Added new tables.
     76
     77        * runtime/JSGlobalObject.cpp:
     78        (JSC::JSGlobalObject::reset):
     79        (JSC::JSGlobalObject::addStaticGlobals):
     80        (JSC::JSGlobalObject::getOwnPropertySlot):
     81        (JSC::JSGlobalObject::getOwnPropertyDescriptor):
     82        * runtime/JSGlobalObject.h:
     83        * runtime/JSGlobalObjectFunctions.cpp:
     84        * runtime/JSGlobalObjectFunctions.h: Changed JSGlobalObject to use a
     85        static table for its global functions. This required uninlining some
     86        things to avoid a circular header dependency. However, those things
     87        probably shouldn't have been inlined in the first place.
     88       
     89        Even more global object properties can be made lazy, but that requires
     90        more in-depth changes.
     91
     92        * runtime/MathObject.cpp:
     93        * runtime/NumberConstructor.cpp:
     94        (JSC::NumberConstructor::getOwnPropertySlot):
     95        (JSC::NumberConstructor::getOwnPropertyDescriptor):
     96        * runtime/NumberPrototype.cpp:
     97        (JSC::NumberPrototype::NumberPrototype):
     98        (JSC::NumberPrototype::getOwnPropertySlot):
     99        (JSC::NumberPrototype::getOwnPropertyDescriptor):
     100        * runtime/NumberPrototype.h:
     101        (JSC::NumberPrototype::createStructure):
     102        * runtime/ObjectPrototype.cpp:
     103        (JSC::ObjectPrototype::ObjectPrototype):
     104        (JSC::ObjectPrototype::put):
     105        (JSC::ObjectPrototype::getOwnPropertySlot):
     106        (JSC::ObjectPrototype::getOwnPropertyDescriptor):
     107        * runtime/ObjectPrototype.h:
     108        (JSC::ObjectPrototype::createStructure):
     109        * runtime/RegExpPrototype.cpp:
     110        (JSC::RegExpPrototype::RegExpPrototype):
     111        (JSC::RegExpPrototype::getOwnPropertySlot):
     112        (JSC::RegExpPrototype::getOwnPropertyDescriptor):
     113        * runtime/RegExpPrototype.h:
     114        (JSC::RegExpPrototype::createStructure):
     115        * runtime/StringConstructor.cpp:
     116        (JSC::StringConstructor::StringConstructor):
     117        (JSC::StringConstructor::getOwnPropertySlot):
     118        (JSC::StringConstructor::getOwnPropertyDescriptor):
     119        * runtime/StringConstructor.h:
     120        (JSC::StringConstructor::createStructure): Standardized these objects
     121        to use static tables for function properties.
     122
    11232011-05-17  Sam Weinig  <sam@webkit.org>
    2124
  • trunk/Source/JavaScriptCore/DerivedSources.make

    r86657 r86727  
    3636.PHONY : all
    3737all : \
     38    ArrayConstructor.lut.h \
    3839    ArrayPrototype.lut.h \
     40    BooleanPrototype.lut.h \
     41    DateConstructor.lut.h \
    3942    DatePrototype.lut.h \
     43    ErrorPrototype.lut.h \
    4044    HeaderDetection.h \
    4145    JSONObject.lut.h \
    4246    JavaScriptCore.JSVALUE32_64.exp \
    4347    JavaScriptCore.JSVALUE64.exp \
     48    JSGlobalObject.lut.h \
    4449    Lexer.lut.h \
    4550    MathObject.lut.h \
    4651    NumberConstructor.lut.h \
     52    NumberPrototype.lut.h \
    4753    ObjectConstructor.lut.h \
     54    ObjectPrototype.lut.h \
    4855    RegExpConstructor.lut.h \
     56    RegExpPrototype.lut.h \
    4957    RegExpJitTables.h \
    5058    RegExpObject.lut.h \
     59    StringConstructor.lut.h \
    5160    StringPrototype.lut.h \
    5261    docs/bytecode.html \
  • trunk/Source/JavaScriptCore/DerivedSources.pro

    r86657 r86727  
    1515
    1616LUT_FILES += \
     17    runtime/ArrayConstructor.cpp \
    1718    runtime/ArrayPrototype.cpp \
     19    runtime/BooleanPrototype.cpp \
     20    runtime/DateConstructor.cpp \
    1821    runtime/DatePrototype.cpp \
     22    runtime/ErrorPrototype.cpp \
     23    runtime/JSGlobalObject.cpp \
    1924    runtime/JSONObject.cpp \
    2025    runtime/MathObject.cpp \
    2126    runtime/NumberConstructor.cpp \
     27    runtime/NumberPrototype.cpp \
    2228    runtime/ObjectConstructor.cpp \
     29    runtime/ObjectPrototype.cpp \
    2330    runtime/RegExpConstructor.cpp \
    2431    runtime/RegExpObject.cpp \
    25     runtime/StringPrototype.cpp
     32    runtime/RegExpPrototype.cpp \
     33    runtime/StringConstructor.cpp \
     34    runtime/StringPrototype.cpp \
    2635
    2736KEYWORDLUT_FILES += \
  • trunk/Source/JavaScriptCore/GNUmakefile.am

    r86657 r86727  
    146146# FIXME: Should this list be generated from javascriptcore_built_nosources?
    147147CLEANFILES += \
    148         Source/JavaScriptCore/runtime/ArrayPrototype.lut.h \
    149         Source/JavaScriptCore/runtime/DatePrototype.lut.h \
    150         Source/JavaScriptCore/runtime/JSONObject.lut.h \
    151         Source/JavaScriptCore/runtime/MathObject.lut.h \
    152         Source/JavaScriptCore/runtime/NumberConstructor.lut.h \
    153         Source/JavaScriptCore/runtime/RegExpConstructor.lut.h \
    154         Source/JavaScriptCore/runtime/RegExpObject.lut.h \
    155         Source/JavaScriptCore/runtime/StringPrototype.lut.h \
     148        Source/JavaScriptCore/Lexer.lut.h \
     149        Source/JavaScriptCore/RegExpJitTables.h \
     150        Source/JavaScriptCore/runtime/ArrayConstructor.lut.h \
     151        Source/JavaScriptCore/runtime/ArrayPrototype.lut.h \
     152        Source/JavaScriptCore/runtime/BooleanPrototype.lut.h \
     153        Source/JavaScriptCore/runtime/DateConstructor.lut.h \
     154        Source/JavaScriptCore/runtime/DatePrototype.lut.h \
     155        Source/JavaScriptCore/runtime/ErrorPrototype.lut.h \
     156        Source/JavaScriptCore/runtime/JSGlobalObject.lut.h \
     157        Source/JavaScriptCore/runtime/JSONObject.lut.h \
     158        Source/JavaScriptCore/runtime/MathObject.lut.h \
     159        Source/JavaScriptCore/runtime/NumberConstructor.lut.h \
     160        Source/JavaScriptCore/runtime/NumberPrototype.lut.h \
     161        Source/JavaScriptCore/runtime/ObjectConstructor.lut.h \
     162        Source/JavaScriptCore/runtime/ObjectPrototype.lut.h \
     163        Source/JavaScriptCore/runtime/RegExpConstructor.lut.h \
     164        Source/JavaScriptCore/runtime/RegExpObject.lut.h \
     165        Source/JavaScriptCore/runtime/RegExpPrototype.lut.h \
     166        Source/JavaScriptCore/runtime/StringConstructor.lut.h \
     167        Source/JavaScriptCore/runtime/StringPrototype.lut.h \
    156168        Programs/jsc \
    157169        Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@ \
  • trunk/Source/JavaScriptCore/GNUmakefile.list.am

    r86657 r86727  
    1414        Source/JavaScriptCore/Lexer.lut.h \
    1515        Source/JavaScriptCore/RegExpJitTables.h \
    16         Source/JavaScriptCore/runtime/ArrayPrototype.lut.h \
    17         Source/JavaScriptCore/runtime/DatePrototype.lut.h \
    18         Source/JavaScriptCore/runtime/JSONObject.lut.h \
    19         Source/JavaScriptCore/runtime/MathObject.lut.h \
    20         Source/JavaScriptCore/runtime/NumberConstructor.lut.h \
    21         Source/JavaScriptCore/runtime/ObjectConstructor.lut.h \
    22         Source/JavaScriptCore/runtime/RegExpConstructor.lut.h \
    23         Source/JavaScriptCore/runtime/RegExpObject.lut.h \
    24         Source/JavaScriptCore/runtime/StringPrototype.lut.h
     16        Source/JavaScriptCore/runtime/ArrayConstructor.lut.h \
     17        Source/JavaScriptCore/runtime/ArrayPrototype.lut.h \
     18        Source/JavaScriptCore/runtime/BooleanPrototype.lut.h \
     19        Source/JavaScriptCore/runtime/DateConstructor.lut.h \
     20        Source/JavaScriptCore/runtime/DatePrototype.lut.h \
     21        Source/JavaScriptCore/runtime/ErrorPrototype.lut.h \
     22        Source/JavaScriptCore/runtime/JSGlobalObject.lut.h \
     23        Source/JavaScriptCore/runtime/JSONObject.lut.h \
     24        Source/JavaScriptCore/runtime/MathObject.lut.h \
     25        Source/JavaScriptCore/runtime/NumberConstructor.lut.h \
     26        Source/JavaScriptCore/runtime/NumberPrototype.lut.h \
     27        Source/JavaScriptCore/runtime/ObjectConstructor.lut.h \
     28        Source/JavaScriptCore/runtime/ObjectPrototype.lut.h \
     29        Source/JavaScriptCore/runtime/RegExpConstructor.lut.h \
     30        Source/JavaScriptCore/runtime/RegExpObject.lut.h \
     31        Source/JavaScriptCore/runtime/RegExpPrototype.lut.h \
     32        Source/JavaScriptCore/runtime/StringConstructor.lut.h \
     33        Source/JavaScriptCore/runtime/StringPrototype.lut.h
    2534
    2635javascriptcore_sources += \
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r86657 r86727  
    160160__ZN3JSC14JSGlobalObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
    161161__ZN3JSC14JSGlobalObject13visitChildrenERNS_9MarkStackE
     162__ZN3JSC14JSGlobalObject16addStaticGlobalsEPNS0_18GlobalPropertyInfoEi
    162163__ZN3JSC14JSGlobalObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
     164__ZN3JSC14JSGlobalObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
     165__ZN3JSC14JSGlobalObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
    163166__ZN3JSC14JSGlobalObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE 
    164167__ZN3JSC14JSGlobalObject4initEPNS_8JSObjectE
     168__ZN3JSC14JSGlobalObject6s_infoE
    165169__ZN3JSC14JSGlobalObjectD2Ev
    166170__ZN3JSC14JSGlobalObjectnwEmPNS_12JSGlobalDataE
     
    218222__ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE
    219223__ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
     224__ZN3JSC3NaNE
    220225__ZN3JSC41constructFunctionSkippingEvalEnabledCheckEPNS_9ExecStateEPNS_14JSGlobalObjectERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
    221 __ZN3JSC3NaNE
    222226__ZN3JSC4Heap16activityCallbackEv
    223227__ZN3JSC4Heap16allocateSlowCaseEm
     
    376380__ZN3WTF11OSAllocator18releaseDecommittedEPvm
    377381__ZN3WTF11commentAtomE
    378 __ZN3WTF11emptyStringEv
    379382__ZN3WTF11currentTimeEv
    380383__ZN3WTF11dtoaRoundDPEPcdiRbRiRj
    381384__ZN3WTF11dtoaRoundSFEPcdiRbRiRj
     385__ZN3WTF11emptyStringEv
    382386__ZN3WTF11fastReallocEPvm
    383387__ZN3WTF12AtomicString11addSlowCaseEPNS_10StringImplE
  • trunk/Source/JavaScriptCore/JavaScriptCore.gypi

    r86657 r86727  
    693693        ],
    694694        'javascriptcore_derived_source_files': [
     695            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/Lexer.lut.h',
     696            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/RegExpJitTables.h',
     697            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/TracingDtrace.h',
     698            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/ArrayConstructor.lut.h',
    695699            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/ArrayPrototype.lut.h',
     700            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/BooleanPrototype.lut.h',
     701            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/DateConstructor.lut.h',
    696702            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/DatePrototype.lut.h',
    697             '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/HeaderDetection.h',
     703            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/ErrorPrototype.lut.h',
     704            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/JSGlobalObject.lut.h',
    698705            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/JSONObject.lut.h',
    699             '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/Lexer.lut.h',
    700706            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/MathObject.lut.h',
    701707            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/NumberConstructor.lut.h',
     708            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/NumberPrototype.lut.h',
     709            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/ObjectConstructor.lut.h',
     710            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/ObjectPrototype.lut.h',
    702711            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/RegExpConstructor.lut.h',
    703             '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/RegExpJitTables.h',
    704712            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/RegExpObject.lut.h',
     713            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/RegExpPrototype.lut.h',
     714            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/StringConstructor.lut.h',
    705715            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/StringPrototype.lut.h',
    706             '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/TracingDtrace.h',
    707             '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/ObjectConstructor.lut.h',
    708716        ],
    709717        'minidom_files': [
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

    r86657 r86727  
    5757    ?addPropertyWithoutTransition@Structure@JSC@@QAEIAAVJSGlobalData@2@ABVIdentifier@2@IPAVJSCell@2@@Z
    5858    ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PAVStringImpl@4@@Z
     59    ?addStaticGlobals@JSGlobalObject@JSC@@IAEXPAUGlobalPropertyInfo@12@H@Z
    5960    ?allocate@Heap@JSC@@QAEPAXI@Z
    6061    ?allocateFromSizeClass@MarkedSpace@JSC@@AAEPAXAAUSizeClass@12@@Z
     
    183184    ?getJSNumber@JSCell@JSC@@UAE?AVJSValue@2@XZ
    184185    ?getObject@JSCell@JSC@@QAEPAVJSObject@2@XZ
     186    ?getOwnPropertyDescriptor@JSGlobalObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
    185187    ?getOwnPropertyDescriptor@JSObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
    186188    ?getOwnPropertyDescriptor@JSString@JSC@@EAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
     
    192194    ?getOwnPropertySlot@JSCell@JSC@@EAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z
    193195    ?getOwnPropertySlot@JSCell@JSC@@EAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
     196    ?getOwnPropertySlot@JSGlobalObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z
    194197    ?getOwnPropertySlot@JSObject@JSC@@UAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
    195198    ?getOwnPropertySlot@JSString@JSC@@EAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z
     
    241244    ?lookupGetter@JSObject@JSC@@UAE?AVJSValue@2@PAVExecState@2@ABVIdentifier@2@@Z
    242245    ?lookupSetter@JSObject@JSC@@UAE?AVJSValue@2@PAVExecState@2@ABVIdentifier@2@@Z
    243     ?visitChildren@JSGlobalObject@JSC@@UAEXAAVMarkStack@2@@Z
    244     ?visitChildren@JSObject@JSC@@UAEXAAVMarkStack@2@@Z
    245     ?visitChildren@JSWrapperObject@JSC@@EAEXAAVMarkStack@2@@Z
    246     ?visitChildren@ScopeChainNode@JSC@@UAEXAAVMarkStack@2@@Z
    247246    ?materializePropertyMap@Structure@JSC@@AAEXAAVJSGlobalData@2@@Z
    248247    ?monthFromDayInYear@WTF@@YAHH_N@Z
     
    298297    ?retrieveCaller@Interpreter@JSC@@QBE?AVJSValue@2@PAVExecState@2@PAVJSFunction@2@@Z
    299298    ?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVUString@2@AAVJSValue@2@@Z
     299    ?s_info@JSGlobalObject@JSC@@2UClassInfo@2@B
    300300    ?setAccessorDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@0I@Z
    301301    ?setConfigurable@PropertyDescriptor@JSC@@QAEX_N@Z
     
    370370    ?unwrappedObject@JSObject@JSC@@UAEPAV12@XZ
    371371    ?utf8@UString@JSC@@QBE?AVCString@WTF@@_N@Z
     372    ?visitChildren@JSGlobalObject@JSC@@UAEXAAVMarkStack@2@@Z
     373    ?visitChildren@JSObject@JSC@@UAEXAAVMarkStack@2@@Z
     374    ?visitChildren@JSWrapperObject@JSC@@EAEXAAVMarkStack@2@@Z
     375    ?visitChildren@ScopeChainNode@JSC@@UAEXAAVMarkStack@2@@Z
    372376    ?vtableAnchor@InternalFunction@JSC@@EAEXXZ
    373377    ?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z
  • trunk/Source/JavaScriptCore/create_hash_table

    r86657 r86727  
    285285            $thunkGenerator = "powThunkGenerator";
    286286        }
     287        if ($key eq "fromCharCode") {
     288            $thunkGenerator = "fromCharCodeThunkGenerator";
     289        }
    287290        print "   { \"$key\", $attrs[$i], (intptr_t)" . $castStr . "($firstValue), (intptr_t)$secondValue THUNK_GENERATOR($thunkGenerator) },\n";
    288291        $i++;
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r86657 r86727  
    11/*
    2  *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     2 *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
    33 *  Copyright (C) 2007 Eric Seidel <eric@webkit.org>
    44 *
     
    314314    const char* typeName(JSCell*);
    315315    OwnPtr<TypeCountSet> m_typeCountSet;
     316    HashSet<JSCell*> m_cells;
    316317};
    317318
     
    340341inline void TypeCounter::operator()(JSCell* cell)
    341342{
     343    if (!m_cells.add(cell).second)
     344        return;
    342345    m_typeCountSet->add(typeName(cell));
    343346}
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r86657 r86727  
    22 *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2003, 2007, 2008, 2011 Apple Inc. All rights reserved.
    55 *
    66 *  This library is free software; you can redistribute it and/or
     
    7676        void dumpCaller();
    7777#endif
    78         static const HashTable* arrayTable(CallFrame* callFrame) { return callFrame->globalData().arrayTable; }
     78        static const HashTable* arrayConstructorTable(CallFrame* callFrame) { return callFrame->globalData().arrayConstructorTable; }
     79        static const HashTable* arrayPrototypeTable(CallFrame* callFrame) { return callFrame->globalData().arrayPrototypeTable; }
     80        static const HashTable* booleanPrototypeTable(CallFrame* callFrame) { return callFrame->globalData().booleanPrototypeTable; }
    7981        static const HashTable* dateTable(CallFrame* callFrame) { return callFrame->globalData().dateTable; }
     82        static const HashTable* dateConstructorTable(CallFrame* callFrame) { return callFrame->globalData().dateConstructorTable; }
     83        static const HashTable* errorPrototypeTable(CallFrame* callFrame) { return callFrame->globalData().errorPrototypeTable; }
     84        static const HashTable* globalObjectTable(CallFrame* callFrame) { return callFrame->globalData().globalObjectTable; }
    8085        static const HashTable* jsonTable(CallFrame* callFrame) { return callFrame->globalData().jsonTable; }
    8186        static const HashTable* mathTable(CallFrame* callFrame) { return callFrame->globalData().mathTable; }
    82         static const HashTable* numberTable(CallFrame* callFrame) { return callFrame->globalData().numberTable; }
     87        static const HashTable* numberConstructorTable(CallFrame* callFrame) { return callFrame->globalData().numberConstructorTable; }
     88        static const HashTable* numberPrototypeTable(CallFrame* callFrame) { return callFrame->globalData().numberPrototypeTable; }
    8389        static const HashTable* objectConstructorTable(CallFrame* callFrame) { return callFrame->globalData().objectConstructorTable; }
     90        static const HashTable* objectPrototypeTable(CallFrame* callFrame) { return callFrame->globalData().objectPrototypeTable; }
    8491        static const HashTable* regExpTable(CallFrame* callFrame) { return callFrame->globalData().regExpTable; }
    8592        static const HashTable* regExpConstructorTable(CallFrame* callFrame) { return callFrame->globalData().regExpConstructorTable; }
     93        static const HashTable* regExpPrototypeTable(CallFrame* callFrame) { return callFrame->globalData().regExpPrototypeTable; }
    8694        static const HashTable* stringTable(CallFrame* callFrame) { return callFrame->globalData().stringTable; }
     95        static const HashTable* stringConstructorTable(CallFrame* callFrame) { return callFrame->globalData().stringConstructorTable; }
    8796
    8897        static CallFrame* create(Register* callFrameBase) { return static_cast<CallFrame*>(callFrameBase); }
  • trunk/Source/JavaScriptCore/runtime/ArrayConstructor.cpp

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2003, 2007, 2008, 2011 Apple Inc. All rights reserved.
    44 *  Copyright (C) 2003 Peter Kelly (pmk@post.com)
    55 *  Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
     
    3434namespace JSC {
    3535
    36 ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
    37    
    3836static EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*);
    3937
    40 ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype, Structure* functionStructure)
     38}
     39
     40#include "ArrayConstructor.lut.h"
     41
     42namespace JSC {
     43
     44const ClassInfo ArrayConstructor::s_info = { "Function", &InternalFunction::s_info, 0, ExecState::arrayConstructorTable };
     45
     46/* Source for ArrayConstructor.lut.h
     47@begin arrayConstructorTable
     48  isArray   arrayConstructorIsArray     DontEnum|Function 1
     49@end
     50*/
     51
     52ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
     53
     54ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype)
    4155    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, arrayPrototype->classInfo()->className))
    4256{
    43     // ECMA 15.4.3.1 Array.prototype
    4457    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
     58    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
     59}
    4560
    46     // no. of arguments for constructor
    47     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
     61bool ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
     62{
     63    return getStaticFunctionSlot<InternalFunction>(exec, ExecState::arrayConstructorTable(exec), this, propertyName, slot);
     64}
    4865
    49     // ES5
    50     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().isArray, arrayConstructorIsArray), DontEnum);
     66bool ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
     67{
     68    return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::arrayConstructorTable(exec), this, propertyName, descriptor);
    5169}
     70
     71// ------------------------------ Functions ---------------------------
    5272
    5373static inline JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgList& args)
     
    7393}
    7494
    75 // ECMA 15.4.2
    7695ConstructType ArrayConstructor::getConstructData(ConstructData& constructData)
    7796{
     
    86105}
    87106
    88 // ECMA 15.6.1
    89107CallType ArrayConstructor::getCallData(CallData& callData)
    90108{
  • trunk/Source/JavaScriptCore/runtime/ArrayConstructor.h

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    3030    class ArrayConstructor : public InternalFunction {
    3131    public:
    32         ArrayConstructor(ExecState*, JSGlobalObject*, Structure*, ArrayPrototype*, Structure*);
     32        ArrayConstructor(ExecState*, JSGlobalObject*, Structure*, ArrayPrototype*);
     33
     34        static const ClassInfo s_info;
     35
     36        static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
     37        {
     38            return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
     39        }
     40
     41    protected:
     42        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
     43
     44    private:
     45        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     46        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    3347
    3448        virtual ConstructType getConstructData(ConstructData&);
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r86657 r86727  
    8686// ------------------------------ ArrayPrototype ----------------------------
    8787
    88 const ClassInfo ArrayPrototype::s_info = {"Array", &JSArray::s_info, 0, ExecState::arrayTable};
     88const ClassInfo ArrayPrototype::s_info = {"Array", &JSArray::s_info, 0, ExecState::arrayPrototypeTable};
    8989
    9090/* Source for ArrayPrototype.lut.h
    91 @begin arrayTable 16
     91@begin arrayPrototypeTable 16
    9292  toString       arrayProtoFuncToString       DontEnum|Function 0
    9393  toLocaleString arrayProtoFuncToLocaleString DontEnum|Function 0
     
    124124bool ArrayPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    125125{
    126     return getStaticFunctionSlot<JSArray>(exec, ExecState::arrayTable(exec), this, propertyName, slot);
     126    return getStaticFunctionSlot<JSArray>(exec, ExecState::arrayPrototypeTable(exec), this, propertyName, slot);
    127127}
    128128
    129129bool ArrayPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
    130130{
    131     return getStaticFunctionDescriptor<JSArray>(exec, ExecState::arrayTable(exec), this, propertyName, descriptor);
     131    return getStaticFunctionDescriptor<JSArray>(exec, ExecState::arrayPrototypeTable(exec), this, propertyName, descriptor);
    132132}
    133133
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.h

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2007 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2007, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
  • trunk/Source/JavaScriptCore/runtime/BooleanPrototype.cpp

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2003, 2008, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    3030namespace JSC {
    3131
    32 ASSERT_CLASS_FITS_IN_CELL(BooleanPrototype);
    33 
    34 // Functions
    3532static EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState*);
    3633static EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*);
    3734
    38 // ECMA 15.6.4
     35}
    3936
    40 BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure)
     37#include "BooleanPrototype.lut.h"
     38
     39namespace JSC {
     40
     41const ClassInfo BooleanPrototype::s_info = { "Boolean", &BooleanObject::s_info, 0, ExecState::booleanPrototypeTable };
     42
     43/* Source for BooleanPrototype.lut.h
     44@begin booleanPrototypeTable
     45  toString  booleanProtoFuncToString    DontEnum|Function 0
     46  valueOf   booleanProtoFuncValueOf     DontEnum|Function 0
     47@end
     48*/
     49
     50ASSERT_CLASS_FITS_IN_CELL(BooleanPrototype);
     51
     52BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
    4153    : BooleanObject(exec->globalData(), structure)
    4254{
    4355    setInternalValue(exec->globalData(), jsBoolean(false));
    4456
    45     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
    46     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
     57    ASSERT(inherits(&s_info));
     58    putAnonymousValue(globalObject->globalData(), 0, globalObject);
    4759}
    4860
     61bool BooleanPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
     62{
     63    return getStaticFunctionSlot<BooleanObject>(exec, ExecState::booleanPrototypeTable(exec), this, propertyName, slot);
     64}
    4965
    50 // ------------------------------ Functions --------------------------
     66bool BooleanPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
     67{
     68    return getStaticFunctionDescriptor<BooleanObject>(exec, ExecState::booleanPrototypeTable(exec), this, propertyName, descriptor);
     69}
    5170
    52 // ECMA 15.6.4.2 + 15.6.4.3
     71// ------------------------------ Functions ---------------------------
    5372
    5473EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec)
  • trunk/Source/JavaScriptCore/runtime/BooleanPrototype.h

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2008, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    2828    class BooleanPrototype : public BooleanObject {
    2929    public:
    30         BooleanPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure);
     30        BooleanPrototype(ExecState*, JSGlobalObject*, Structure*);
     31
     32        static const ClassInfo s_info;
     33
     34        static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
     35        {
     36            return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
     37        }
     38
     39    protected:
     40        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | BooleanObject::StructureFlags;
     41        static const unsigned AnonymousSlotCount = BooleanObject::AnonymousSlotCount + 1;
     42
     43    private:
     44        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     45        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    3146    };
    3247
  • trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    5252namespace JSC {
    5353
    54 ASSERT_CLASS_FITS_IN_CELL(DateConstructor);
    55 
    5654static EncodedJSValue JSC_HOST_CALL dateParse(ExecState*);
    5755static EncodedJSValue JSC_HOST_CALL dateNow(ExecState*);
    5856static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState*);
    5957
    60 DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure, DatePrototype* datePrototype)
     58}
     59
     60#include "DateConstructor.lut.h"
     61
     62namespace JSC {
     63
     64const ClassInfo DateConstructor::s_info = { "Function", &InternalFunction::s_info, 0, ExecState::dateConstructorTable };
     65
     66/* Source for DateConstructor.lut.h
     67@begin dateConstructorTable
     68  parse     dateParse   DontEnum|Function 1
     69  UTC       dateUTC     DontEnum|Function 7
     70  now       dateNow     DontEnum|Function 0
     71@end
     72*/
     73
     74ASSERT_CLASS_FITS_IN_CELL(DateConstructor);
     75
     76DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, DatePrototype* datePrototype)
    6177    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, datePrototype->classInfo()->className))
    6278{
    6379    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, datePrototype, DontEnum | DontDelete | ReadOnly);
    64 
    65     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum);
    66     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum);
    67     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().now, dateNow), DontEnum);
    68 
    6980    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(7), ReadOnly | DontEnum | DontDelete);
     81}
     82
     83bool DateConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
     84{
     85    return getStaticFunctionSlot<InternalFunction>(exec, ExecState::dateConstructorTable(exec), this, propertyName, slot);
     86}
     87
     88bool DateConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
     89{
     90    return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::dateConstructorTable(exec), this, propertyName, descriptor);
    7091}
    7192
  • trunk/Source/JavaScriptCore/runtime/DateConstructor.h

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2008, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    3030    class DateConstructor : public InternalFunction {
    3131    public:
    32         DateConstructor(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure, DatePrototype*);
     32        DateConstructor(ExecState*, JSGlobalObject*, Structure*, DatePrototype*);
     33
     34        static const ClassInfo s_info;
     35
     36        static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
     37        {
     38            return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
     39        }
     40
     41    protected:
     42        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
    3343
    3444    private:
    3545        virtual ConstructType getConstructData(ConstructData&);
    3646        virtual CallType getCallData(CallData&);
     47
     48        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     49        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    3750    };
    3851
  • trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp

    r86657 r86727  
    3535static EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*);
    3636
    37 // ECMA 15.9.4
    38 ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure)
     37}
     38
     39#include "ErrorPrototype.lut.h"
     40
     41namespace JSC {
     42
     43const ClassInfo ErrorPrototype::s_info = { "Error", &ErrorInstance::s_info, 0, ExecState::errorPrototypeTable };
     44
     45/* Source for ErrorPrototype.lut.h
     46@begin errorPrototypeTable
     47  toString          errorProtoFuncToString         DontEnum|Function 0
     48@end
     49*/
     50
     51ASSERT_CLASS_FITS_IN_CELL(ErrorPrototype);
     52
     53ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
    3954    : ErrorInstance(&exec->globalData(), structure)
    4055{
    41     // The constructor will be added later in ErrorConstructor's constructor
     56    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
    4257
    43     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
    44     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
     58    ASSERT(inherits(&s_info));
     59    putAnonymousValue(globalObject->globalData(), 0, globalObject);
    4560}
     61
     62bool ErrorPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
     63{
     64    return getStaticFunctionSlot<ErrorInstance>(exec, ExecState::errorPrototypeTable(exec), this, propertyName, slot);
     65}
     66
     67bool ErrorPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
     68{
     69    return getStaticFunctionDescriptor<ErrorInstance>(exec, ExecState::errorPrototypeTable(exec), this, propertyName, descriptor);
     70}
     71
     72// ------------------------------ Functions ---------------------------
    4673
    4774EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec)
  • trunk/Source/JavaScriptCore/runtime/ErrorPrototype.h

    r86657 r86727  
    3030    class ErrorPrototype : public ErrorInstance {
    3131    public:
    32         ErrorPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure);
     32        ErrorPrototype(ExecState*, JSGlobalObject*, Structure*);
     33
     34        static const ClassInfo s_info;
     35
     36        static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
     37        {
     38            return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
     39        }
     40
     41    protected:
     42        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags;
     43        static const unsigned AnonymousSlotCount = ErrorInstance::AnonymousSlotCount + 1;
     44
     45    private:
     46        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     47        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    3348    };
    3449
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp

    r86657 r86727  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2011 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    9393namespace JSC {
    9494
    95 extern JSC_CONST_HASHTABLE HashTable arrayTable;
     95extern JSC_CONST_HASHTABLE HashTable arrayConstructorTable;
     96extern JSC_CONST_HASHTABLE HashTable arrayPrototypeTable;
     97extern JSC_CONST_HASHTABLE HashTable booleanPrototypeTable;
    9698extern JSC_CONST_HASHTABLE HashTable jsonTable;
    9799extern JSC_CONST_HASHTABLE HashTable dateTable;
     100extern JSC_CONST_HASHTABLE HashTable dateConstructorTable;
     101extern JSC_CONST_HASHTABLE HashTable errorPrototypeTable;
     102extern JSC_CONST_HASHTABLE HashTable globalObjectTable;
    98103extern JSC_CONST_HASHTABLE HashTable mathTable;
    99 extern JSC_CONST_HASHTABLE HashTable numberTable;
     104extern JSC_CONST_HASHTABLE HashTable numberConstructorTable;
     105extern JSC_CONST_HASHTABLE HashTable numberPrototypeTable;
    100106extern JSC_CONST_HASHTABLE HashTable objectConstructorTable;
     107extern JSC_CONST_HASHTABLE HashTable objectPrototypeTable;
    101108extern JSC_CONST_HASHTABLE HashTable regExpTable;
    102109extern JSC_CONST_HASHTABLE HashTable regExpConstructorTable;
     110extern JSC_CONST_HASHTABLE HashTable regExpPrototypeTable;
    103111extern JSC_CONST_HASHTABLE HashTable stringTable;
     112extern JSC_CONST_HASHTABLE HashTable stringConstructorTable;
    104113
    105114void* JSGlobalData::jsArrayVPtr;
     
    147156    : globalDataType(globalDataType)
    148157    , clientData(0)
    149     , arrayTable(fastNew<HashTable>(JSC::arrayTable))
     158    , arrayConstructorTable(fastNew<HashTable>(JSC::arrayConstructorTable))
     159    , arrayPrototypeTable(fastNew<HashTable>(JSC::arrayPrototypeTable))
     160    , booleanPrototypeTable(fastNew<HashTable>(JSC::booleanPrototypeTable))
    150161    , dateTable(fastNew<HashTable>(JSC::dateTable))
     162    , dateConstructorTable(fastNew<HashTable>(JSC::dateConstructorTable))
     163    , errorPrototypeTable(fastNew<HashTable>(JSC::errorPrototypeTable))
     164    , globalObjectTable(fastNew<HashTable>(JSC::globalObjectTable))
    151165    , jsonTable(fastNew<HashTable>(JSC::jsonTable))
    152166    , mathTable(fastNew<HashTable>(JSC::mathTable))
    153     , numberTable(fastNew<HashTable>(JSC::numberTable))
     167    , numberConstructorTable(fastNew<HashTable>(JSC::numberConstructorTable))
     168    , numberPrototypeTable(fastNew<HashTable>(JSC::numberPrototypeTable))
    154169    , objectConstructorTable(fastNew<HashTable>(JSC::objectConstructorTable))
     170    , objectPrototypeTable(fastNew<HashTable>(JSC::objectPrototypeTable))
    155171    , regExpTable(fastNew<HashTable>(JSC::regExpTable))
    156172    , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable))
     173    , regExpPrototypeTable(fastNew<HashTable>(JSC::regExpPrototypeTable))
    157174    , stringTable(fastNew<HashTable>(JSC::stringTable))
     175    , stringConstructorTable(fastNew<HashTable>(JSC::stringConstructorTable))
    158176    , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable())
    159177    , propertyNames(new CommonIdentifiers(this))
     
    276294#endif
    277295
    278     arrayTable->deleteTable();
     296    arrayPrototypeTable->deleteTable();
     297    arrayConstructorTable->deleteTable();
     298    booleanPrototypeTable->deleteTable();
    279299    dateTable->deleteTable();
     300    dateConstructorTable->deleteTable();
     301    errorPrototypeTable->deleteTable();
     302    globalObjectTable->deleteTable();
    280303    jsonTable->deleteTable();
    281304    mathTable->deleteTable();
    282     numberTable->deleteTable();
     305    numberConstructorTable->deleteTable();
     306    numberPrototypeTable->deleteTable();
    283307    objectConstructorTable->deleteTable();
     308    objectPrototypeTable->deleteTable();
    284309    regExpTable->deleteTable();
    285310    regExpConstructorTable->deleteTable();
     311    regExpPrototypeTable->deleteTable();
    286312    stringTable->deleteTable();
    287 
    288     fastDelete(const_cast<HashTable*>(arrayTable));
     313    stringConstructorTable->deleteTable();
     314
     315    fastDelete(const_cast<HashTable*>(arrayConstructorTable));
     316    fastDelete(const_cast<HashTable*>(arrayPrototypeTable));
     317    fastDelete(const_cast<HashTable*>(booleanPrototypeTable));
    289318    fastDelete(const_cast<HashTable*>(dateTable));
     319    fastDelete(const_cast<HashTable*>(dateConstructorTable));
     320    fastDelete(const_cast<HashTable*>(errorPrototypeTable));
     321    fastDelete(const_cast<HashTable*>(globalObjectTable));
    290322    fastDelete(const_cast<HashTable*>(jsonTable));
    291323    fastDelete(const_cast<HashTable*>(mathTable));
    292     fastDelete(const_cast<HashTable*>(numberTable));
     324    fastDelete(const_cast<HashTable*>(numberConstructorTable));
     325    fastDelete(const_cast<HashTable*>(numberPrototypeTable));
    293326    fastDelete(const_cast<HashTable*>(objectConstructorTable));
     327    fastDelete(const_cast<HashTable*>(objectPrototypeTable));
    294328    fastDelete(const_cast<HashTable*>(regExpTable));
    295329    fastDelete(const_cast<HashTable*>(regExpConstructorTable));
     330    fastDelete(const_cast<HashTable*>(regExpPrototypeTable));
    296331    fastDelete(const_cast<HashTable*>(stringTable));
     332    fastDelete(const_cast<HashTable*>(stringConstructorTable));
    297333
    298334    delete parser;
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.h

    r86657 r86727  
    137137        ClientData* clientData;
    138138
    139         const HashTable* arrayTable;
     139        const HashTable* arrayConstructorTable;
     140        const HashTable* arrayPrototypeTable;
     141        const HashTable* booleanPrototypeTable;
    140142        const HashTable* dateTable;
     143        const HashTable* dateConstructorTable;
     144        const HashTable* errorPrototypeTable;
     145        const HashTable* globalObjectTable;
    141146        const HashTable* jsonTable;
    142147        const HashTable* mathTable;
    143         const HashTable* numberTable;
     148        const HashTable* numberConstructorTable;
     149        const HashTable* numberPrototypeTable;
    144150        const HashTable* objectConstructorTable;
     151        const HashTable* objectPrototypeTable;
    145152        const HashTable* regExpTable;
    146153        const HashTable* regExpConstructorTable;
     154        const HashTable* regExpPrototypeTable;
    147155        const HashTable* stringTable;
     156        const HashTable* stringConstructorTable;
    148157       
    149158        Strong<Structure> structureStructure;
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r86657 r86727  
    5252#include "JSONObject.h"
    5353#include "Interpreter.h"
     54#include "Lookup.h"
    5455#include "MathObject.h"
    5556#include "NativeErrorConstructor.h"
     
    6970#include "Debugger.h"
    7071
     72#include "JSGlobalObject.lut.h"
     73
    7174namespace JSC {
     75
     76const ClassInfo JSGlobalObject::s_info = { "GlobalObject", &JSVariableObject::s_info, 0, ExecState::globalObjectTable };
     77
     78/* Source for JSGlobalObject.lut.h
     79@begin globalObjectTable
     80  parseInt              globalFuncParseInt              DontEnum|Function 2
     81  parseFloat            globalFuncParseFloat            DontEnum|Function 1
     82  isNaN                 globalFuncIsNaN                 DontEnum|Function 1
     83  isFinite              globalFuncIsFinite              DontEnum|Function 1
     84  escape                globalFuncEscape                DontEnum|Function 1
     85  unescape              globalFuncUnescape              DontEnum|Function 1
     86  decodeURI             globalFuncDecodeURI             DontEnum|Function 1
     87  decodeURIComponent    globalFuncDecodeURIComponent    DontEnum|Function 1
     88  encodeURI             globalFuncEncodeURI             DontEnum|Function 1
     89  encodeURIComponent    globalFuncEncodeURIComponent    DontEnum|Function 1
     90@end
     91*/
    7292
    7393ASSERT_CLASS_FITS_IN_CELL(JSGlobalObject);
     
    167187{
    168188    ExecState* exec = JSGlobalObject::globalExec();
    169 
    170     // Prototypes
    171189
    172190    m_functionPrototype.set(exec->globalData(), this, new (exec) FunctionPrototype(exec, this, FunctionPrototype::createStructure(exec->globalData(), jsNull()))); // The real prototype will be set once ObjectPrototype is created.
     
    178196    m_callFunction.set(exec->globalData(), this, callFunction);
    179197    m_applyFunction.set(exec->globalData(), this, applyFunction);
    180     m_objectPrototype.set(exec->globalData(), this, new (exec) ObjectPrototype(exec, this, ObjectPrototype::createStructure(exec->globalData(), jsNull()), m_functionStructure.get()));
     198    m_objectPrototype.set(exec->globalData(), this, new (exec) ObjectPrototype(exec, this, ObjectPrototype::createStructure(exec->globalData(), jsNull())));
    181199    m_functionPrototype->structure()->setPrototypeWithoutTransition(exec->globalData(), m_objectPrototype.get());
    182200
     
    196214    m_stringObjectStructure.set(exec->globalData(), this, StringObject::createStructure(exec->globalData(), m_stringPrototype.get()));
    197215
    198     m_booleanPrototype.set(exec->globalData(), this, new (exec) BooleanPrototype(exec, this, BooleanPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get()));
     216    m_booleanPrototype.set(exec->globalData(), this, new (exec) BooleanPrototype(exec, this, BooleanPrototype::createStructure(exec->globalData(), m_objectPrototype.get())));
    199217    m_booleanObjectStructure.set(exec->globalData(), this, BooleanObject::createStructure(exec->globalData(), m_booleanPrototype.get()));
    200218
    201     m_numberPrototype.set(exec->globalData(), this, new (exec) NumberPrototype(exec, this, NumberPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get()));
     219    m_numberPrototype.set(exec->globalData(), this, new (exec) NumberPrototype(exec, this, NumberPrototype::createStructure(exec->globalData(), m_objectPrototype.get())));
    202220    m_numberObjectStructure.set(exec->globalData(), this, NumberObject::createStructure(exec->globalData(), m_numberPrototype.get()));
    203221
     
    205223    m_dateStructure.set(exec->globalData(), this, DateInstance::createStructure(exec->globalData(), m_datePrototype.get()));
    206224
    207     m_regExpPrototype.set(exec->globalData(), this, new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get()));
     225    m_regExpPrototype.set(exec->globalData(), this, new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(exec->globalData(), m_objectPrototype.get())));
    208226    m_regExpStructure.set(exec->globalData(), this, RegExpObject::createStructure(exec->globalData(), m_regExpPrototype.get()));
    209227
    210228    m_methodCallDummy.set(exec->globalData(), this, constructEmptyObject(exec));
    211229
    212     ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, this, ErrorPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), m_functionStructure.get());
     230    ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, this, ErrorPrototype::createStructure(exec->globalData(), m_objectPrototype.get()));
    213231    m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), errorPrototype));
    214232
     
    217235    JSCell* objectConstructor = new (exec) ObjectConstructor(exec, this, ObjectConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_objectPrototype.get());
    218236    JSCell* functionConstructor = new (exec) FunctionConstructor(exec, this, FunctionConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_functionPrototype.get());
    219     JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, this, ArrayConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_arrayPrototype.get(), m_functionStructure.get());
    220     JSCell* stringConstructor = new (exec) StringConstructor(exec, this, StringConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_functionStructure.get(), m_stringPrototype.get());
     237    JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, this, ArrayConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_arrayPrototype.get());
     238    JSCell* stringConstructor = new (exec) StringConstructor(exec, this, StringConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_stringPrototype.get());
    221239    JSCell* booleanConstructor = new (exec) BooleanConstructor(exec, this, BooleanConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_booleanPrototype.get());
    222240    JSCell* numberConstructor = new (exec) NumberConstructor(exec, this, NumberConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_numberPrototype.get());
    223     JSCell* dateConstructor = new (exec) DateConstructor(exec, this, DateConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_functionStructure.get(), m_datePrototype.get());
     241    JSCell* dateConstructor = new (exec) DateConstructor(exec, this, DateConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_datePrototype.get());
    224242
    225243    m_regExpConstructor.set(exec->globalData(), this, new (exec) RegExpConstructor(exec, this, RegExpConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_regExpPrototype.get()));
     
    245263    m_regExpPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_regExpConstructor.get(), DontEnum);
    246264    errorPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_errorConstructor.get(), DontEnum);
    247 
    248     // Set global constructors
    249 
    250     // FIXME: These properties could be handled by a static hash table.
    251265
    252266    putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Object"), objectConstructor, DontEnum);
     
    266280    putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "URIError"), m_URIErrorConstructor.get(), DontEnum);
    267281
    268     // Set global values.
     282    m_evalFunction.set(exec->globalData(), this, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, exec->propertyNames().eval, globalFuncEval));
     283    putDirectFunctionWithoutTransition(exec, m_evalFunction.get(), DontEnum);
     284
    269285    GlobalPropertyInfo staticGlobals[] = {
    270286        GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, this, MathObject::createStructure(exec->globalData(), m_objectPrototype.get())), DontEnum | DontDelete),
     
    274290        GlobalPropertyInfo(Identifier(exec, "JSON"), new (exec) JSONObject(this, JSONObject::createStructure(exec->globalData(), m_objectPrototype.get())), DontEnum | DontDelete)
    275291    };
    276 
    277292    addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
    278 
    279     // Set global functions.
    280 
    281     m_evalFunction.set(exec->globalData(), this, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, exec->propertyNames().eval, globalFuncEval));
    282     putDirectFunctionWithoutTransition(exec, m_evalFunction.get(), DontEnum);
    283     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
    284     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
    285     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
    286     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
    287     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
    288     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
    289     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
    290     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
    291     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
    292     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);
    293 #ifndef NDEBUG
    294     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, Identifier(exec, "jscprint"), globalFuncJSCPrint), DontEnum);
    295 #endif
    296293
    297294    resetPrototype(exec->globalData(), prototype);
     
    445442}
    446443
     444void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count)
     445{
     446    size_t oldSize = m_registerArraySize;
     447    size_t newSize = oldSize + count;
     448    OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[newSize]);
     449    if (m_registerArray) {
     450        // memcpy is safe here as we're copying barriers we already own from the existing array
     451        memcpy(registerArray.get() + count, m_registerArray.get(), oldSize * sizeof(Register));
     452    }
     453
     454    WriteBarrier<Unknown>* registers = registerArray.get() + newSize;
     455    setRegisters(registers, registerArray.release(), newSize);
     456
     457    for (int i = 0, index = -static_cast<int>(oldSize) - 1; i < count; ++i, --index) {
     458        GlobalPropertyInfo& global = globals[i];
     459        ASSERT(global.attributes & DontDelete);
     460        SymbolTableEntry newEntry(index, global.attributes);
     461        symbolTable().add(global.identifier.impl(), newEntry);
     462        registerAt(index).set(globalData(), this, global.value);
     463    }
     464}
     465
     466bool JSGlobalObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
     467{
     468    if (getStaticFunctionSlot<JSVariableObject>(exec, ExecState::globalObjectTable(exec), this, propertyName, slot))
     469        return true;
     470    return symbolTableGet(propertyName, slot);
     471}
     472
     473bool JSGlobalObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
     474{
     475    if (getStaticFunctionDescriptor<JSVariableObject>(exec, ExecState::globalObjectTable(exec), this, propertyName, descriptor))
     476        return true;
     477    return symbolTableGet(propertyName, descriptor);
     478}
     479
    447480void JSGlobalObject::WeakMapsFinalizer::finalize(Handle<Unknown> handle, void*)
    448481{
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r86657 r86727  
    149149        }
    150150
     151        static JS_EXPORTDATA const ClassInfo s_info;
     152
    151153    protected:
    152154        JSGlobalObject(JSGlobalData& globalData, Structure* structure, JSObject* thisValue)
     
    318320    }
    319321
    320     inline void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count)
    321     {
    322         size_t oldSize = m_registerArraySize;
    323         size_t newSize = oldSize + count;
    324         OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[newSize]);
    325         if (m_registerArray) {
    326             // memcpy is safe here as we're copying barriers we already own from the existing array
    327             memcpy(registerArray.get() + count, m_registerArray.get(), oldSize * sizeof(Register));
    328         }
    329 
    330         WriteBarrier<Unknown>* registers = registerArray.get() + newSize;
    331         setRegisters(registers, registerArray.release(), newSize);
    332 
    333         for (int i = 0, index = -static_cast<int>(oldSize) - 1; i < count; ++i, --index) {
    334             GlobalPropertyInfo& global = globals[i];
    335             ASSERT(global.attributes & DontDelete);
    336             SymbolTableEntry newEntry(index, global.attributes);
    337             symbolTable().add(global.identifier.impl(), newEntry);
    338             registerAt(index).set(globalData(), this, global.value);
    339         }
    340     }
    341 
    342     inline bool JSGlobalObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    343     {
    344         if (JSVariableObject::getOwnPropertySlot(exec, propertyName, slot))
    345             return true;
    346         return symbolTableGet(propertyName, slot);
    347     }
    348 
    349     inline bool JSGlobalObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
    350     {
    351         if (symbolTableGet(propertyName, descriptor))
    352             return true;
    353         return JSVariableObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
    354     }
    355 
    356322    inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, const Identifier& propertyName)
    357323    {
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r86657 r86727  
    588588}
    589589
    590 #ifndef NDEBUG
    591 EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec)
    592 {
    593     CString string = exec->argument(0).toString(exec).utf8();
    594     puts(string.data());
    595     return JSValue::encode(jsUndefined());
    596 }
    597 #endif
    598 
    599590} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h

    r86657 r86727  
    4848    EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState*);
    4949    EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState*);
    50 #ifndef NDEBUG
    51     EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState*);
    52 #endif
    5350
    5451    static const double mantissaOverflowLowerBound = 9007199254740992.0;
  • trunk/Source/JavaScriptCore/runtime/MathObject.cpp

    r86657 r86727  
    5959
    6060namespace JSC {
    61 
    62 // ------------------------------ MathObject --------------------------------
    6361
    6462const ClassInfo MathObject::s_info = { "Math", &JSObjectWithGlobalObject::s_info, 0, ExecState::mathTable };
     
    102100}
    103101
    104 // ECMA 15.8
    105 
    106102bool MathObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
    107103{
  • trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000,2003 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    4343namespace JSC {
    4444
    45 const ClassInfo NumberConstructor::s_info = { "Function", &InternalFunction::s_info, 0, ExecState::numberTable };
     45const ClassInfo NumberConstructor::s_info = { "Function", &InternalFunction::s_info, 0, ExecState::numberConstructorTable };
    4646
    4747/* Source for NumberConstructor.lut.h
    48 @begin numberTable
     48@begin numberConstructorTable
    4949   NaN                   numberConstructorNaNValue       DontEnum|DontDelete|ReadOnly
    5050   NEGATIVE_INFINITY     numberConstructorNegInfinity    DontEnum|DontDelete|ReadOnly
     
    6969bool NumberConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    7070{
    71     return getStaticValueSlot<NumberConstructor, InternalFunction>(exec, ExecState::numberTable(exec), this, propertyName, slot);
     71    return getStaticValueSlot<NumberConstructor, InternalFunction>(exec, ExecState::numberConstructorTable(exec), this, propertyName, slot);
    7272}
    7373
    7474bool NumberConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
    7575{
    76     return getStaticValueDescriptor<NumberConstructor, InternalFunction>(exec, ExecState::numberTable(exec), this, propertyName, descriptor);
     76    return getStaticValueDescriptor<NumberConstructor, InternalFunction>(exec, ExecState::numberConstructorTable(exec), this, propertyName, descriptor);
    7777}
    7878
  • trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000,2003 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    3535namespace JSC {
    3636
    37 ASSERT_CLASS_FITS_IN_CELL(NumberPrototype);
    38 
    3937static EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(ExecState*);
    4038static EncodedJSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState*);
     
    4442static EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*);
    4543
    46 // ECMA 15.7.4
    47 
    48 NumberPrototype::NumberPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure)
     44}
     45
     46#include "NumberPrototype.lut.h"
     47
     48namespace JSC {
     49
     50const ClassInfo NumberPrototype::s_info = { "Number", &NumberObject::s_info, 0, ExecState::numberPrototypeTable };
     51
     52/* Source for NumberPrototype.lut.h
     53@begin numberPrototypeTable
     54  toString          numberProtoFuncToString         DontEnum|Function 1
     55  toLocaleString    numberProtoFuncToLocaleString   DontEnum|Function 0
     56  valueOf           numberProtoFuncValueOf          DontEnum|Function 0
     57  toFixed           numberProtoFuncToFixed          DontEnum|Function 1
     58  toExponential     numberProtoFuncToExponential    DontEnum|Function 1
     59  toPrecision       numberProtoFuncToPrecision      DontEnum|Function 1
     60@end
     61*/
     62
     63ASSERT_CLASS_FITS_IN_CELL(NumberPrototype);
     64
     65NumberPrototype::NumberPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
    4966    : NumberObject(exec->globalData(), structure)
    5067{
    5168    setInternalValue(exec->globalData(), jsNumber(0));
    5269
    53     // The constructor will be added later, after NumberConstructor has been constructed
    54 
    55     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
    56     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
    57     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
    58     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
    59     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
    60     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
     70    ASSERT(inherits(&s_info));
     71    putAnonymousValue(globalObject->globalData(), 0, globalObject);
     72}
     73
     74bool NumberPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
     75{
     76    return getStaticFunctionSlot<NumberObject>(exec, ExecState::numberPrototypeTable(exec), this, propertyName, slot);
     77}
     78
     79bool NumberPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
     80{
     81    return getStaticFunctionDescriptor<NumberObject>(exec, ExecState::numberPrototypeTable(exec), this, propertyName, descriptor);
    6182}
    6283
    6384// ------------------------------ Functions ---------------------------
    64 
    65 // ECMA 15.7.4.2 - 15.7.4.7
    6685
    6786static ALWAYS_INLINE bool toThisNumber(JSValue thisValue, double &x)
  • trunk/Source/JavaScriptCore/runtime/NumberPrototype.h

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2008, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    2828    class NumberPrototype : public NumberObject {
    2929    public:
    30         NumberPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure);
     30        NumberPrototype(ExecState*, JSGlobalObject*, Structure*);
     31
     32        static const ClassInfo s_info;
     33
     34        static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
     35        {
     36            return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
     37        }
     38
     39    protected:
     40        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NumberObject::StructureFlags;
     41        static const unsigned AnonymousSlotCount = NumberObject::AnonymousSlotCount + 1;
     42
     43    private:
     44        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     45        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    3146    };
    3247
  • trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2008, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    2929namespace JSC {
    3030
    31 ASSERT_CLASS_FITS_IN_CELL(ObjectPrototype);
    32 
    3331static EncodedJSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState*);
    3432static EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState*);
     
    4139static EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*);
    4240
    43 ObjectPrototype::ObjectPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* stucture, Structure* functionStructure)
     41}
     42
     43#include "ObjectPrototype.lut.h"
     44
     45namespace JSC {
     46
     47const ClassInfo ObjectPrototype::s_info = { "Object", &JSNonFinalObject::s_info, 0, ExecState::objectPrototypeTable };
     48
     49/* Source for ObjectPrototype.lut.h
     50@begin objectPrototypeTable
     51  toString              objectProtoFuncToString                 DontEnum|Function 0
     52  toLocaleString        objectProtoFuncToLocaleString           DontEnum|Function 0
     53  valueOf               objectProtoFuncValueOf                  DontEnum|Function 0
     54  hasOwnProperty        objectProtoFuncHasOwnProperty           DontEnum|Function 1
     55  propertyIsEnumerable  objectProtoFuncPropertyIsEnumerable     DontEnum|Function 1
     56  isPrototypeOf         objectProtoFuncIsPrototypeOf            DontEnum|Function 1
     57  __defineGetter__      objectProtoFuncDefineGetter             DontEnum|Function 2
     58  __defineSetter__      objectProtoFuncDefineSetter             DontEnum|Function 2
     59  __lookupGetter__      objectProtoFuncLookupGetter             DontEnum|Function 1
     60  __lookupSetter__      objectProtoFuncLookupSetter             DontEnum|Function 1
     61@end
     62*/
     63
     64ASSERT_CLASS_FITS_IN_CELL(ObjectPrototype);
     65
     66ObjectPrototype::ObjectPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* stucture)
    4467    : JSNonFinalObject(exec->globalData(), stucture)
    4568    , m_hasNoPropertiesWithUInt32Names(true)
    4669{
    47     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
    48     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
    49     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
    50     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
    51     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
    52     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
    53 
    54     // Mozilla extensions
    55     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
    56     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
    57     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
    58     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
     70    ASSERT(inherits(&s_info));
     71    putAnonymousValue(globalObject->globalData(), 0, globalObject);
    5972}
    6073
    6174void ObjectPrototype::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
    6275{
    63     JSObject::put(exec, propertyName, value, slot);
     76    JSNonFinalObject::put(exec, propertyName, value, slot);
    6477
    6578    if (m_hasNoPropertiesWithUInt32Names) {
     
    7487    if (m_hasNoPropertiesWithUInt32Names)
    7588        return false;
    76     return JSObject::getOwnPropertySlot(exec, propertyName, slot);
     89    return JSNonFinalObject::getOwnPropertySlot(exec, propertyName, slot);
     90}
     91
     92bool ObjectPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
     93{
     94    return getStaticFunctionSlot<JSNonFinalObject>(exec, ExecState::objectPrototypeTable(exec), this, propertyName, slot);
     95}
     96
     97bool ObjectPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
     98{
     99    return getStaticFunctionDescriptor<JSNonFinalObject>(exec, ExecState::objectPrototypeTable(exec), this, propertyName, descriptor);
    77100}
    78101
    79102// ------------------------------ Functions --------------------------------
    80 
    81 // ECMA 15.2.4.2, 15.2.4.4, 15.2.4.5, 15.2.4.7
    82103
    83104EncodedJSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState* exec)
  • trunk/Source/JavaScriptCore/runtime/ObjectPrototype.h

    r86657 r86727  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2008 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2008, 2011 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    2828    class ObjectPrototype : public JSNonFinalObject {
    2929    public:
    30         ObjectPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure);
     30        ObjectPrototype(ExecState*, JSGlobalObject*, Structure*);
     31
     32        static const ClassInfo s_info;
     33
     34        static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
     35        {
     36            return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
     37        }
     38
     39    protected:
     40        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSNonFinalObject::StructureFlags;
     41        static const unsigned AnonymousSlotCount = JSNonFinalObject::AnonymousSlotCount + 1;
    3142
    3243    private:
    3344        virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
     45        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    3446        virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
     47        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    3548
    3649        bool m_hasNoPropertiesWithUInt32Names;
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp

    r86657 r86727  
    3939namespace JSC {
    4040
    41 ASSERT_CLASS_FITS_IN_CELL(RegExpPrototype);
    42 
    4341static EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState*);
    4442static EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState*);
     
    4644static EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*);
    4745
    48 // ECMA 15.10.5
     46}
    4947
    50 RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure)
     48#include "RegExpPrototype.lut.h"
     49
     50namespace JSC {
     51
     52const ClassInfo RegExpPrototype::s_info = { "RegExp", &RegExpObject::s_info, 0, ExecState::regExpPrototypeTable };
     53
     54/* Source for RegExpPrototype.lut.h
     55@begin regExpPrototypeTable
     56  compile   regExpProtoFuncCompile      DontEnum|Function 2
     57  exec      regExpProtoFuncExec         DontEnum|Function 1
     58  test      regExpProtoFuncTest         DontEnum|Function 1
     59  toString  regExpProtoFuncToString     DontEnum|Function 0
     60@end
     61*/
     62
     63ASSERT_CLASS_FITS_IN_CELL(RegExpPrototype);
     64
     65RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
    5166    : RegExpObject(globalObject, structure, RegExp::create(&exec->globalData(), "", NoFlags))
    5267{
    53     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 2, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
    54     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
    55     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
    56     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
     68}
     69
     70bool RegExpPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
     71{
     72    return getStaticFunctionSlot<RegExpObject>(exec, ExecState::regExpPrototypeTable(exec), this, propertyName, slot);
     73}
     74
     75bool RegExpPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
     76{
     77    return getStaticFunctionDescriptor<RegExpObject>(exec, ExecState::regExpPrototypeTable(exec), this, propertyName, descriptor);
    5778}
    5879
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.h

    r86657 r86727  
    2929    class RegExpPrototype : public RegExpObject {
    3030    public:
    31         RegExpPrototype(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure);
     31        RegExpPrototype(ExecState*, JSGlobalObject*, Structure*);
     32
     33        static const ClassInfo s_info;
     34
     35        static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
     36        {
     37            return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
     38        }
     39
     40    protected:
     41        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | RegExpObject::StructureFlags;
     42
     43    private:
     44        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     45        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    3246    };
    3347
  • trunk/Source/JavaScriptCore/runtime/StringConstructor.cpp

    r86657 r86727  
    3030namespace JSC {
    3131
     32static EncodedJSValue JSC_HOST_CALL stringFromCharCode(ExecState*);
     33
     34}
     35
     36#include "StringConstructor.lut.h"
     37
     38namespace JSC {
     39
     40const ClassInfo StringConstructor::s_info = { "Function", &InternalFunction::s_info, 0, ExecState::stringConstructorTable };
     41
     42/* Source for StringConstructor.lut.h
     43@begin stringConstructorTable
     44  fromCharCode          stringFromCharCode         DontEnum|Function 1
     45@end
     46*/
     47
     48ASSERT_CLASS_FITS_IN_CELL(StringConstructor);
     49
     50StringConstructor::StringConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, StringPrototype* stringPrototype)
     51    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, stringPrototype->classInfo()->className))
     52{
     53    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete);
     54    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
     55}
     56
     57bool StringConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
     58{
     59    return getStaticFunctionSlot<InternalFunction>(exec, ExecState::stringConstructorTable(exec), this, propertyName, slot);
     60}
     61
     62bool StringConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
     63{
     64    return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::stringConstructorTable(exec), this, propertyName, descriptor);
     65}
     66
     67// ------------------------------ Functions --------------------------------
     68
    3269static NEVER_INLINE JSValue stringFromCharCodeSlowCase(ExecState* exec)
    3370{
     
    4784}
    4885
    49 ASSERT_CLASS_FITS_IN_CELL(StringConstructor);
    50 
    51 StringConstructor::StringConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* functionStructure, StringPrototype* stringPrototype)
    52     : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, stringPrototype->classInfo()->className))
    53 {
    54     // ECMA 15.5.3.1 String.prototype
    55     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete);
    56 
    57     // ECMA 15.5.3.2 fromCharCode()
    58 #if ENABLE(JIT) && ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
    59     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().fromCharCode, exec->globalData().getHostFunction(stringFromCharCode, fromCharCodeThunkGenerator)), DontEnum);
    60 #else
    61     putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);
    62 #endif
    63     // no. of arguments for constructor
    64     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
    65 }
    66 
    67 // ECMA 15.5.2
    6886static EncodedJSValue JSC_HOST_CALL constructWithStringConstructor(ExecState* exec)
    6987{
     
    8098}
    8199
    82 // ECMA 15.5.1
    83100static EncodedJSValue JSC_HOST_CALL callStringConstructor(ExecState* exec)
    84101{
  • trunk/Source/JavaScriptCore/runtime/StringConstructor.h

    r86657 r86727  
    3030    class StringConstructor : public InternalFunction {
    3131    public:
    32         StringConstructor(ExecState*, JSGlobalObject*, Structure*, Structure* functionStructure, StringPrototype*);
     32        StringConstructor(ExecState*, JSGlobalObject*, Structure*, StringPrototype*);
    3333
     34        static const ClassInfo s_info;
     35
     36        static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
     37        {
     38            return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
     39        }
     40
     41    protected:
     42        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
     43
     44    private:
    3445        virtual ConstructType getConstructData(ConstructData&);
    3546        virtual CallType getCallData(CallData&);
     47
     48        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     49        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    3650    };
    3751
Note: See TracChangeset for help on using the changeset viewer.