Changeset 153200 in webkit for trunk/Source/JavaScriptCore/bytecompiler
- Timestamp:
- Jul 24, 2013, 9:01:45 PM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore/bytecompiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r153199 r153200 1846 1846 // Emit call. 1847 1847 UnlinkedArrayProfile arrayProfile = newArrayProfile(); 1848 emitOpcode(opcodeID); 1848 UnlinkedValueProfile profile = emitProfiledOpcode(opcodeID); 1849 ASSERT(dst); 1850 ASSERT(dst != ignoredResult()); 1851 instructions().append(dst->index()); // result 1849 1852 instructions().append(func->index()); // func 1850 1853 instructions().append(callArguments.argumentCountIncludingThis()); // argCount … … 1856 1859 #endif 1857 1860 instructions().append(arrayProfile); 1858 if (dst != ignoredResult()) { 1859 UnlinkedValueProfile profile = emitProfiledOpcode(op_call_put_result); 1860 instructions().append(kill(dst)); 1861 instructions().append(profile); 1862 } 1861 instructions().append(profile); 1863 1862 1864 1863 if (expectedFunction != NoExpectedFunction) … … 1884 1883 1885 1884 // Emit call. 1886 emitOpcode(op_call_varargs); 1885 UnlinkedValueProfile profile = emitProfiledOpcode(op_call_varargs); 1886 ASSERT(dst != ignoredResult()); 1887 instructions().append(dst->index()); 1887 1888 instructions().append(func->index()); 1888 1889 instructions().append(thisRegister->index()); … … 1890 1891 instructions().append(firstFreeRegister->index()); 1891 1892 instructions().append(0); // Pad to make it as big as an op_call. 1892 if (dst != ignoredResult()) { 1893 UnlinkedValueProfile profile = emitProfiledOpcode(op_call_put_result); 1894 instructions().append(kill(dst)); 1895 instructions().append(profile); 1896 } 1893 instructions().append(profile); 1897 1894 if (m_shouldEmitProfileHooks) { 1898 1895 emitOpcode(op_profile_did_call); … … 1963 1960 expectedFunction = emitExpectedFunctionSnippet(dst, func, expectedFunction, callArguments, done.get()); 1964 1961 1965 emitOpcode(op_construct); 1962 UnlinkedValueProfile profile = emitProfiledOpcode(op_construct); 1963 ASSERT(dst != ignoredResult()); 1964 instructions().append(dst->index()); 1966 1965 instructions().append(func->index()); // func 1967 1966 instructions().append(callArguments.argumentCountIncludingThis()); // argCount … … 1973 1972 #endif 1974 1973 instructions().append(0); 1975 if (dst != ignoredResult()) { 1976 UnlinkedValueProfile profile = emitProfiledOpcode(op_call_put_result); 1977 instructions().append(kill(dst)); 1978 instructions().append(profile); 1979 } 1974 instructions().append(profile); 1980 1975 1981 1976 if (expectedFunction != NoExpectedFunction) -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r153074 r153200 374 374 expectedFunction = NoExpectedFunction; 375 375 RefPtr<RegisterID> func = generator.emitNode(m_expr); 376 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, func.get()); 376 377 CallArguments callArguments(generator, m_args); 377 return generator.emitConstruct( generator.finalDestinationOrIgnored(dst), func.get(), expectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());378 return generator.emitConstruct(returnValue.get(), func.get(), expectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 378 379 } 379 380 … … 420 421 { 421 422 RefPtr<RegisterID> func = generator.emitNode(m_expr); 423 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, func.get()); 422 424 CallArguments callArguments(generator, m_args); 423 425 generator.emitLoad(callArguments.thisRegister(), jsUndefined()); 424 return generator.emitCall( generator.finalDestinationOrIgnored(dst, func.get()), func.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());426 return generator.emitCall(returnValue.get(), func.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 425 427 } 426 428 … … 434 436 if (RegisterID* local = resolveResult.local()) { 435 437 RefPtr<RegisterID> func = generator.emitMove(generator.tempDestination(dst), local); 438 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, func.get()); 436 439 CallArguments callArguments(generator, m_args); 437 440 generator.emitLoad(callArguments.thisRegister(), jsUndefined()); 438 441 // This passes NoExpectedFunction because we expect that if the function is in a 439 442 // local variable, then it's not one of our built-in constructors. 440 return generator.emitCall( generator.finalDestinationOrIgnored(dst, callArguments.thisRegister()), func.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());443 return generator.emitCall(returnValue.get(), func.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 441 444 } 442 445 443 446 if (resolveResult.isStatic()) { 444 447 RefPtr<RegisterID> func = generator.newTemporary(); 448 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, func.get()); 445 449 CallArguments callArguments(generator, m_args); 446 450 generator.emitGetStaticVar(func.get(), resolveResult, m_ident); 447 451 generator.emitLoad(callArguments.thisRegister(), jsUndefined()); 448 return generator.emitCall( generator.finalDestinationOrIgnored(dst, func.get()), func.get(), expectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());452 return generator.emitCall(returnValue.get(), func.get(), expectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 449 453 } 450 454 451 455 RefPtr<RegisterID> func = generator.newTemporary(); 456 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, func.get()); 452 457 CallArguments callArguments(generator, m_args); 453 458 int identifierStart = divot() - divotStartOffset(); … … 455 460 generator.emitExpressionInfo(identifierStart + m_ident.length(), m_ident.length(), 0, divotLine(), divotLineStart()); 456 461 generator.emitResolveWithThis(callArguments.thisRegister(), func.get(), resolveResult, m_ident); 457 return generator.emitCall( generator.finalDestinationOrIgnored(dst, func.get()), func.get(), expectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());462 return generator.emitCall(returnValue.get(), func.get(), expectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 458 463 } 459 464 … … 466 471 generator.emitExpressionInfo(subexpressionDivot(), subexpressionStartOffset(), subexpressionEndOffset(), subexpressionLine(), subexpressionLineStart()); 467 472 RefPtr<RegisterID> function = generator.emitGetByVal(generator.tempDestination(dst), base.get(), property); 473 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, function.get()); 468 474 CallArguments callArguments(generator, m_args); 469 475 generator.emitMove(callArguments.thisRegister(), base.get()); 470 return generator.emitCall( generator.finalDestinationOrIgnored(dst, function.get()), function.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());476 return generator.emitCall(returnValue.get(), function.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 471 477 } 472 478 … … 476 482 { 477 483 RefPtr<RegisterID> function = generator.tempDestination(dst); 484 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, function.get()); 478 485 CallArguments callArguments(generator, m_args); 479 486 generator.emitNode(callArguments.thisRegister(), m_base); 480 487 generator.emitExpressionInfo(subexpressionDivot(), subexpressionStartOffset(), subexpressionEndOffset(), subexpressionLine(), subexpressionLineStart()); 481 488 generator.emitGetById(function.get(), callArguments.thisRegister(), m_ident); 482 return generator.emitCall( generator.finalDestinationOrIgnored(dst, function.get()), function.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());489 return generator.emitCall(returnValue.get(), function.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 483 490 } 484 491 … … 490 497 generator.emitExpressionInfo(subexpressionDivot(), subexpressionStartOffset(), subexpressionEndOffset(), subexpressionLine(), subexpressionLineStart()); 491 498 RefPtr<RegisterID> function = generator.emitGetById(generator.tempDestination(dst), base.get(), m_ident); 492 RefPtr<RegisterID> finalDestinationOrIgnored = generator.finalDestinationOrIgnored(dst, function.get());499 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, function.get()); 493 500 generator.emitJumpIfNotFunctionCall(function.get(), realCall.get()); 494 501 { … … 500 507 CallArguments callArguments(generator, m_args); 501 508 generator.emitNode(callArguments.thisRegister(), oldList->m_expr); 502 generator.emitCall( finalDestinationOrIgnored.get(), realFunction.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());509 generator.emitCall(returnValue.get(), realFunction.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 503 510 generator.emitJump(end.get()); 504 511 … … 508 515 CallArguments callArguments(generator, m_args); 509 516 generator.emitLoad(callArguments.thisRegister(), jsUndefined()); 510 generator.emitCall( finalDestinationOrIgnored.get(), realFunction.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());517 generator.emitCall(returnValue.get(), realFunction.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 511 518 generator.emitJump(end.get()); 512 519 } … … 516 523 CallArguments callArguments(generator, m_args); 517 524 generator.emitMove(callArguments.thisRegister(), base.get()); 518 generator.emitCall( finalDestinationOrIgnored.get(), function.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());525 generator.emitCall(returnValue.get(), function.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 519 526 } 520 527 generator.emitLabel(end.get()); 521 return finalDestinationOrIgnored.get();528 return returnValue.get(); 522 529 } 523 530 … … 540 547 generator.emitExpressionInfo(subexpressionDivot(), subexpressionStartOffset(), subexpressionEndOffset(), subexpressionLine(), subexpressionLineStart()); 541 548 RefPtr<RegisterID> function = generator.emitGetById(generator.tempDestination(dst), base.get(), m_ident); 542 RefPtr<RegisterID> finalDestinationOrIgnored = generator.finalDestinationOrIgnored(dst, function.get());549 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, function.get()); 543 550 generator.emitJumpIfNotFunctionApply(function.get(), realCall.get()); 544 551 { … … 553 560 CallArguments callArguments(generator, m_args); 554 561 generator.emitNode(callArguments.thisRegister(), oldList->m_expr); 555 generator.emitCall( finalDestinationOrIgnored.get(), realFunction.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());562 generator.emitCall(returnValue.get(), realFunction.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 556 563 } else { 557 564 m_args->m_listNode = m_args->m_listNode->m_next; … … 559 566 CallArguments callArguments(generator, m_args); 560 567 generator.emitNode(callArguments.thisRegister(), oldList->m_expr); 561 generator.emitCall( finalDestinationOrIgnored.get(), realFunction.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());568 generator.emitCall(returnValue.get(), realFunction.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 562 569 } 563 570 m_args->m_listNode = oldList; … … 566 573 CallArguments callArguments(generator, m_args); 567 574 generator.emitLoad(callArguments.thisRegister(), jsUndefined()); 568 generator.emitCall( finalDestinationOrIgnored.get(), realFunction.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());575 generator.emitCall(returnValue.get(), realFunction.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 569 576 } 570 577 } else { … … 587 594 generator.emitNode(args->m_expr); 588 595 589 generator.emitCallVarargs( finalDestinationOrIgnored.get(), realFunction.get(), thisRegister.get(), argsRegister.get(), generator.newTemporary(), profileHookRegister.get(), divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());596 generator.emitCallVarargs(returnValue.get(), realFunction.get(), thisRegister.get(), argsRegister.get(), generator.newTemporary(), profileHookRegister.get(), divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 590 597 } 591 598 generator.emitJump(end.get()); … … 595 602 CallArguments callArguments(generator, m_args); 596 603 generator.emitMove(callArguments.thisRegister(), base.get()); 597 generator.emitCall( finalDestinationOrIgnored.get(), function.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart());604 generator.emitCall(returnValue.get(), function.get(), NoExpectedFunction, callArguments, divot(), divotStartOffset(), divotEndOffset(), divotLine(), divotLineStart()); 598 605 } 599 606 generator.emitLabel(end.get()); 600 return finalDestinationOrIgnored.get();607 return returnValue.get(); 601 608 } 602 609
Note:
See TracChangeset
for help on using the changeset viewer.