Changeset 197381 in webkit for trunk/Source/JavaScriptCore/runtime
- Timestamp:
- Feb 29, 2016, 7:18:59 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/InferredType.cpp
r190916 r197381 401 401 bool InferredType::willStoreValueSlow(VM& vm, PropertyName propertyName, JSValue value) 402 402 { 403 ConcurrentJITLocker locker(m_lock); 404 Descriptor myType = descriptor(locker); 405 Descriptor otherType = Descriptor::forValue(value); 406 407 myType.merge(otherType); 408 409 ASSERT(descriptor(locker) != myType); // The type must have changed if we're on the slow path. 410 411 set(locker, vm, propertyName, value, myType); 412 413 return kind(locker) != Top; 403 Descriptor oldType; 404 Descriptor myType; 405 bool result; 406 { 407 ConcurrentJITLocker locker(m_lock); 408 oldType = descriptor(locker); 409 myType = Descriptor::forValue(value); 410 411 myType.merge(oldType); 412 413 ASSERT(oldType != myType); // The type must have changed if we're on the slow path. 414 415 bool setResult = set(locker, vm, myType); 416 result = kind(locker) != Top; 417 if (!setResult) 418 return result; 419 } 420 421 InferredTypeFireDetail detail(this, propertyName.uid(), oldType, myType, value); 422 m_watchpointSet.fireAll(detail); 423 return result; 414 424 } 415 425 416 426 void InferredType::makeTopSlow(VM& vm, PropertyName propertyName) 417 427 { 418 ConcurrentJITLocker locker(m_lock); 419 set(locker, vm, propertyName, JSValue(), Top); 420 } 421 422 void InferredType::set( 423 const ConcurrentJITLocker& locker, VM& vm, PropertyName propertyName, JSValue offendingValue, 424 Descriptor newDescriptor) 428 Descriptor oldType; 429 { 430 ConcurrentJITLocker locker(m_lock); 431 oldType = descriptor(locker); 432 if (!set(locker, vm, Top)) 433 return; 434 } 435 436 InferredTypeFireDetail detail(this, propertyName.uid(), oldType, Top, JSValue()); 437 m_watchpointSet.fireAll(detail); 438 } 439 440 bool InferredType::set(const ConcurrentJITLocker& locker, VM& vm, Descriptor newDescriptor) 425 441 { 426 442 // We will trigger write barriers while holding our lock. Currently, write barriers don't GC, but that … … 432 448 // Be defensive: if we're not really changing the type, then we don't have to do anything. 433 449 if (descriptor(locker) == newDescriptor) 434 return; 435 450 return false; 451 452 bool shouldFireWatchpointSet = false; 453 436 454 // The new descriptor must be more general than the previous one. 437 455 ASSERT(newDescriptor.subsumes(descriptor(locker))); … … 447 465 ASSERT(m_watchpointSet.state() != IsInvalidated); 448 466 449 InferredTypeFireDetail detail(450 this, propertyName.uid(), descriptor(locker), newDescriptor, offendingValue);451 452 467 // We're about to do expensive things because some compiler thread decided to watch this type and 453 468 // then the type changed. Assume that this property is crazy, and don't ever do any more things for … … 455 470 newDescriptor = Top; 456 471 457 m_watchpointSet.fireAll(detail);472 shouldFireWatchpointSet = true; 458 473 } 459 474 … … 478 493 // Assert that we did things. 479 494 ASSERT(descriptor(locker) == newDescriptor); 495 496 return shouldFireWatchpointSet; 480 497 } 481 498 … … 487 504 VM& vm = *Heap::heap(this)->vm(); 488 505 489 ConcurrentJITLocker locker(m_lock); 490 491 Descriptor newDescriptor = descriptor(locker); 492 newDescriptor.removeStructure(); 493 494 set(locker, vm, PropertyName(nullptr), JSValue(), newDescriptor); 506 Descriptor oldDescriptor; 507 Descriptor newDescriptor; 508 { 509 ConcurrentJITLocker locker(m_lock); 510 oldDescriptor = descriptor(locker); 511 newDescriptor = oldDescriptor; 512 newDescriptor.removeStructure(); 513 514 if (!set(locker, vm, newDescriptor)) 515 return; 516 } 517 518 InferredTypeFireDetail detail(this, nullptr, oldDescriptor, newDescriptor, JSValue()); 519 m_watchpointSet.fireAll(detail); 495 520 } 496 521 -
trunk/Source/JavaScriptCore/runtime/InferredType.h
r190916 r197381 230 230 bool willStoreValueSlow(VM&, PropertyName, JSValue); 231 231 void makeTopSlow(VM&, PropertyName); 232 void set(const ConcurrentJITLocker&, VM&, PropertyName, JSValue, Descriptor); 232 233 // Helper for willStoreValueSlow() and makeTopSlow(). This returns true if we should fire the 234 // watchpoint set. 235 bool set(const ConcurrentJITLocker&, VM&, Descriptor); 236 233 237 void removeStructure(); 234 238
Note:
See TracChangeset
for help on using the changeset viewer.