Changeset 36802 in webkit for trunk/JavaScriptCore/VM/Machine.cpp
- Timestamp:
- Sep 23, 2008, 12:46:55 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Machine.cpp
r36766 r36802 4293 4293 { 4294 4294 ExecState* exec = ARG_exec; 4295 JSValue* value = ARG_src1; 4295 4296 JSValue* baseVal = ARG_src2; 4296 4297 JSValue* proto = ARG_src3; 4298 4299 if (UNLIKELY(JSImmediate::isAnyImmediate(value, baseVal, proto))) 4300 goto slow_cases; 4301 4302 JSCell* valueCell = static_cast<JSCell*>(value); 4303 JSCell* baseCell = static_cast<JSCell*>(baseVal); 4304 JSCell* protoCell = static_cast<JSCell*>(proto); 4305 4306 if (UNLIKELY(!valueCell->isObject() | !baseCell->isObject() | !protoCell->isObject())) 4307 goto slow_cases; 4308 4309 if (UNLIKELY((baseCell->structureID()->typeInfo().flags() & (ImplementsHasInstance | OverridesHasInstance)) != ImplementsHasInstance)) 4310 goto slow_cases; 4311 4312 JSObject* testPrototype = static_cast<JSObject*>(static_cast<JSObject*>(valueCell)->prototype()); 4313 4314 if (testPrototype == proto) 4315 return jsBoolean(true); 4316 4317 while (testPrototype != jsNull()) { 4318 testPrototype = static_cast<JSObject*>(testPrototype->prototype()); 4319 if (testPrototype == proto) 4320 return jsBoolean(true); 4321 } 4322 4323 return jsBoolean(false); 4324 4325 slow_cases: 4297 4326 if (!baseVal->isObject()) { 4298 4327 CodeBlock* codeBlock = ARG_codeBlock; … … 4303 4332 } 4304 4333 4305 JSObject* baseObj = static_cast<JSObject*>(baseVal); 4306 JSValue* basePrototype = ARG_src3; 4307 JSValue* result = jsBoolean(baseObj->structureID()->typeInfo().implementsHasInstance() ? baseObj->hasInstance(exec, ARG_src1, basePrototype) : false); 4334 baseCell = static_cast<JSCell*>(baseVal); 4335 if (!baseCell->structureID()->typeInfo().implementsHasInstance()) 4336 return jsBoolean(false); 4337 4338 if (!proto->isObject()) { 4339 throwError(exec, TypeError, "instanceof called on an object with an invalid prototype property."); 4340 VM_CHECK_EXCEPTION(JSValue*); 4341 } 4342 4343 if (!value->isObject()) 4344 return jsBoolean(false); 4345 4346 ASSERT(baseCell->structureID()->typeInfo().implementsHasInstance()); 4347 4348 JSValue* result = jsBoolean(static_cast<JSObject*>(baseCell)->hasInstance(exec, value, proto)); 4308 4349 VM_CHECK_EXCEPTION_AT_END(); 4350 4309 4351 return result; 4310 4352 }
Note:
See TracChangeset
for help on using the changeset viewer.