|
37 | 37 | #include "FrameTracers.h" |
38 | 38 | #include "InlineCallFrame.h" |
39 | 39 | #include "JSArrayIterator.h" |
| 40 | +#include "JSAsyncFromSyncIterator.h" |
40 | 41 | #include "JSAsyncFunction.h" |
41 | 42 | #include "JSAsyncGeneratorFunction.h" |
42 | 43 | #include "JSCellButterfly.h" |
|
46 | 47 | #include "JSIteratorHelper.h" |
47 | 48 | #include "JSLexicalEnvironment.h" |
48 | 49 | #include "JSMapIterator.h" |
| 50 | +#include "JSPromiseAllContext.h" |
| 51 | +#include "JSRegExpStringIterator.h" |
49 | 52 | #include "JSSetIterator.h" |
| 53 | +#include "JSWrapForValidIterator.h" |
50 | 54 | #include "RegExpObject.h" |
51 | 55 | #include "ResourceExhaustion.h" |
52 | 56 | #include "VMTrapsInlines.h" |
@@ -177,6 +181,18 @@ JSC_DEFINE_NOEXCEPT_JIT_OPERATION(operationPopulateObjectInOSR, void, (JSGlobalO |
177 | 181 | case JSIteratorHelperType: |
178 | 182 | materialize(jsCast<JSIteratorHelper*>(target)); |
179 | 183 | break; |
| 184 | + case JSWrapForValidIteratorType: |
| 185 | + materialize(jsCast<JSWrapForValidIterator*>(target)); |
| 186 | + break; |
| 187 | + case JSAsyncFromSyncIteratorType: |
| 188 | + materialize(jsCast<JSAsyncFromSyncIterator*>(target)); |
| 189 | + break; |
| 190 | + case JSPromiseAllContextType: |
| 191 | + materialize(jsCast<JSPromiseAllContext*>(target)); |
| 192 | + break; |
| 193 | + case JSRegExpStringIteratorType: |
| 194 | + materialize(jsCast<JSRegExpStringIterator*>(target)); |
| 195 | + break; |
180 | 196 | case JSPromiseType: |
181 | 197 | if (target->classInfo() == JSInternalPromise::info()) |
182 | 198 | materialize(jsCast<JSInternalPromise*>(target)); |
@@ -451,38 +467,34 @@ JSC_DEFINE_NOEXCEPT_JIT_OPERATION(operationMaterializeObjectInOSR, HeapCell*, (J |
451 | 467 | // The real values will be put subsequently by |
452 | 468 | // operationPopulateNewObjectInOSR. See the PhantomNewObject |
453 | 469 | // case for details. |
454 | | - switch (structure->typeInfo().type()) { |
455 | | - case JSArrayIteratorType: { |
456 | | - JSArrayIterator* result = JSArrayIterator::createWithInitialValues(vm, structure); |
457 | | - RELEASE_ASSERT(materialization->properties().size() - 1 == JSArrayIterator::numberOfInternalFields); |
458 | | - return result; |
459 | | - } |
460 | | - case JSMapIteratorType: { |
461 | | - JSMapIterator* result = JSMapIterator::createWithInitialValues(vm, structure); |
462 | | - RELEASE_ASSERT(materialization->properties().size() - 1 == JSMapIterator::numberOfInternalFields); |
463 | | - return result; |
464 | | - } |
465 | | - case JSSetIteratorType: { |
466 | | - JSSetIterator* result = JSSetIterator::createWithInitialValues(vm, structure); |
467 | | - RELEASE_ASSERT(materialization->properties().size() - 1 == JSSetIterator::numberOfInternalFields); |
| 470 | + auto create = [&]<typename T>() -> T* { |
| 471 | + auto* result = T::createWithInitialValues(vm, structure); |
| 472 | + RELEASE_ASSERT(materialization->properties().size() - 1 == T::numberOfInternalFields); |
468 | 473 | return result; |
469 | | - } |
470 | | - case JSIteratorHelperType: { |
471 | | - JSIteratorHelper* result = JSIteratorHelper::createWithInitialValues(vm, structure); |
472 | | - RELEASE_ASSERT(materialization->properties().size() - 1 == JSIteratorHelper::numberOfInternalFields); |
473 | | - return result; |
474 | | - } |
475 | | - case JSPromiseType: { |
476 | | - if (structure->classInfoForCells() == JSInternalPromise::info()) { |
477 | | - JSInternalPromise* result = JSInternalPromise::createWithInitialValues(vm, structure); |
478 | | - RELEASE_ASSERT(materialization->properties().size() - 1 == JSInternalPromise::numberOfInternalFields); |
479 | | - return result; |
480 | | - } |
| 474 | + }; |
| 475 | + |
| 476 | + switch (structure->typeInfo().type()) { |
| 477 | + case JSArrayIteratorType: |
| 478 | + return create.operator()<JSArrayIterator>(); |
| 479 | + case JSMapIteratorType: |
| 480 | + return create.operator()<JSMapIterator>(); |
| 481 | + case JSSetIteratorType: |
| 482 | + return create.operator()<JSSetIterator>(); |
| 483 | + case JSIteratorHelperType: |
| 484 | + return create.operator()<JSIteratorHelper>(); |
| 485 | + case JSWrapForValidIteratorType: |
| 486 | + return create.operator()<JSWrapForValidIterator>(); |
| 487 | + case JSAsyncFromSyncIteratorType: |
| 488 | + return create.operator()<JSAsyncFromSyncIterator>(); |
| 489 | + case JSPromiseAllContextType: |
| 490 | + return create.operator()<JSPromiseAllContext>(); |
| 491 | + case JSRegExpStringIteratorType: |
| 492 | + return create.operator()<JSRegExpStringIterator>(); |
| 493 | + case JSPromiseType: |
| 494 | + if (structure->classInfoForCells() == JSInternalPromise::info()) |
| 495 | + return create.operator()<JSInternalPromise>(); |
481 | 496 | ASSERT(structure->classInfoForCells() == JSPromise::info()); |
482 | | - JSPromise* result = JSPromise::createWithInitialValues(vm, structure); |
483 | | - RELEASE_ASSERT(materialization->properties().size() - 1 == JSPromise::numberOfInternalFields); |
484 | | - return result; |
485 | | - } |
| 497 | + return create.operator()<JSPromise>(); |
486 | 498 | default: |
487 | 499 | RELEASE_ASSERT_NOT_REACHED(); |
488 | 500 | return nullptr; |
|
0 commit comments