Changeset 60117 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- May 24, 2010, 8:04:43 PM (15 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/ExceptionHelpers.cpp
r60105 r60117 183 183 JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error, unsigned bytecodeOffset, CodeBlock* codeBlock) 184 184 { 185 // Both op_c onstructand op_instanceof require a use of op_get_by_id to get185 // Both op_create_this and op_instanceof require a use of op_get_by_id to get 186 186 // the prototype property from an object. The exception messages for exceptions 187 187 // thrown by these instances op_get_by_id need to reflect this. 188 188 OpcodeID followingOpcodeID; 189 189 if (codeBlock->getByIdExceptionInfoForBytecodeOffset(exec, bytecodeOffset, followingOpcodeID)) { 190 ASSERT(followingOpcodeID == op_c onstruct|| followingOpcodeID == op_instanceof);191 if (followingOpcodeID == op_c onstruct)190 ASSERT(followingOpcodeID == op_create_this || followingOpcodeID == op_instanceof); 191 if (followingOpcodeID == op_create_this) 192 192 return createNotAConstructorError(exec, error->isNull() ? jsNull() : jsUndefined(), bytecodeOffset, codeBlock); 193 193 return createInvalidParamError(exec, "instanceof", error->isNull() ? jsNull() : jsUndefined(), bytecodeOffset, codeBlock); -
trunk/JavaScriptCore/runtime/Executable.h
r60105 r60117 94 94 friend class JIT; 95 95 public: 96 static PassRefPtr<NativeExecutable> create(MacroAssemblerCodePtr thunk, NativeFunction function)97 { 98 return adoptRef(new NativeExecutable(JITCode::HostFunction( thunk), function));96 static PassRefPtr<NativeExecutable> create(MacroAssemblerCodePtr callThunk, NativeFunction function, MacroAssemblerCodePtr constructThunk, NativeFunction constructor) 97 { 98 return adoptRef(new NativeExecutable(JITCode::HostFunction(callThunk), function, JITCode::HostFunction(constructThunk), constructor)); 99 99 } 100 100 … … 104 104 105 105 private: 106 NativeExecutable(JITCode thunk, NativeFunction function)106 NativeExecutable(JITCode callThunk, NativeFunction function, JITCode constructThunk, NativeFunction constructor) 107 107 : ExecutableBase(NUM_PARAMETERS_IS_HOST) 108 108 , m_function(function) 109 { 110 m_jitCodeForCall = thunk; 111 m_jitCodeForConstruct = thunk; 109 , m_constructor(constructor) 110 { 111 m_jitCodeForCall = callThunk; 112 m_jitCodeForConstruct = constructThunk; 112 113 } 113 114 114 115 NativeFunction m_function; 116 // Probably should be a NativeConstructor, but this will currently require rewriting the JIT 117 // trampoline. It may be easier to make NativeFunction be passed 'this' as a part of the ArgList. 118 NativeFunction m_constructor; 115 119 }; 116 120 #endif -
trunk/JavaScriptCore/runtime/JSFunction.cpp
r60105 r60117 29 29 #include "CommonIdentifiers.h" 30 30 #include "CallFrame.h" 31 #include "ExceptionHelpers.h" 31 32 #include "FunctionPrototype.h" 32 33 #include "JSGlobalObject.h" … … 41 42 42 43 namespace JSC { 44 45 JSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec, JSObject* constructor, JSValue, const ArgList&) 46 { 47 CodeBlock* codeBlock = exec->callerFrame()->codeBlock(); 48 unsigned vPCIndex = codeBlock->bytecodeOffset(exec, exec->returnPC()); 49 exec->setException(createNotAConstructorError(exec, constructor, vPCIndex, codeBlock)); 50 return JSValue(); 51 } 43 52 44 53 ASSERT_CLASS_FITS_IN_CELL(JSFunction); -
trunk/JavaScriptCore/runtime/JSFunction.h
r60105 r60117 35 35 class JSGlobalObject; 36 36 class NativeExecutable; 37 38 JSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*, JSObject*, JSValue, const ArgList&); 37 39 38 40 class JSFunction : public JSObjectWithGlobalObject {
Note:
See TracChangeset
for help on using the changeset viewer.