Ignore:
Timestamp:
Jun 28, 2008, 2:22:01 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-06-28 Sam Weinig <[email protected]>

Rubber-stamped by Oliver Hunt.

Splits FunctionConstructor out of FunctionPrototype.h/cpp
Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp
Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor.

  • API/JSCallbackConstructor.cpp:
  • API/JSClassRef.cpp:
  • API/JSObjectRef.cpp:
  • DerivedSources.make:
  • GNUmakefile.am:
  • JavaScriptCore.pri:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • JavaScriptCoreSources.bkl:
  • VM/Machine.cpp:
  • kjs/AllInOneFile.cpp:
  • kjs/ArrayConstructor.cpp:
  • kjs/ArrayConstructor.h:
  • kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp.
  • kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h.
  • kjs/FunctionPrototype.cpp:
  • kjs/FunctionPrototype.h:
  • kjs/JSFunction.cpp:
  • kjs/JSGlobalObject.cpp:
  • kjs/JSImmediate.cpp:
  • kjs/MathObject.h:
  • kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
  • kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h.
  • kjs/NumberObject.cpp:
  • kjs/NumberObject.h:
  • kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
  • kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h.
  • kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
  • kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h.
  • kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
  • kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h.
  • kjs/RegExpObject.h:
  • kjs/Shell.cpp:
  • kjs/error_object.h:
  • kjs/internal.cpp:
  • kjs/nodes.cpp:
  • kjs/object_object.cpp: Removed.
  • kjs/object_object.h: Removed.
  • kjs/string_object.h:

WebCore:

2008-06-28 Sam Weinig <[email protected]>

Rubber-stamped by Oliver Hunt.

Update includes after remaming object_object.h to ObjectPrototype.h and
splitting FunctionConstructor out of FunctionPrototype.h

  • ForwardingHeaders/kjs/FunctionConstructor.h: Added.
  • ForwardingHeaders/kjs/ObjectPrototype.h: Copied from WebCore/ForwardingHeaders/kjs/object_object.h.
  • ForwardingHeaders/kjs/object_object.h: Removed.
  • bindings/js/JSEventListener.cpp:
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/qt/qt_instance.cpp:
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/ObjectConstructor.cpp

    r34853 r34854  
    2020
    2121#include "config.h"
    22 #include "object_object.h"
     22#include "ObjectConstructor.h"
    2323
    2424#include "JSGlobalObject.h"
    25 #include "operations.h"
    2625#include "FunctionPrototype.h"
    27 #include <stdio.h>
    2826
    2927namespace KJS {
    30 
    31 // ------------------------------ ObjectPrototype --------------------------------
    32 
    33 static JSValue* objectProtoFuncValueOf(ExecState*, JSObject*, JSValue*, const ArgList&);
    34 static JSValue* objectProtoFuncHasOwnProperty(ExecState*, JSObject*, JSValue*, const ArgList&);
    35 static JSValue* objectProtoFuncIsPrototypeOf(ExecState*, JSObject*, JSValue*, const ArgList&);
    36 static JSValue* objectProtoFuncDefineGetter(ExecState*, JSObject*, JSValue*, const ArgList&);
    37 static JSValue* objectProtoFuncDefineSetter(ExecState*, JSObject*, JSValue*, const ArgList&);
    38 static JSValue* objectProtoFuncLookupGetter(ExecState*, JSObject*, JSValue*, const ArgList&);
    39 static JSValue* objectProtoFuncLookupSetter(ExecState*, JSObject*, JSValue*, const ArgList&);
    40 static JSValue* objectProtoFuncPropertyIsEnumerable(ExecState*, JSObject*, JSValue*, const ArgList&);
    41 static JSValue* objectProtoFuncToLocaleString(ExecState*, JSObject*, JSValue*, const ArgList&);
    42 
    43 ObjectPrototype::ObjectPrototype(ExecState* exec, FunctionPrototype* functionPrototype)
    44     : JSObject() // [[Prototype]] is null
    45 {
    46     putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
    47     putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
    48     putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
    49     putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
    50     putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
    51     putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
    52 
    53     // Mozilla extensions
    54     putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
    55     putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
    56     putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
    57     putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
    58 }
    59 
    60 
    61 // ------------------------------ Functions --------------------------------
    62 
    63 // ECMA 15.2.4.2, 15.2.4.4, 15.2.4.5, 15.2.4.7
    64 
    65 JSValue* objectProtoFuncValueOf(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
    66 {
    67     return thisValue->toThisObject(exec);
    68 }
    69 
    70 JSValue* objectProtoFuncHasOwnProperty(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
    71 {
    72     return jsBoolean(thisValue->toThisObject(exec)->hasOwnProperty(exec, Identifier(exec, args[0]->toString(exec))));
    73 }
    74 
    75 JSValue* objectProtoFuncIsPrototypeOf(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
    76 {
    77     JSObject* thisObj = thisValue->toThisObject(exec);
    78 
    79     if (!args[0]->isObject())
    80         return jsBoolean(false);
    81 
    82     JSValue* v = static_cast<JSObject*>(args[0])->prototype();
    83 
    84     while (true) {
    85         if (!v->isObject())
    86             return jsBoolean(false);
    87         if (thisObj == v)
    88 
    89             return jsBoolean(true);
    90         v = static_cast<JSObject*>(v)->prototype();
    91     }
    92 }
    93 
    94 JSValue* objectProtoFuncDefineGetter(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
    95 {
    96     CallData callData;
    97     if (args[1]->getCallData(callData) == CallTypeNone)
    98         return throwError(exec, SyntaxError, "invalid getter usage");
    99     thisValue->toThisObject(exec)->defineGetter(exec, Identifier(exec, args[0]->toString(exec)), static_cast<JSObject*>(args[1]));
    100     return jsUndefined();
    101 }
    102 
    103 JSValue* objectProtoFuncDefineSetter(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
    104 {
    105     CallData callData;
    106     if (args[1]->getCallData(callData) == CallTypeNone)
    107         return throwError(exec, SyntaxError, "invalid setter usage");
    108     thisValue->toThisObject(exec)->defineSetter(exec, Identifier(exec, args[0]->toString(exec)), static_cast<JSObject*>(args[1]));
    109     return jsUndefined();
    110 }
    111 
    112 JSValue* objectProtoFuncLookupGetter(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
    113 {
    114     return thisValue->toThisObject(exec)->lookupGetter(exec, Identifier(exec, args[0]->toString(exec)));
    115 }
    116 
    117 JSValue* objectProtoFuncLookupSetter(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
    118 {
    119     return thisValue->toThisObject(exec)->lookupSetter(exec, Identifier(exec, args[0]->toString(exec)));
    120 }
    121 
    122 JSValue* objectProtoFuncPropertyIsEnumerable(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
    123 {
    124     return jsBoolean(thisValue->toThisObject(exec)->propertyIsEnumerable(exec, Identifier(exec, args[0]->toString(exec))));
    125 }
    126 
    127 JSValue* objectProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
    128 {
    129     return jsString(exec, thisValue->toThisObject(exec)->toString(exec));
    130 }
    131 
    132 JSValue* objectProtoFuncToString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&)
    133 {
    134     return jsString(exec, "[object " + thisValue->toThisObject(exec)->className() + "]");
    135 }
    136 
    137 // ------------------------------ ObjectConstructor --------------------------------
    13828
    13929ObjectConstructor::ObjectConstructor(ExecState* exec, ObjectPrototype* objProto, FunctionPrototype* funcProto)
Note: See TracChangeset for help on using the changeset viewer.