Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Update ChakraCore to release/2.0-pre branch
Browse files Browse the repository at this point in the history
Take a new drop of chakra-core/ChakraCore@12b0ae4

PR-URL: #147
Reviewed-By: Kunal Pathak <[email protected]>
Reviewed-By: Mark Marron <[email protected]>
  • Loading branch information
digitalinfinity committed Nov 26, 2016
1 parent 17dda8c commit 638947d
Show file tree
Hide file tree
Showing 125 changed files with 5,850 additions and 13,988 deletions.
1 change: 0 additions & 1 deletion deps/chakrashim/core/bin/ChakraCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ target_include_directories (
# pthread: For threading
# stdc++/gcc_s: C++ runtime code
# dl: For shared library loading related functions
# icuuc: For the ICU (xplat-todo: Make this optional)
#
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(LINKER_START_GROUP
Expand Down
13 changes: 7 additions & 6 deletions deps/chakrashim/core/bin/ch/ch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void __stdcall PrintUsageFormat()

void __stdcall PrintUsage()
{
#ifndef DEBUG
#if !defined(ENABLE_DEBUG_CONFIG_OPTIONS)
wprintf(_u("\nUsage: %s <source file> %s"), hostName,
_u("\n[flaglist] is not supported for Release mode\n"));
#else
Expand Down Expand Up @@ -456,11 +456,6 @@ HRESULT CreateAndRunSerializedScript(const char* fileName, LPCSTR fileContents,
IfFailGo(RunScript(fileName, fileContents, bcBuffer, fullPath));

Error:
if (bcBuffer != nullptr)
{
delete[] bcBuffer;
}

if (current != JS_INVALID_REFERENCE)
{
ChakraRTInterface::JsSetCurrentContext(current);
Expand All @@ -470,6 +465,12 @@ HRESULT CreateAndRunSerializedScript(const char* fileName, LPCSTR fileContents,
{
ChakraRTInterface::JsDisposeRuntime(runtime);
}

if (bcBuffer != nullptr)
{
delete[] bcBuffer;
}

return hr;
}

Expand Down
24 changes: 12 additions & 12 deletions deps/chakrashim/core/lib/Backend/BackwardPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7070,19 +7070,19 @@ BackwardPass::ProcessBailOnNoProfile(IR::Instr *instr, BasicBlock *block)
// because the bailout wouldn't be able to restore tmp.
IR::Instr *curNext = curInstr->GetNextRealInstrOrLabel();
IR::Instr *instrNope = nullptr;
while (curNext->m_opcode == Js::OpCode::Ld_A && curNext->GetDst()->IsRegOpnd() && curNext->GetDst()->AsRegOpnd()->m_fgPeepTmp)
if (curNext->m_opcode == Js::OpCode::Ld_A && curNext->GetDst()->IsRegOpnd() && curNext->GetDst()->AsRegOpnd()->m_fgPeepTmp)
{
// Instead of just giving up, we can be a little trickier. We can instead treat the tmp declaration(s) as a
// part of the block prefix, and put the bailonnoprofile immediately after them. This has the added benefit
// that we can still merge up blocks beginning with bailonnoprofile, even if they would otherwise not allow
// us to, due to the fact that these tmp declarations would be pre-empted by the higher-level bailout.
instrNope = curNext;
curNext = curNext->GetNextRealInstrOrLabel();
}

if (instrNope != nullptr)
{
instrNope = curNext;
block->RemoveInstr(instr);
return true;
/*while (curNext->m_opcode == Js::OpCode::Ld_A && curNext->GetDst()->IsRegOpnd() && curNext->GetDst()->AsRegOpnd()->m_fgPeepTmp)
{
// Instead of just giving up, we can be a little trickier. We can instead treat the tmp declaration(s) as a
// part of the block prefix, and put the bailonnoprofile immediately after them. This has the added benefit
// that we can still merge up blocks beginning with bailonnoprofile, even if they would otherwise not allow
// us to, due to the fact that these tmp declarations would be pre-empted by the higher-level bailout.
instrNope = curNext;
curNext = curNext->GetNextRealInstrOrLabel();
}*/
}

curInstr = instr->m_prev;
Expand Down
49 changes: 21 additions & 28 deletions deps/chakrashim/core/lib/Backend/BailOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,6 @@ BailOutRecord::BailOutRecord(uint32 bailOutOffset, uint bailOutCacheIndex, IR::B
}

#if ENABLE_DEBUG_CONFIG_OPTIONS
#define REJIT_TESTTRACE(...) \
if (Js::Configuration::Global.flags.TestTrace.IsEnabled(Js::ReJITPhase)) \
{ \
Output::Print(__VA_ARGS__); \
Output::Flush(); \
}
#define REJIT_KIND_TESTTRACE(bailOutKind, ...) \
if (Js::Configuration::Global.flags.TestTrace.IsEnabled(Js::ReJITPhase)) \
{ \
Expand All @@ -334,7 +328,6 @@ BailOutRecord::BailOutRecord(uint32 bailOutOffset, uint bailOutCacheIndex, IR::B
const char16 * const trueString = _u("true");
const char16 * const falseString = _u("false");
#else
#define REJIT_TESTTRACE(...)
#define REJIT_KIND_TESTTRACE(...)
#endif

Expand Down Expand Up @@ -727,8 +720,8 @@ BailOutRecord::AdjustOffsetsForDiagMode(Js::JavascriptCallStackLayout * layout,
}

void
BailOutRecord::IsOffsetNativeIntOrFloat(uint offsetIndex, int argOutSlotStart, bool * pIsFloat64, bool * pIsInt32,
bool * pIsSimd128F4, bool * pIsSimd128I4, bool * pIsSimd128I8, bool * pIsSimd128I16, bool * pIsSimd128U4,
BailOutRecord::IsOffsetNativeIntOrFloat(uint offsetIndex, int argOutSlotStart, bool * pIsFloat64, bool * pIsInt32,
bool * pIsSimd128F4, bool * pIsSimd128I4, bool * pIsSimd128I8, bool * pIsSimd128I16, bool * pIsSimd128U4,
bool * pIsSimd128U8, bool * pIsSimd128U16, bool * pIsSimd128B4, bool * pIsSimd128B8, bool * pIsSimd128B16) const
{
bool isFloat64 = this->argOutOffsetInfo->argOutFloat64Syms->Test(argOutSlotStart + offsetIndex) != 0;
Expand All @@ -745,7 +738,7 @@ BailOutRecord::IsOffsetNativeIntOrFloat(uint offsetIndex, int argOutSlotStart, b
bool isSimd128B8 = this->argOutOffsetInfo->argOutSimd128B8Syms->Test(argOutSlotStart + offsetIndex) != 0;
bool isSimd128B16 = this->argOutOffsetInfo->argOutSimd128B16Syms->Test(argOutSlotStart + offsetIndex) != 0;

Assert(!isFloat64 || !isInt32 ||
Assert(!isFloat64 || !isInt32 ||
!isSimd128F4 || !isSimd128I4 || !isSimd128I8 || !isSimd128I16 || !
!isSimd128U4 || !isSimd128U8 || !isSimd128U16);

Expand All @@ -766,8 +759,8 @@ BailOutRecord::IsOffsetNativeIntOrFloat(uint offsetIndex, int argOutSlotStart, b
void
BailOutRecord::RestoreValue(IR::BailOutKind bailOutKind, Js::JavascriptCallStackLayout * layout, Js::Var * values, Js::ScriptContext * scriptContext,
bool fromLoopBody, Js::Var * registerSaves, Js::InterpreterStackFrame * newInstance, Js::Var* pArgumentsObject, void * argoutRestoreAddress,
uint regSlot, int offset, bool isLocal, bool isFloat64, bool isInt32,
bool isSimd128F4, bool isSimd128I4, bool isSimd128I8, bool isSimd128I16,
uint regSlot, int offset, bool isLocal, bool isFloat64, bool isInt32,
bool isSimd128F4, bool isSimd128I4, bool isSimd128I8, bool isSimd128I16,
bool isSimd128U4, bool isSimd128U8, bool isSimd128U16, bool isSimd128B4, bool isSimd128B8, bool isSimd128B16) const
{
bool boxStackInstance = true;
Expand Down Expand Up @@ -801,7 +794,7 @@ BailOutRecord::RestoreValue(IR::BailOutKind bailOutKind, Js::JavascriptCallStack
}
else if (
isSimd128F4 || isSimd128I4 || isSimd128I8 || isSimd128I16 ||
isSimd128U4 || isSimd128U8 || isSimd128U16 || isSimd128B4 ||
isSimd128U4 || isSimd128U8 || isSimd128U16 || isSimd128B4 ||
isSimd128B8 || isSimd128B16
)
{
Expand All @@ -826,8 +819,8 @@ BailOutRecord::RestoreValue(IR::BailOutKind bailOutKind, Js::JavascriptCallStack
// and we bailout during bar args evaluation, we recover from args from argoutRestoreAddress, not from caller function frame.
// This is because try-catch is implemented as a C wrapper, so args will be a different offset from rbp in that case.
Assert(
!isFloat64 && !isInt32 &&
!isSimd128F4 && !isSimd128I4 && !isSimd128I8 && !isSimd128I16 && !isSimd128U4 &&
!isFloat64 && !isInt32 &&
!isSimd128F4 && !isSimd128I4 && !isSimd128I8 && !isSimd128I16 && !isSimd128U4 &&
!isSimd128U8 && !isSimd128U16 && !isSimd128B4 && !isSimd128B8 && !isSimd128B16
);

Expand Down Expand Up @@ -1019,8 +1012,8 @@ BailOutRecord::RestoreValues(IR::BailOutKind bailOutKind, Js::JavascriptCallStac
globalBailOutRecordTable->IterateGlobalBailOutRecordTableRows(m_bailOutRecordId, [=](GlobalBailOutRecordDataRow *row) {
Assert(row->offset != 0);
RestoreValue(bailOutKind, layout, values, scriptContext, fromLoopBody, registerSaves, newInstance, pArgumentsObject,
argoutRestoreAddress, row->regSlot, row->offset, true, row->isFloat, row->isInt, row->isSimd128F4,
row->isSimd128I4, row->isSimd128I8, row->isSimd128I16, row->isSimd128U4, row->isSimd128U8, row->isSimd128U16,
argoutRestoreAddress, row->regSlot, row->offset, true, row->isFloat, row->isInt, row->isSimd128F4,
row->isSimd128I4, row->isSimd128I8, row->isSimd128I16, row->isSimd128U4, row->isSimd128U8, row->isSimd128U16,
row->isSimd128B4, row->isSimd128B8, row->isSimd128B16);
});
}
Expand All @@ -1045,12 +1038,12 @@ BailOutRecord::RestoreValues(IR::BailOutKind bailOutKind, Js::JavascriptCallStac
bool isSimd128B16;

offset = offsets[i];
this->IsOffsetNativeIntOrFloat(i, argOutSlotStart, &isFloat64, &isInt32,
&isSimd128F4, &isSimd128I4, &isSimd128I8, &isSimd128I16,
this->IsOffsetNativeIntOrFloat(i, argOutSlotStart, &isFloat64, &isInt32,
&isSimd128F4, &isSimd128I4, &isSimd128I8, &isSimd128I16,
&isSimd128U4, &isSimd128U8, &isSimd128U16, &isSimd128B4, &isSimd128B8, &isSimd128B16);

RestoreValue(bailOutKind, layout, values, scriptContext, fromLoopBody, registerSaves, newInstance, pArgumentsObject,
argoutRestoreAddress, i, offset, false, isFloat64, isInt32, isSimd128F4, isSimd128I4, isSimd128I8,
argoutRestoreAddress, i, offset, false, isFloat64, isInt32, isSimd128F4, isSimd128I4, isSimd128I8,
isSimd128I16, isSimd128U4, isSimd128U8, isSimd128U16, isSimd128B4, isSimd128B8, isSimd128B16);
}
}
Expand Down Expand Up @@ -1654,10 +1647,10 @@ BailOutRecord::BailOutHelper(Js::JavascriptCallStackLayout * layout, Js::ScriptF
newInstance->SetNonVarReg(paramClosureReg, nullptr);
}
}

if (bailOutRecord->globalBailOutRecordTable->hasStackArgOpt)
{
newInstance->TrySetFrameObjectInHeapArgObj(functionScriptContext, bailOutRecord->globalBailOutRecordTable->hasNonSimpleParams,
newInstance->TrySetFrameObjectInHeapArgObj(functionScriptContext, bailOutRecord->globalBailOutRecordTable->hasNonSimpleParams,
bailOutRecord->globalBailOutRecordTable->isScopeObjRestored);
}

Expand Down Expand Up @@ -1911,7 +1904,7 @@ void BailOutRecord::ScheduleFunctionCodeGen(Js::ScriptFunction * function, Js::S

case IR::BailOutOnNotNativeArray:

// REVIEW: We have an issue with array profile info. The info on the type of array we have won't
// REVIEW: We have an issue with array profile info. The info on the type of array we have won't
// get fixed by rejitting. For now, just give up after 50 rejits.
if (profileInfo->GetRejitCount() >= 50)
{
Expand Down Expand Up @@ -2339,9 +2332,9 @@ void BailOutRecord::ScheduleLoopBodyCodeGen(Js::ScriptFunction * function, Js::S
totalJittedLoopIterations = totalJittedLoopIterations <= Js::LoopEntryPointInfo::GetDecrLoopCountPerBailout() ? 0 : totalJittedLoopIterations - Js::LoopEntryPointInfo::GetDecrLoopCountPerBailout();

CheckPreemptiveRejit(executeFunction, bailOutKind, bailOutRecordNotConst, totalJittedLoopIterations, interpreterFrame->GetCurrentLoopNum());

entryPointInfo->totalJittedLoopIterations = totalJittedLoopIterations;

if ((executeFunction->HasDynamicProfileInfo() && totalJittedLoopIterations == 0) ||
PHASE_FORCE(Js::ReJITPhase, executeFunction))
{
Expand Down Expand Up @@ -2403,7 +2396,7 @@ void BailOutRecord::ScheduleLoopBodyCodeGen(Js::ScriptFunction * function, Js::S
executeFunction->SetDontRethunkAfterBailout();
rejitReason = RejitReason::DisableSwitchOptExpectingString;
break;

case IR::BailOnStackArgsOutOfActualsRange:
AssertMsg(false, "How did we reach here ? Stack args opt is currently disabled in loop body gen.");
break;
Expand Down Expand Up @@ -2849,8 +2842,8 @@ void GlobalBailOutRecordDataTable::Finalize(NativeCodeData::Allocator *allocator
#endif
}

void GlobalBailOutRecordDataTable::AddOrUpdateRow(JitArenaAllocator *allocator, uint32 bailOutRecordId, uint32 regSlot, bool isFloat, bool isInt,
bool isSimd128F4, bool isSimd128I4, bool isSimd128I8, bool isSimd128I16, bool isSimd128U4, bool isSimd128U8, bool isSimd128U16,
void GlobalBailOutRecordDataTable::AddOrUpdateRow(JitArenaAllocator *allocator, uint32 bailOutRecordId, uint32 regSlot, bool isFloat, bool isInt,
bool isSimd128F4, bool isSimd128I4, bool isSimd128I8, bool isSimd128I16, bool isSimd128U4, bool isSimd128U8, bool isSimd128U16,
bool isSimd128B4, bool isSimd128B8, bool isSimd128B16, int32 offset, uint *lastUpdatedRowIndex)
{
Assert(offset != 0);
Expand Down
1 change: 0 additions & 1 deletion deps/chakrashim/core/lib/Backend/Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,6 @@ uint Encoder::CalculateCRC(uint bufferCRC, size_t data)
}
#endif
#endif

return CalculateCRC32(bufferCRC, data);
}

Expand Down
3 changes: 2 additions & 1 deletion deps/chakrashim/core/lib/Backend/IRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7473,7 +7473,8 @@ IRBuilder::DoClosureRegCheck(Js::RegSlot reg)
}
if (reg == m_func->GetJITFunctionBody()->GetEnvReg() ||
reg == m_func->GetJITFunctionBody()->GetLocalClosureReg() ||
reg == m_func->GetJITFunctionBody()->GetLocalFrameDisplayReg())
reg == m_func->GetJITFunctionBody()->GetLocalFrameDisplayReg() ||
reg == m_func->GetJITFunctionBody()->GetParamClosureReg())
{
Js::Throw::FatalInternalError();
}
Expand Down
6 changes: 5 additions & 1 deletion deps/chakrashim/core/lib/Backend/JITObjTypeSpecFldInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ JITTimeFixedField *
JITObjTypeSpecFldInfo::GetFixedFieldIfAvailableAsFixedFunction()
{
Assert(HasFixedValue());
Assert(IsMono() || (IsPoly() && !DoesntHaveEquivalence()));
if (IsPoly() && DoesntHaveEquivalence())
{
return nullptr;
}

Assert(m_data.fixedFieldInfoArray);
if (m_data.fixedFieldInfoArray[0].funcInfoAddr != 0)
{
Expand Down
1 change: 1 addition & 0 deletions deps/chakrashim/core/lib/Backend/JnHelperMethodList.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ HELPERCALL(Op_Throw, Js::JavascriptExceptionOperators::OP_Throw, AttrCanThrow)
HELPERCALL(Op_RuntimeTypeError, Js::JavascriptExceptionOperators::OP_RuntimeTypeError, AttrCanThrow)
HELPERCALL(Op_RuntimeRangeError, Js::JavascriptExceptionOperators::OP_RuntimeRangeError, AttrCanThrow)
HELPERCALL(Op_RuntimeReferenceError, Js::JavascriptExceptionOperators::OP_RuntimeReferenceError, AttrCanThrow)
HELPERCALL(Op_WebAssemblyRuntimeError, Js::JavascriptExceptionOperators::OP_WebAssemblyRuntimeError, AttrCanThrow)
HELPERCALL(Op_OutOfMemoryError, Js::Throw::OutOfMemory, AttrCanThrow)
HELPERCALL(Op_FatalInternalError, Js::Throw::FatalInternalError, AttrCanThrow)

Expand Down
Loading

0 comments on commit 638947d

Please sign in to comment.