Changeset 222827 in webkit for trunk/Source/JavaScriptCore/jit/Repatch.cpp
- Timestamp:
- Oct 3, 2017, 6:53:18 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/Repatch.cpp
r222671 r222827 245 245 } 246 246 247 std::unique_ptr<PolyProtoAccessChain> prototypeAccessChain; 248 247 249 PropertyOffset offset = slot.isUnset() ? invalidOffset : slot.cachedOffset(); 248 250 … … 256 258 structure->flattenDictionaryStructure(vm, jsCast<JSObject*>(baseCell)); 257 259 } 258 260 259 261 if (slot.isUnset() && structure->typeInfo().getOwnPropertySlotIsImpureForPropertyAbsence()) 260 262 return GiveUpOnCache; 261 263 262 if (slot.isUnset()) { 263 conditionSet = generateConditionsForPropertyMiss( 264 vm, codeBlock, exec, structure, propertyName.impl()); 265 } else { 266 conditionSet = generateConditionsForPrototypePropertyHit( 267 vm, codeBlock, exec, structure, slot.slotBase(), 268 propertyName.impl()); 269 } 270 271 if (!conditionSet.isValid()) 264 bool usesPolyProto; 265 prototypeAccessChain = PolyProtoAccessChain::create(exec->lexicalGlobalObject(), baseCell, slot, usesPolyProto); 266 if (!prototypeAccessChain) { 267 // It's invalid to access this prototype property. 272 268 return GiveUpOnCache; 273 274 offset = slot.isUnset() ? invalidOffset : conditionSet.slotBaseCondition().offset(); 269 } 270 271 if (!usesPolyProto) { 272 // We use ObjectPropertyConditionSet instead for faster accesses. 273 prototypeAccessChain = nullptr; 274 275 if (slot.isUnset()) { 276 conditionSet = generateConditionsForPropertyMiss( 277 vm, codeBlock, exec, structure, propertyName.impl()); 278 } else { 279 conditionSet = generateConditionsForPrototypePropertyHit( 280 vm, codeBlock, exec, structure, slot.slotBase(), 281 propertyName.impl()); 282 } 283 284 if (!conditionSet.isValid()) 285 return GiveUpOnCache; 286 } 287 288 offset = slot.isUnset() ? invalidOffset : slot.cachedOffset(); 275 289 } 276 290 … … 294 308 RELEASE_ASSERT_NOT_REACHED(); 295 309 296 newCase = ProxyableAccessCase::create(vm, codeBlock, type, offset, structure, conditionSet, loadTargetFromProxy, slot.watchpointSet()); 297 } else if (!loadTargetFromProxy && getter && IntrinsicGetterAccessCase::canEmitIntrinsicGetter(getter, structure)) 310 newCase = ProxyableAccessCase::create(vm, codeBlock, type, offset, structure, conditionSet, loadTargetFromProxy, slot.watchpointSet(), WTFMove(prototypeAccessChain)); 311 } else if (!loadTargetFromProxy && getter && IntrinsicGetterAccessCase::canEmitIntrinsicGetter(getter, structure) && !prototypeAccessChain) { 312 // FIXME: We should make this work with poly proto, but for our own sanity, we probably 313 // want to do a pointer check on the actual getter. A good time to make this work would 314 // be when we can inherit from builtin types in poly proto fashion: 315 // https://bugs.webkit.org/show_bug.cgi?id=177318 298 316 newCase = IntrinsicGetterAccessCase::create(vm, codeBlock, slot.cachedOffset(), structure, conditionSet, getter); 299 else {317 } else { 300 318 if (slot.isCacheableValue() || slot.isUnset()) { 301 319 newCase = ProxyableAccessCase::create(vm, codeBlock, slot.isUnset() ? AccessCase::Miss : AccessCase::Load, 302 offset, structure, conditionSet, loadTargetFromProxy, slot.watchpointSet() );320 offset, structure, conditionSet, loadTargetFromProxy, slot.watchpointSet(), WTFMove(prototypeAccessChain)); 303 321 } else { 304 322 AccessCase::AccessType type; … … 317 335 slot.watchpointSet(), slot.isCacheableCustom() ? slot.customGetter() : nullptr, 318 336 slot.isCacheableCustom() ? slot.slotBase() : nullptr, 319 domAttribute );337 domAttribute, WTFMove(prototypeAccessChain)); 320 338 } 321 339 } … … 387 405 388 406 std::unique_ptr<AccessCase> newCase; 407 JSCell* baseCell = baseValue.asCell(); 389 408 390 409 if (slot.base() == baseValue && slot.isCacheablePut()) { … … 430 449 ASSERT(newStructure->isObject()); 431 450 451 std::unique_ptr<PolyProtoAccessChain> prototypeAccessChain; 432 452 ObjectPropertyConditionSet conditionSet; 433 453 if (putKind == NotDirect) { 434 conditionSet =435 generateConditionsForPropertySetterMiss(436 vm, codeBlock, exec, newStructure, ident.impl());437 if (!conditionSet.isValid())454 bool usesPolyProto; 455 prototypeAccessChain = PolyProtoAccessChain::create(exec->lexicalGlobalObject(), baseCell, nullptr, usesPolyProto); 456 if (!prototypeAccessChain) { 457 // It's invalid to access this prototype property. 438 458 return GiveUpOnCache; 439 } 440 441 newCase = AccessCase::create(vm, codeBlock, offset, structure, newStructure, conditionSet); 459 } 460 461 if (!usesPolyProto) { 462 prototypeAccessChain = nullptr; 463 conditionSet = 464 generateConditionsForPropertySetterMiss( 465 vm, codeBlock, exec, newStructure, ident.impl()); 466 if (!conditionSet.isValid()) 467 return GiveUpOnCache; 468 } 469 470 } 471 472 newCase = AccessCase::create(vm, codeBlock, offset, structure, newStructure, conditionSet, WTFMove(prototypeAccessChain)); 442 473 } 443 474 } else if (slot.isCacheableCustom() || slot.isCacheableSetter()) { 444 475 if (slot.isCacheableCustom()) { 445 476 ObjectPropertyConditionSet conditionSet; 477 std::unique_ptr<PolyProtoAccessChain> prototypeAccessChain; 446 478 447 479 if (slot.base() != baseValue) { 448 conditionSet =449 generateConditionsForPrototypePropertyHit(450 vm, codeBlock, exec, structure, slot.base(), ident.impl());451 if (!conditionSet.isValid())480 bool usesPolyProto; 481 prototypeAccessChain = PolyProtoAccessChain::create(exec->lexicalGlobalObject(), baseCell, slot.base(), usesPolyProto); 482 if (!prototypeAccessChain) { 483 // It's invalid to access this prototype property. 452 484 return GiveUpOnCache; 485 } 486 487 if (!usesPolyProto) { 488 prototypeAccessChain = nullptr; 489 conditionSet = 490 generateConditionsForPrototypePropertyHit( 491 vm, codeBlock, exec, structure, slot.base(), ident.impl()); 492 if (!conditionSet.isValid()) 493 return GiveUpOnCache; 494 } 453 495 } 454 496 455 497 newCase = GetterSetterAccessCase::create( 456 vm, codeBlock, slot.isCustomAccessor() ? AccessCase::CustomAccessorSetter : AccessCase::CustomValueSetter, structure, invalidOffset, conditionSet,457 slot.customSetter(), slot.base());498 vm, codeBlock, slot.isCustomAccessor() ? AccessCase::CustomAccessorSetter : AccessCase::CustomValueSetter, structure, invalidOffset, 499 conditionSet, WTFMove(prototypeAccessChain), slot.customSetter(), slot.base()); 458 500 } else { 459 501 ObjectPropertyConditionSet conditionSet; 460 PropertyOffset offset; 502 std::unique_ptr<PolyProtoAccessChain> prototypeAccessChain; 503 PropertyOffset offset = slot.cachedOffset(); 461 504 462 505 if (slot.base() != baseValue) { 463 conditionSet =464 generateConditionsForPrototypePropertyHit(465 vm, codeBlock, exec, structure, slot.base(), ident.impl());466 if (!conditionSet.isValid())506 bool usesPolyProto; 507 prototypeAccessChain = PolyProtoAccessChain::create(exec->lexicalGlobalObject(), baseCell, slot.base(), usesPolyProto); 508 if (!prototypeAccessChain) { 509 // It's invalid to access this prototype property. 467 510 return GiveUpOnCache; 468 offset = conditionSet.slotBaseCondition().offset(); 469 } else 470 offset = slot.cachedOffset(); 511 } 512 513 if (!usesPolyProto) { 514 prototypeAccessChain = nullptr; 515 conditionSet = 516 generateConditionsForPrototypePropertyHit( 517 vm, codeBlock, exec, structure, slot.base(), ident.impl()); 518 if (!conditionSet.isValid()) 519 return GiveUpOnCache; 520 521 RELEASE_ASSERT(offset == conditionSet.slotBaseCondition().offset()); 522 } 523 524 } 471 525 472 526 newCase = GetterSetterAccessCase::create( 473 vm, codeBlock, AccessCase::Setter, structure, offset, conditionSet );527 vm, codeBlock, AccessCase::Setter, structure, offset, conditionSet, WTFMove(prototypeAccessChain)); 474 528 } 475 529 } … … 518 572 Structure* structure = base->structure(vm); 519 573 574 std::unique_ptr<PolyProtoAccessChain> prototypeAccessChain; 520 575 ObjectPropertyConditionSet conditionSet; 521 576 if (wasFound) { 522 577 if (slot.slotBase() != base) { 523 conditionSet = generateConditionsForPrototypePropertyHit( 524 vm, codeBlock, exec, structure, slot.slotBase(), ident.impl()); 578 bool usesPolyProto; 579 prototypeAccessChain = PolyProtoAccessChain::create(exec->lexicalGlobalObject(), base, slot, usesPolyProto); 580 if (!prototypeAccessChain) { 581 // It's invalid to access this prototype property. 582 return GiveUpOnCache; 583 } 584 if (!usesPolyProto) { 585 prototypeAccessChain = nullptr; 586 conditionSet = generateConditionsForPrototypePropertyHit( 587 vm, codeBlock, exec, structure, slot.slotBase(), ident.impl()); 588 } 525 589 } 526 590 } else { 527 conditionSet = generateConditionsForPropertyMiss( 528 vm, codeBlock, exec, structure, ident.impl()); 591 bool usesPolyProto; 592 prototypeAccessChain = PolyProtoAccessChain::create(exec->lexicalGlobalObject(), base, slot, usesPolyProto); 593 if (!prototypeAccessChain) { 594 // It's invalid to access this prototype property. 595 return GiveUpOnCache; 596 } 597 598 if (!usesPolyProto) { 599 prototypeAccessChain = nullptr; 600 conditionSet = generateConditionsForPropertyMiss( 601 vm, codeBlock, exec, structure, ident.impl()); 602 } 529 603 } 530 604 if (!conditionSet.isValid()) … … 534 608 535 609 std::unique_ptr<AccessCase> newCase = AccessCase::create( 536 vm, codeBlock, wasFound ? AccessCase::InHit : AccessCase::InMiss, invalidOffset, structure, conditionSet );610 vm, codeBlock, wasFound ? AccessCase::InHit : AccessCase::InMiss, invalidOffset, structure, conditionSet, WTFMove(prototypeAccessChain)); 537 611 538 612 AccessGenerationResult result = stubInfo.addAccessCase(locker, codeBlock, ident, WTFMove(newCase));
Note:
See TracChangeset
for help on using the changeset viewer.