summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/dfg/DFGJITCode.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/dfg/DFGJITCode.cpp
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGJITCode.cpp')
-rw-r--r--Source/JavaScriptCore/dfg/DFGJITCode.cpp80
1 files changed, 16 insertions, 64 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGJITCode.cpp b/Source/JavaScriptCore/dfg/DFGJITCode.cpp
index 75549133c..c53653f8f 100644
--- a/Source/JavaScriptCore/dfg/DFGJITCode.cpp
+++ b/Source/JavaScriptCore/dfg/DFGJITCode.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,17 +29,11 @@
#if ENABLE(DFG_JIT)
#include "CodeBlock.h"
-#include "JSCInlines.h"
-#include "TrackedReferences.h"
namespace JSC { namespace DFG {
JITCode::JITCode()
: DirectJITCode(DFGJIT)
-#if ENABLE(FTL_JIT)
- , osrEntryRetry(0)
- , abandonOSREntry(false)
-#endif // ENABLE(FTL_JIT)
{
}
@@ -83,40 +77,23 @@ void JITCode::reconstruct(
reconstruct(codeBlock, codeOrigin, streamIndex, recoveries);
result = Operands<JSValue>(OperandsLike, recoveries);
- for (size_t i = result.size(); i--;)
- result[i] = recoveries[i].recover(exec);
-}
-
-RegisterSet JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBlock* codeBlock, CallSiteIndex callSiteIndex)
-{
- for (OSRExit& exit : osrExit) {
- if (exit.isExceptionHandler() && exit.m_exceptionHandlerCallSiteIndex.bits() == callSiteIndex.bits()) {
- Operands<ValueRecovery> valueRecoveries;
- reconstruct(codeBlock, exit.m_codeOrigin, exit.m_streamIndex, valueRecoveries);
- RegisterSet liveAtOSRExit;
- for (size_t index = 0; index < valueRecoveries.size(); ++index) {
- const ValueRecovery& recovery = valueRecoveries[index];
- if (recovery.isInRegisters()) {
- if (recovery.isInGPR())
- liveAtOSRExit.set(recovery.gpr());
- else if (recovery.isInFPR())
- liveAtOSRExit.set(recovery.fpr());
-#if USE(JSVALUE32_64)
- else if (recovery.isInJSValueRegs()) {
- liveAtOSRExit.set(recovery.payloadGPR());
- liveAtOSRExit.set(recovery.tagGPR());
- }
-#endif
- else
- RELEASE_ASSERT_NOT_REACHED();
- }
- }
-
- return liveAtOSRExit;
+ for (size_t i = result.size(); i--;) {
+ int operand = result.operandForIndex(i);
+
+ if (operandIsArgument(operand)
+ && !VirtualRegister(operand).toArgument()
+ && codeBlock->codeType() == FunctionCode
+ && codeBlock->specializationKind() == CodeForConstruct) {
+ // Ugh. If we're in a constructor, the 'this' argument may hold garbage. It will
+ // also never be used. It doesn't matter what we put into the value for this,
+ // but it has to be an actual value that can be grokked by subsequent DFG passes,
+ // so we sanitize it here by turning it into Undefined.
+ result[i] = jsUndefined();
+ continue;
}
+
+ result[i] = recoveries[i].recover(exec);
}
-
- return RegisterSet();
}
#if ENABLE(FTL_JIT)
@@ -179,7 +156,6 @@ void JITCode::setOptimizationThresholdBasedOnCompilationResult(
switch (result) {
case CompilationSuccessful:
optimizeNextInvocation(codeBlock);
- codeBlock->baselineVersion()->m_hasBeenCompiledWithFTL = true;
return;
case CompilationFailed:
dontOptimizeAnytimeSoon(codeBlock);
@@ -203,30 +179,6 @@ void JITCode::setOptimizationThresholdBasedOnCompilationResult(
}
#endif // ENABLE(FTL_JIT)
-void JITCode::validateReferences(const TrackedReferences& trackedReferences)
-{
- common.validateReferences(trackedReferences);
-
- for (OSREntryData& entry : osrEntry) {
- for (unsigned i = entry.m_expectedValues.size(); i--;)
- entry.m_expectedValues[i].validateReferences(trackedReferences);
- }
-
- minifiedDFG.validateReferences(trackedReferences);
-}
-
-Optional<CodeOrigin> JITCode::findPC(CodeBlock*, void* pc)
-{
- for (OSRExit& exit : osrExit) {
- if (ExecutableMemoryHandle* handle = exit.m_code.executableMemory()) {
- if (handle->start() <= pc && pc < handle->end())
- return Optional<CodeOrigin>(exit.m_codeOriginForExitProfile);
- }
- }
-
- return Nullopt;
-}
-
} } // namespace JSC::DFG
#endif // ENABLE(DFG_JIT)