Changeset 39265 in webkit for trunk/JavaScriptCore/runtime/ExceptionHelpers.cpp
- Timestamp:
- Dec 12, 2008, 7:03:07 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/ExceptionHelpers.cpp
r39255 r39265 88 88 } 89 89 90 JSValue* createUndefinedVariableError(ExecState* exec, const Identifier& ident, const Instruction* vPC, CodeBlock* codeBlock)91 { 92 int startOffset = 0; 93 int endOffset = 0; 94 int divotPoint = 0; 95 int line = codeBlock->expressionRangeForBytecodeOffset( vPC - codeBlock->instructions().begin(), divotPoint, startOffset, endOffset);90 JSValue* createUndefinedVariableError(ExecState* exec, const Identifier& ident, unsigned bytecodeOffset, CodeBlock* codeBlock) 91 { 92 int startOffset = 0; 93 int endOffset = 0; 94 int divotPoint = 0; 95 int line = codeBlock->expressionRangeForBytecodeOffset(bytecodeOffset, divotPoint, startOffset, endOffset); 96 96 UString message = "Can't find variable: "; 97 97 message.append(ident.ustring()); … … 149 149 } 150 150 151 JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue* value, const Instruction* vPC, CodeBlock* codeBlock)151 JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue* value, unsigned bytecodeOffset, CodeBlock* codeBlock) 152 152 { 153 153 UString message = "not a valid argument for '"; … … 158 158 int endOffset = 0; 159 159 int divotPoint = 0; 160 int line = codeBlock->expressionRangeForBytecodeOffset( vPC - codeBlock->instructions().begin(), divotPoint, startOffset, endOffset);160 int line = codeBlock->expressionRangeForBytecodeOffset(bytecodeOffset, divotPoint, startOffset, endOffset); 161 161 UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, message); 162 162 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); … … 167 167 } 168 168 169 JSObject* createNotAConstructorError(ExecState* exec, JSValue* value, const Instruction* vPC, CodeBlock* codeBlock)170 { 171 int startOffset = 0; 172 int endOffset = 0; 173 int divotPoint = 0; 174 int line = codeBlock->expressionRangeForBytecodeOffset( vPC - codeBlock->instructions().begin(), divotPoint, startOffset, endOffset);169 JSObject* createNotAConstructorError(ExecState* exec, JSValue* value, unsigned bytecodeOffset, CodeBlock* codeBlock) 170 { 171 int startOffset = 0; 172 int endOffset = 0; 173 int divotPoint = 0; 174 int line = codeBlock->expressionRangeForBytecodeOffset(bytecodeOffset, divotPoint, startOffset, endOffset); 175 175 176 176 // We're in a "new" expression, so we need to skip over the "new.." part … … 188 188 } 189 189 190 JSValue* createNotAFunctionError(ExecState* exec, JSValue* value, const Instruction* vPC, CodeBlock* codeBlock)191 { 192 int startOffset = 0; 193 int endOffset = 0; 194 int divotPoint = 0; 195 int line = codeBlock->expressionRangeForBytecodeOffset( vPC - codeBlock->instructions().begin(), divotPoint, startOffset, endOffset);190 JSValue* createNotAFunctionError(ExecState* exec, JSValue* value, unsigned bytecodeOffset, CodeBlock* codeBlock) 191 { 192 int startOffset = 0; 193 int endOffset = 0; 194 int divotPoint = 0; 195 int line = codeBlock->expressionRangeForBytecodeOffset(bytecodeOffset, divotPoint, startOffset, endOffset); 196 196 UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, value, "not a function"); 197 197 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); … … 207 207 } 208 208 209 JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error, const Instruction* vPC, CodeBlock* codeBlock)209 JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error, unsigned bytecodeOffset, CodeBlock* codeBlock) 210 210 { 211 211 // Both op_construct and op_instanceof require a use of op_get_by_id to get … … 213 213 // thrown by these instances op_get_by_id need to reflect this. 214 214 OpcodeID followingOpcodeID; 215 if (codeBlock->getByIdExceptionInfoForBytecodeOffset( vPC - codeBlock->instructions().begin(), followingOpcodeID)) {215 if (codeBlock->getByIdExceptionInfoForBytecodeOffset(bytecodeOffset, followingOpcodeID)) { 216 216 ASSERT(followingOpcodeID == op_construct || followingOpcodeID == op_instanceof); 217 217 if (followingOpcodeID == op_construct) 218 return createNotAConstructorError(exec, error->isNull() ? jsNull() : jsUndefined(), vPC, codeBlock);219 return createInvalidParamError(exec, "instanceof", error->isNull() ? jsNull() : jsUndefined(), vPC, codeBlock);220 } 221 222 int startOffset = 0; 223 int endOffset = 0; 224 int divotPoint = 0; 225 int line = codeBlock->expressionRangeForBytecodeOffset( vPC - codeBlock->instructions().begin(), divotPoint, startOffset, endOffset);218 return createNotAConstructorError(exec, error->isNull() ? jsNull() : jsUndefined(), bytecodeOffset, codeBlock); 219 return createInvalidParamError(exec, "instanceof", error->isNull() ? jsNull() : jsUndefined(), bytecodeOffset, codeBlock); 220 } 221 222 int startOffset = 0; 223 int endOffset = 0; 224 int divotPoint = 0; 225 int line = codeBlock->expressionRangeForBytecodeOffset(bytecodeOffset, divotPoint, startOffset, endOffset); 226 226 UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, error->isNull() ? jsNull() : jsUndefined(), "not an object"); 227 227 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
Note:
See TracChangeset
for help on using the changeset viewer.