Changeset 141509 in webkit
- Timestamp:
- Jan 31, 2013 5:12:22 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r141505 r141509 1 2013-01-31 Kentaro Hara <haraken@chromium.org> 2 3 [V8] Clean up Dictionary::get() by removing redundant FindInstanceInPrototypeChain() 4 https://bugs.webkit.org/show_bug.cgi?id=108443 5 6 Reviewed by Adam Barth. 7 8 In Dictionary::get(), wrapper->FindInstanceInPrototypeChain(V8XXX::GetTemplate()) 9 is unnecessary for DOM wrappers other than DOMWindow. For wrappers other than 10 DOMWindow, we can simply use V8XXX::HasInstance(wrapper). 11 12 Tests: fast/events/constructors/* 13 14 * bindings/v8/Dictionary.cpp: 15 (WebCore::Dictionary::get): 16 1 17 2013-01-31 Julien Chaffraix <jchaffraix@webkit.org> 2 18 -
trunk/Source/WebCore/bindings/v8/Dictionary.cpp
r141383 r141509 255 255 return false; 256 256 257 DOMWindow* source = 0; 257 // We need to handle a DOMWindow specially, because a DOMWindow wrapper 258 // exists on a prototype chain of v8Value. 259 value = 0; 258 260 if (v8Value->IsObject()) { 259 261 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 260 262 v8::Handle<v8::Object> window = wrapper->FindInstanceInPrototypeChain(V8DOMWindow::GetTemplate(m_isolate)); 261 263 if (!window.IsEmpty()) 262 source = V8DOMWindow::toNative(window); 263 } 264 value = source; 264 value = V8DOMWindow::toNative(window); 265 } 265 266 return true; 266 267 } … … 272 273 return false; 273 274 274 Storage* source = 0; 275 if (v8Value->IsObject()) { 276 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 277 v8::Handle<v8::Object> storage = wrapper->FindInstanceInPrototypeChain(V8Storage::GetTemplate(m_isolate)); 278 if (!storage.IsEmpty()) 279 source = V8Storage::toNative(storage); 280 } 281 value = source; 275 value = 0; 276 if (V8Storage::HasInstance(v8Value)) 277 value = V8Storage::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 282 278 return true; 283 279 } … … 335 331 return false; 336 332 337 Uint8Array* source = 0; 338 if (v8Value->IsObject()) { 339 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 340 v8::Handle<v8::Object> array = wrapper->FindInstanceInPrototypeChain(V8Uint8Array::GetTemplate(m_isolate)); 341 if (!array.IsEmpty()) 342 source = V8Uint8Array::toNative(array); 343 } 344 value = source; 333 value = 0; 334 if (V8Uint8Array::HasInstance(v8Value)) 335 value = V8Uint8Array::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 345 336 return true; 346 337 } … … 353 344 return false; 354 345 355 MediaKeyError* source = 0; 356 if (v8Value->IsObject()) { 357 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 358 v8::Handle<v8::Object> error = wrapper->FindInstanceInPrototypeChain(V8MediaKeyError::GetTemplate(m_isolate)); 359 if (!error.IsEmpty()) 360 source = V8MediaKeyError::toNative(error); 361 } 362 value = source; 346 value = 0; 347 if (V8MediaKeyError::HasInstance(v8Value)) 348 value = V8MediaKeyError::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 363 349 return true; 364 350 } … … 394 380 return false; 395 381 396 SpeechRecognitionError* source = 0; 397 if (v8Value->IsObject()) { 398 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 399 v8::Handle<v8::Object> speechRecognitionError = wrapper->FindInstanceInPrototypeChain(V8SpeechRecognitionError::GetTemplate(m_isolate)); 400 if (!speechRecognitionError.IsEmpty()) 401 source = V8SpeechRecognitionError::toNative(speechRecognitionError); 402 } 403 value = source; 382 value = 0; 383 if (V8SpeechRecognitionError::HasInstance(v8Value)) 384 value = V8SpeechRecognitionError::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 404 385 return true; 405 386 } … … 411 392 return false; 412 393 413 SpeechRecognitionResult* source = 0; 414 if (v8Value->IsObject()) { 415 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 416 v8::Handle<v8::Object> speechRecognitionResult = wrapper->FindInstanceInPrototypeChain(V8SpeechRecognitionResult::GetTemplate(m_isolate)); 417 if (!speechRecognitionResult.IsEmpty()) 418 source = V8SpeechRecognitionResult::toNative(speechRecognitionResult); 419 } 420 value = source; 394 value = 0; 395 if (V8SpeechRecognitionResult::HasInstance(v8Value)) 396 value = V8SpeechRecognitionResult::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 421 397 return true; 422 398 } … … 428 404 return false; 429 405 430 SpeechRecognitionResultList* source = 0; 431 if (v8Value->IsObject()) { 432 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 433 v8::Handle<v8::Object> speechRecognitionResultList = wrapper->FindInstanceInPrototypeChain(V8SpeechRecognitionResultList::GetTemplate(m_isolate)); 434 if (!speechRecognitionResultList.IsEmpty()) 435 source = V8SpeechRecognitionResultList::toNative(speechRecognitionResultList); 436 } 437 value = source; 406 value = 0; 407 if (V8SpeechRecognitionResultList::HasInstance(v8Value)) 408 value = V8SpeechRecognitionResultList::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 438 409 return true; 439 410 } … … 448 419 return false; 449 420 450 MediaStream* stream = 0; 451 if (v8Value->IsObject()) { 452 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 453 v8::Handle<v8::Object> error = wrapper->FindInstanceInPrototypeChain(V8MediaStream::GetTemplate(m_isolate)); 454 if (!error.IsEmpty()) 455 stream = V8MediaStream::toNative(error); 456 } 457 value = stream; 421 value = 0; 422 if (V8MediaStream::HasInstance(v8Value)) 423 value = V8MediaStream::toNative(v8::Handle<v8::Object>::Cast(v8Value)); 458 424 return true; 459 425 } … … 466 432 return false; 467 433 468 EventTarget* target= 0;469 // We need to handle a DOMWindow specially, because a wrapper object of a DOMWindow434 value = 0; 435 // We need to handle a DOMWindow specially, because a DOMWindow wrapper 470 436 // exists on a prototype chain of v8Value. 471 437 if (v8Value->IsObject()) { … … 480 446 if (V8DOMWrapper::isDOMWrapper(v8Value)) { 481 447 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 482 target = toWrapperTypeInfo(wrapper)->toEventTarget(wrapper); 483 } 484 value = target; 448 value = toWrapperTypeInfo(wrapper)->toEventTarget(wrapper); 449 } 485 450 return true; 486 451 }
Note: See TracChangeset
for help on using the changeset viewer.