Merge mozilla-central and inbound

This commit is contained in:
Ed Morley 2013-07-31 14:25:28 +01:00
Родитель 027842b84f 2f61e5bc95
Коммит 52cd4f611e
57 изменённых файлов: 600 добавлений и 476 удалений

Просмотреть файл

@ -15,6 +15,7 @@
#include "js/Value.h"
#include "nscore.h"
#include "nsStringGlue.h"
#include "mozilla/Assertions.h"
namespace mozilla {
@ -145,6 +146,32 @@ private:
ErrorResult(const ErrorResult&) MOZ_DELETE;
};
/******************************************************************************
** Macros for checking results
******************************************************************************/
#define ENSURE_SUCCESS(res, ret) \
do { \
if (res.Failed()) { \
nsCString msg; \
msg.AppendPrintf("ENSURE_SUCCESS(%s, %s) failed with " \
"result 0x%X", #res, #ret, res.ErrorCode()); \
NS_WARNING(msg.get()); \
return ret; \
} \
} while(0)
#define ENSURE_SUCCESS_VOID(res) \
do { \
if (res.Failed()) { \
nsCString msg; \
msg.AppendPrintf("ENSURE_SUCCESS_VOID(%s) failed with " \
"result 0x%X", #res, res.ErrorCode()); \
NS_WARNING(msg.get()); \
return; \
} \
} while(0)
} // namespace mozilla
#endif /* mozilla_ErrorResult_h */

Просмотреть файл

@ -146,18 +146,9 @@ CreateScopeKey(nsIPrincipal* aPrincipal,
NS_ENSURE_SUCCESS(rv, rv);
if (domainScope.IsEmpty()) {
// About pages have an empty host but a valid path. Since they are handled
// internally by our own redirector, we can trust them and use path as key.
// if file:/// protocol, let's make the exact directory the domain
// For the file:/// protocol use the exact directory as domain.
bool isScheme = false;
if ((NS_SUCCEEDED(uri->SchemeIs("about", &isScheme)) && isScheme) ||
(NS_SUCCEEDED(uri->SchemeIs("moz-safe-about", &isScheme)) && isScheme)) {
rv = uri->GetPath(domainScope);
NS_ENSURE_SUCCESS(rv, rv);
// While the host is always canonicalized to lowercase, the path is not,
// thus need to force the casing.
ToLowerCase(domainScope);
} else if (NS_SUCCEEDED(uri->SchemeIs("file", &isScheme)) && isScheme) {
if (NS_SUCCEEDED(uri->SchemeIs("file", &isScheme)) && isScheme) {
nsCOMPtr<nsIURL> url = do_QueryInterface(uri, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = url->GetDirectory(domainScope);

Просмотреть файл

@ -169,13 +169,13 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
mPaintThrottler(GetFrameTime()),
mGeckoContentController(aGeckoContentController),
mRefPtrMonitor("RefPtrMonitor"),
mMonitor("AsyncPanZoomController"),
mTouchListenerTimeoutTask(nullptr),
mX(this),
mY(this),
mAllowZoom(true),
mMinZoom(MIN_ZOOM),
mMaxZoom(MAX_ZOOM),
mMonitor("AsyncPanZoomController"),
mLastSampleTime(GetFrameTime()),
mState(NOTHING),
mLastAsyncScrollTime(GetFrameTime()),
@ -253,7 +253,7 @@ AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent,
{
CSSToScreenScale currentResolution;
{
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
currentResolution = mFrameMetrics.CalculateResolution();
}
@ -416,7 +416,7 @@ nsEventStatus AsyncPanZoomController::OnTouchStart(const MultiTouchInput& aEvent
// We just interrupted a double-tap animation, so force a redraw in case
// this touchstart is just a tap that doesn't end up triggering a redraw.
{
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
// Bring the resolution back in sync with the zoom.
SetZoomAndResolution(mFrameMetrics.mZoom);
RequestContentRepaint();
@ -495,7 +495,7 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent)
}
{
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
SendAsyncScrollEvent();
}
@ -516,7 +516,7 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent)
case PANNING:
{
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
ScheduleComposite();
RequestContentRepaint();
}
@ -569,7 +569,7 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
float spanRatio = aEvent.mCurrentSpan / aEvent.mPreviousSpan;
{
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
CSSToScreenScale resolution = mFrameMetrics.CalculateResolution();
gfxFloat userZoom = mFrameMetrics.mZoom.scale;
@ -660,7 +660,7 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
mX.StartTouch(aEvent.mFocusPoint.x);
mY.StartTouch(aEvent.mFocusPoint.y);
{
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
ScheduleComposite();
RequestContentRepaint();
}
@ -671,7 +671,7 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent) {
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
CSSToScreenScale resolution = mFrameMetrics.CalculateResolution();
CSSPoint point = WidgetSpaceToCompensatedViewportSpace(aEvent.mPoint, resolution);
@ -688,7 +688,7 @@ nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEven
nsEventStatus AsyncPanZoomController::OnSingleTapConfirmed(const TapGestureInput& aEvent) {
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
CSSToScreenScale resolution = mFrameMetrics.CalculateResolution();
CSSPoint point = WidgetSpaceToCompensatedViewportSpace(aEvent.mPoint, resolution);
@ -701,7 +701,7 @@ nsEventStatus AsyncPanZoomController::OnSingleTapConfirmed(const TapGestureInput
nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent) {
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
if (mAllowZoom) {
CSSToScreenScale resolution = mFrameMetrics.CalculateResolution();
@ -720,7 +720,7 @@ nsEventStatus AsyncPanZoomController::OnCancelTap(const TapGestureInput& aEvent)
}
float AsyncPanZoomController::PanDistance() {
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
return NS_hypot(mX.PanDistance(), mY.PanDistance());
}
@ -767,7 +767,7 @@ void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
UpdateWithTouchAtDevicePoint(aEvent);
{
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
// We want to inversely scale it because when you're zoomed further in, a
// larger swipe should move you a shorter distance.
@ -830,7 +830,7 @@ bool AsyncPanZoomController::DoFling(const TimeDuration& aDelta) {
}
void AsyncPanZoomController::CancelAnimation() {
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
mState = NOTHING;
}
@ -1052,7 +1052,7 @@ void
AsyncPanZoomController::FireAsyncScrollOnTimeout()
{
if (mCurrentAsyncScrollOffset != mLastAsyncScrollOffset) {
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
SendAsyncScrollEvent();
}
mAsyncScrollTimeoutTask = nullptr;
@ -1069,7 +1069,7 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
bool requestAnimationFrame = false;
{
MonitorAutoLock mon(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
switch (mState) {
case FLING:
@ -1115,7 +1115,7 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
}
aScrollOffset = mFrameMetrics.mScrollOffset * mFrameMetrics.CalculateResolution();
*aNewTransform = GetCurrentAsyncTransformInternal();
*aNewTransform = GetCurrentAsyncTransform();
mCurrentAsyncScrollOffset = mFrameMetrics.mScrollOffset;
}
@ -1134,7 +1134,7 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
TimeDuration delta = aSampleTime - mLastAsyncScrollTime;
if (delta.ToMilliseconds() > gAsyncScrollThrottleTime &&
mCurrentAsyncScrollOffset != mLastAsyncScrollOffset) {
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
mLastAsyncScrollTime = aSampleTime;
mLastAsyncScrollOffset = mCurrentAsyncScrollOffset;
SendAsyncScrollEvent();
@ -1153,11 +1153,8 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
}
ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() {
MonitorAutoLock mon(mMonitor);
return GetCurrentAsyncTransformInternal();
}
ReentrantMonitorAutoEnter lock(mMonitor);
ViewTransform AsyncPanZoomController::GetCurrentAsyncTransformInternal() {
LayerPoint metricsScrollOffset;
if (mLastContentPaintMetrics.IsScrollable()) {
metricsScrollOffset = mLastContentPaintMetrics.GetScrollOffsetInLayerPixels();
@ -1168,7 +1165,7 @@ ViewTransform AsyncPanZoomController::GetCurrentAsyncTransformInternal() {
}
void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetrics, bool aIsFirstPaint) {
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
mLastContentPaintMetrics = aLayerMetrics;
@ -1234,12 +1231,12 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
}
const FrameMetrics& AsyncPanZoomController::GetFrameMetrics() {
mMonitor.AssertCurrentThreadOwns();
mMonitor.AssertCurrentThreadIn();
return mFrameMetrics;
}
void AsyncPanZoomController::UpdateCompositionBounds(const ScreenIntRect& aCompositionBounds) {
MonitorAutoLock mon(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
ScreenIntRect oldCompositionBounds = mFrameMetrics.mCompositionBounds;
mFrameMetrics.mCompositionBounds = aCompositionBounds;
@ -1273,7 +1270,7 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
SetState(ANIMATING_ZOOM);
{
MonitorAutoLock mon(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
ScreenIntRect compositionBounds = mFrameMetrics.mCompositionBounds;
CSSRect cssPageRect = mFrameMetrics.mScrollableRect;
@ -1404,7 +1401,7 @@ void AsyncPanZoomController::SetState(PanZoomState aNewState) {
// Intentional scoping for mutex
{
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
oldState = mState;
mState = aNewState;
}
@ -1424,7 +1421,7 @@ void AsyncPanZoomController::TimeoutTouchListeners() {
}
void AsyncPanZoomController::SetZoomAndResolution(const ScreenToScreenScale& aZoom) {
mMonitor.AssertCurrentThreadOwns();
mMonitor.AssertCurrentThreadIn();
mFrameMetrics.mZoom = aZoom;
CSSToScreenScale resolution = mFrameMetrics.CalculateResolution();
// We use ScreenToLayerScale(1) below in order to ask gecko to render
@ -1458,7 +1455,8 @@ void AsyncPanZoomController::SendAsyncScrollEvent() {
CSSRect contentRect;
CSSSize scrollableSize;
{
// XXX bug 890932 - there should be a lock here. but it causes a deadlock.
ReentrantMonitorAutoEnter lock(mMonitor);
scrollId = mFrameMetrics.mScrollId;
scrollableSize = mFrameMetrics.mScrollableRect.Size();
contentRect = mFrameMetrics.CalculateCompositedRectInCssPixels();
@ -1470,7 +1468,7 @@ void AsyncPanZoomController::SendAsyncScrollEvent() {
void AsyncPanZoomController::UpdateScrollOffset(const CSSPoint& aScrollOffset)
{
MonitorAutoLock monitor(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
mFrameMetrics.mScrollOffset = aScrollOffset;
}

Просмотреть файл

@ -10,6 +10,7 @@
#include "GeckoContentController.h"
#include "mozilla/Attributes.h"
#include "mozilla/Monitor.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/RefPtr.h"
#include "InputData.h"
#include "Axis.h"
@ -217,10 +218,6 @@ public:
* amount.
*/
ViewTransform GetCurrentAsyncTransform();
private:
/* Internal method of above. Callers to this MUST hold the monitor. */
ViewTransform GetCurrentAsyncTransformInternal();
public:
/**
* Sets the DPI of the device for use within panning and zooming logic. It is
@ -535,7 +532,7 @@ protected:
// Before manipulating |mFrameMetrics| or |mLastContentPaintMetrics|, the
// monitor should be held. When setting |mState|, either the SetState()
// function can be used, or the monitor can be held and then |mState| updated.
Monitor mMonitor;
ReentrantMonitor mMonitor;
private:
// Metrics of the container layer corresponding to this APZC. This is

Просмотреть файл

@ -48,7 +48,7 @@ public:
{}
void SetFrameMetrics(const FrameMetrics& metrics) {
MonitorAutoLock lock(mMonitor);
ReentrantMonitorAutoEnter lock(mMonitor);
mFrameMetrics = metrics;
}
};

Просмотреть файл

@ -985,6 +985,14 @@ GetObjectMetadata(JSContext *cx, unsigned argc, jsval *vp)
return true;
}
JSBool
js::testingFunc_bailout(JSContext *cx, unsigned argc, jsval *vp)
{
// NOP when not in IonMonkey
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
static JSFunctionSpecWithHelp TestingFunctions[] = {
JS_FN_HELP("gc", ::GC, 0, 0,
"gc([obj] | 'compartment')",
@ -1163,6 +1171,10 @@ static JSFunctionSpecWithHelp TestingFunctions[] = {
"getObjectMetadata(obj)",
" Get the metadata for an object."),
JS_FN_HELP("bailout", testingFunc_bailout, 0, 0,
"bailout()",
" Force a bailout out of ionmonkey (if running in ionmonkey)."),
JS_FS_HELP_END
};

Просмотреть файл

@ -17,6 +17,9 @@ DefineTestingFunctions(JSContext *cx, HandleObject obj);
JSBool
testingFunc_inParallelSection(JSContext *cx, unsigned argc, jsval *vp);
JSBool
testingFunc_bailout(JSContext *cx, unsigned argc, jsval *vp);
} /* namespace js */
#endif /* builtin_TestingFunctions_h */

Просмотреть файл

@ -36,6 +36,7 @@ using mozilla::AddToHash;
using mozilla::ArrayLength;
using mozilla::DebugOnly;
using mozilla::HashGeneric;
using mozilla::IsNaN;
using mozilla::IsNegativeZero;
using mozilla::Maybe;
using mozilla::Move;
@ -755,6 +756,10 @@ IsNumericLiteral(ParseNode *pn)
static NumLit
ExtractNumericLiteral(ParseNode *pn)
{
// The JS grammar treats -42 as -(42) (i.e., with separate grammar
// productions) for the unary - and literal 42). However, the asm.js spec
// recognizes -42 (modulo parens, so -(42) and -((42))) as a single literal
// so fold the two potential parse nodes into a single double value.
JS_ASSERT(IsNumericLiteral(pn));
ParseNode *numberNode;
double d;
@ -766,21 +771,33 @@ ExtractNumericLiteral(ParseNode *pn)
d = NumberNodeValue(numberNode);
}
// The asm.js spec syntactically distinguishes any literal containing a
// decimal point or the literal -0 as having double type.
if (NumberNodeHasFrac(numberNode) || IsNegativeZero(d))
return NumLit(NumLit::Double, DoubleValue(d));
int64_t i64 = int64_t(d);
// The syntactic checks above rule out these double values.
JS_ASSERT(!IsNegativeZero(d));
JS_ASSERT(!IsNaN(d));
// Although doubles can only *precisely* represent 53-bit integers, they
// can *imprecisely* represent integers much bigger than an int64_t.
// Furthermore, d may be inf or -inf. In both cases, casting to an int64_t
// is undefined, so test against the integer bounds using doubles.
if (d < double(INT32_MIN) || d > double(UINT32_MAX))
return NumLit(NumLit::OutOfRangeInt, UndefinedValue());
// With the above syntactic and range limitations, d is definitely an
// integer in the range [INT32_MIN, UINT32_MAX] range.
int64_t i64 = int64_t(d);
if (i64 >= 0) {
if (i64 <= INT32_MAX)
return NumLit(NumLit::Fixnum, Int32Value(i64));
if (i64 <= UINT32_MAX)
return NumLit(NumLit::BigUnsigned, Int32Value(uint32_t(i64)));
return NumLit(NumLit::OutOfRangeInt, UndefinedValue());
JS_ASSERT(i64 <= UINT32_MAX);
return NumLit(NumLit::BigUnsigned, Int32Value(uint32_t(i64)));
}
if (i64 >= INT32_MIN)
return NumLit(NumLit::NegativeInt, Int32Value(i64));
return NumLit(NumLit::OutOfRangeInt, UndefinedValue());
JS_ASSERT(i64 >= INT32_MIN);
return NumLit(NumLit::NegativeInt, Int32Value(i64));
}
static inline bool
@ -1436,13 +1453,8 @@ class MOZ_STACK_CLASS ModuleCompiler
}
bool collectAccesses(MIRGenerator &gen) {
#ifdef JS_CPU_ARM
if (!module_->addBoundsChecks(gen.asmBoundsChecks()))
return false;
#else
if (!module_->addHeapAccesses(gen.heapAccesses()))
return false;
#endif
if (!globalAccesses_.appendAll(gen.globalAccesses()))
return false;
return true;
@ -1589,26 +1601,21 @@ class MOZ_STACK_CLASS ModuleCompiler
data[j] = code + masm_.actualOffset(table.elem(j).code()->offset());
}
// Global accesses in function bodies
// Fix up heap/global accesses now that compilation has finished
#ifdef JS_CPU_ARM
JS_ASSERT(globalAccesses_.length() == 0);
// The AsmJSHeapAccess offsets need to be updated to reflect the
// "actualOffset" (an ARM distinction).
module_->convertBoundsChecksToActualOffset(masm_);
for (unsigned i = 0; i < module_->numHeapAccesses(); i++) {
AsmJSHeapAccess &access = module_->heapAccess(i);
access.setOffset(masm_.actualOffset(access.offset()));
}
JS_ASSERT(globalAccesses_.length() == 0);
#else
for (unsigned i = 0; i < globalAccesses_.length(); i++) {
AsmJSGlobalAccess access = globalAccesses_[i];
masm_.patchAsmJSGlobalAccess(access.offset, code, codeBytes, access.globalDataOffset);
}
#endif
// The AsmJSHeapAccess offsets need to be updated to reflect the
// "actualOffset" (an ARM distinction).
for (unsigned i = 0; i < module_->numHeapAccesses(); i++) {
AsmJSHeapAccess &access = module_->heapAccess(i);
access.updateOffset(masm_.actualOffset(access.offset()));
}
*module = module_.forget();

Просмотреть файл

@ -220,22 +220,7 @@ DynamicallyLinkModule(JSContext *cx, CallArgs args, AsmJSModule &module)
if (!ArrayBufferObject::prepareForAsmJS(cx, heap))
return LinkFail(cx, "Unable to prepare ArrayBuffer for asm.js use");
#if defined(JS_CPU_X86)
void *heapOffset = (void*)heap->dataPointer();
void *heapLength = (void*)heap->byteLength();
uint8_t *code = module.functionCode();
for (unsigned i = 0; i < module.numHeapAccesses(); i++) {
const AsmJSHeapAccess &access = module.heapAccess(i);
JSC::X86Assembler::setPointer(access.patchLengthAt(code), heapLength);
JSC::X86Assembler::setPointer(access.patchOffsetAt(code), heapOffset);
}
#elif defined(JS_CPU_ARM)
// Now the length of the array is know, patch all of the bounds check sites
// with the new length.
ion::IonContext ic(cx, NULL);
module.patchBoundsChecks(heap->byteLength());
#endif
module.patchHeapAccesses(heap, cx);
}
AutoObjectVector ffis(cx);

Просмотреть файл

@ -72,6 +72,26 @@ js::NewAsmJSModuleObject(JSContext *cx, ScopedJSDeletePtr<AsmJSModule> *module)
return obj;
}
void
AsmJSModule::patchHeapAccesses(ArrayBufferObject *heap, JSContext *cx)
{
JS_ASSERT(IsPowerOfTwo(heap->byteLength()));
#if defined(JS_CPU_X86)
void *heapOffset = (void*)heap->dataPointer();
void *heapLength = (void*)heap->byteLength();
for (unsigned i = 0; i < heapAccesses_.length(); i++) {
JSC::X86Assembler::setPointer(heapAccesses_[i].patchLengthAt(code_), heapLength);
JSC::X86Assembler::setPointer(heapAccesses_[i].patchOffsetAt(code_), heapOffset);
}
#elif defined(JS_CPU_ARM)
ion::IonContext ic(cx, NULL);
ion::AutoFlushCache afc("patchBoundsCheck");
uint32_t bits = mozilla::CeilingLog2(heap->byteLength());
for (unsigned i = 0; i < heapAccesses_.length(); i++)
ion::Assembler::updateBoundsCheck(bits, (ion::Instruction*)(heapAccesses_[i].offset() + code_));
#endif
}
AsmJSModule::~AsmJSModule()
{
if (code_) {

Просмотреть файл

@ -360,9 +360,6 @@ class AsmJSModule
typedef Vector<Global, 0, SystemAllocPolicy> GlobalVector;
typedef Vector<Exit, 0, SystemAllocPolicy> ExitVector;
typedef Vector<ion::AsmJSHeapAccess, 0, SystemAllocPolicy> HeapAccessVector;
#if defined(JS_CPU_ARM)
typedef Vector<ion::AsmJSBoundsCheck, 0, SystemAllocPolicy> BoundsCheckVector;
#endif
typedef Vector<ion::IonScriptCounts *, 0, SystemAllocPolicy> FunctionCountsVector;
#if defined(MOZ_VTUNE) or defined(JS_ION_PERF)
typedef Vector<ProfiledFunction, 0, SystemAllocPolicy> ProfiledFunctionVector;
@ -372,9 +369,6 @@ class AsmJSModule
ExitVector exits_;
ExportedFunctionVector exports_;
HeapAccessVector heapAccesses_;
#if defined(JS_CPU_ARM)
BoundsCheckVector boundsChecks_;
#endif
#if defined(MOZ_VTUNE)
ProfiledFunctionVector profiledFunctions_;
#endif
@ -676,33 +670,7 @@ class AsmJSModule
const ion::AsmJSHeapAccess &heapAccess(unsigned i) const {
return heapAccesses_[i];
}
#if defined(JS_CPU_ARM)
bool addBoundsChecks(const ion::AsmJSBoundsCheckVector &checks) {
return boundsChecks_.appendAll(checks);
}
void convertBoundsChecksToActualOffset(ion::MacroAssembler &masm) {
for (unsigned i = 0; i < boundsChecks_.length(); i++)
boundsChecks_[i].setOffset(masm.actualOffset(boundsChecks_[i].offset()));
}
void patchBoundsChecks(unsigned heapSize) {
if (heapSize == 0)
return;
ion::AutoFlushCache afc("patchBoundsCheck");
uint32_t bits = mozilla::CeilingLog2(heapSize);
for (unsigned i = 0; i < boundsChecks_.length(); i++)
ion::Assembler::updateBoundsCheck(bits, (ion::Instruction*)(boundsChecks_[i].offset() + code_));
}
unsigned numBoundsChecks() const {
return boundsChecks_.length();
}
const ion::AsmJSBoundsCheck &boundsCheck(unsigned i) const {
return boundsChecks_[i];
}
#endif
void patchHeapAccesses(ArrayBufferObject *heap, JSContext *cx);
void takeOwnership(JSC::ExecutablePool *pool, uint8_t *code, size_t codeBytes, size_t totalBytes) {
JS_ASSERT(uintptr_t(code) % AsmJSPageSize == 0);

Просмотреть файл

@ -1157,7 +1157,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
// Push return address into the ArgumentsRectifier code, immediately after the ioncode
// call.
void *rectReturnAddr = cx->compartment()->ionCompartment()->getArgumentsRectifierReturnAddr();
void *rectReturnAddr = cx->runtime()->ionRuntime()->getArgumentsRectifierReturnAddr();
JS_ASSERT(rectReturnAddr);
if (!builder.writePtr(rectReturnAddr, "ReturnAddr"))
return false;

Просмотреть файл

@ -518,7 +518,7 @@ BaselineCompiler::emitDebugTrap()
bool enabled = script->stepModeEnabled() || script->hasBreakpointsAt(pc);
// Emit patchable call to debug trap handler.
IonCode *handler = cx->compartment()->ionCompartment()->debugTrapHandler(cx);
IonCode *handler = cx->runtime()->ionRuntime()->debugTrapHandler(cx);
mozilla::DebugOnly<CodeOffsetLabel> offset = masm.toggledCall(handler, enabled);
#ifdef DEBUG

Просмотреть файл

@ -562,8 +562,7 @@ ICStubCompiler::getStubCode()
bool
ICStubCompiler::tailCallVM(const VMFunction &fun, MacroAssembler &masm)
{
IonCompartment *ion = cx->compartment()->ionCompartment();
IonCode *code = ion->getVMWrapper(fun);
IonCode *code = cx->runtime()->ionRuntime()->getVMWrapper(fun);
if (!code)
return false;
@ -575,8 +574,7 @@ ICStubCompiler::tailCallVM(const VMFunction &fun, MacroAssembler &masm)
bool
ICStubCompiler::callVM(const VMFunction &fun, MacroAssembler &masm)
{
IonCompartment *ion = cx->compartment()->ionCompartment();
IonCode *code = ion->getVMWrapper(fun);
IonCode *code = cx->runtime()->ionRuntime()->getVMWrapper(fun);
if (!code)
return false;
@ -587,8 +585,7 @@ ICStubCompiler::callVM(const VMFunction &fun, MacroAssembler &masm)
bool
ICStubCompiler::callTypeUpdateIC(MacroAssembler &masm, uint32_t objectOffset)
{
IonCompartment *ion = cx->compartment()->ionCompartment();
IonCode *code = ion->getVMWrapper(DoTypeUpdateFallbackInfo);
IonCode *code = cx->runtime()->ionRuntime()->getVMWrapper(DoTypeUpdateFallbackInfo);
if (!code)
return false;
@ -5751,7 +5748,7 @@ ICGetProp_CallScripted::Compiler::generateStubCode(MacroAssembler &masm)
JS_ASSERT(ArgumentsRectifierReg != code);
IonCode *argumentsRectifier =
cx->compartment()->ionCompartment()->getArgumentsRectifier(SequentialExecution);
cx->runtime()->ionRuntime()->getArgumentsRectifier(SequentialExecution);
masm.movePtr(ImmGCPtr(argumentsRectifier), code);
masm.loadPtr(Address(code, IonCode::offsetOfCode()), code);
@ -6677,7 +6674,7 @@ ICSetProp_CallScripted::Compiler::generateStubCode(MacroAssembler &masm)
JS_ASSERT(ArgumentsRectifierReg != code);
IonCode *argumentsRectifier =
cx->compartment()->ionCompartment()->getArgumentsRectifier(SequentialExecution);
cx->runtime()->ionRuntime()->getArgumentsRectifier(SequentialExecution);
masm.movePtr(ImmGCPtr(argumentsRectifier), code);
masm.loadPtr(Address(code, IonCode::offsetOfCode()), code);
@ -7435,7 +7432,7 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler &masm)
JS_ASSERT(ArgumentsRectifierReg != argcReg);
IonCode *argumentsRectifier =
cx->compartment()->ionCompartment()->getArgumentsRectifier(SequentialExecution);
cx->runtime()->ionRuntime()->getArgumentsRectifier(SequentialExecution);
masm.movePtr(ImmGCPtr(argumentsRectifier), code);
masm.loadPtr(Address(code, IonCode::offsetOfCode()), code);
@ -7694,7 +7691,7 @@ ICCall_ScriptedApplyArguments::Compiler::generateStubCode(MacroAssembler &masm)
JS_ASSERT(ArgumentsRectifierReg != argcReg);
IonCode *argumentsRectifier =
cx->compartment()->ionCompartment()->getArgumentsRectifier(SequentialExecution);
cx->runtime()->ionRuntime()->getArgumentsRectifier(SequentialExecution);
masm.movePtr(ImmGCPtr(argumentsRectifier), target);
masm.loadPtr(Address(target, IonCode::offsetOfCode()), target);

Просмотреть файл

@ -85,7 +85,7 @@ EnterBaseline(JSContext *cx, EnterJitData &data)
JS_ASSERT(ion::IsBaselineEnabled(cx));
JS_ASSERT_IF(data.osrFrame, CheckFrame(data.osrFrame));
EnterIonCode enter = cx->compartment()->ionCompartment()->enterBaselineJIT();
EnterIonCode enter = cx->runtime()->ionRuntime()->enterBaseline();
// Caller must construct |this| before invoking the Ion function.
JS_ASSERT_IF(data.constructing, data.maxArgv[0].isObject());

Просмотреть файл

@ -1299,7 +1299,7 @@ CodeGenerator::visitOutOfLineCallPostWriteBarrier(OutOfLineCallPostWriteBarrier
}
Register runtimereg = regs.takeAny();
masm.mov(ImmWord(GetIonContext()->compartment->rt), runtimereg);
masm.mov(ImmWord(gen->compartment->rt), runtimereg);
masm.setupUnalignedABICall(2, regs.takeAny());
masm.passABIArg(runtimereg);
@ -1321,7 +1321,7 @@ CodeGenerator::visitPostWriteBarrierO(LPostWriteBarrierO *lir)
if (!addOutOfLineCode(ool))
return false;
Nursery &nursery = GetIonContext()->compartment->rt->gcNursery;
Nursery &nursery = gen->compartment->rt->gcNursery;
if (lir->object()->isConstant()) {
JS_ASSERT(!nursery.isInside(&lir->object()->toConstant()->toObject()));
@ -1353,7 +1353,7 @@ CodeGenerator::visitPostWriteBarrierV(LPostWriteBarrierV *lir)
ValueOperand value = ToValue(lir, LPostWriteBarrierV::Input);
masm.branchTestObject(Assembler::NotEqual, value, ool->rejoin());
Nursery &nursery = GetIonContext()->compartment->rt->gcNursery;
Nursery &nursery = gen->compartment->rt->gcNursery;
if (lir->object()->isConstant()) {
JS_ASSERT(!nursery.isInside(&lir->object()->toConstant()->toObject()));
@ -1645,8 +1645,7 @@ CodeGenerator::visitCallGeneric(LCallGeneric *call)
JS_ASSERT(!call->hasSingleTarget());
// Generate an ArgumentsRectifier.
IonCompartment *ion = gen->ionCompartment();
IonCode *argumentsRectifier = ion->getArgumentsRectifier(executionMode);
IonCode *argumentsRectifier = gen->ionRuntime()->getArgumentsRectifier(executionMode);
masm.checkStackAlignment();
@ -2040,8 +2039,7 @@ CodeGenerator::visitApplyArgsGeneric(LApplyArgsGeneric *apply)
masm.bind(&underflow);
// Hardcode the address of the argumentsRectifier code.
IonCompartment *ion = gen->ionCompartment();
IonCode *argumentsRectifier = ion->getArgumentsRectifier(executionMode);
IonCode *argumentsRectifier = gen->ionRuntime()->getArgumentsRectifier(executionMode);
JS_ASSERT(ArgumentsRectifierReg != objreg);
masm.movePtr(ImmGCPtr(argumentsRectifier), objreg); // Necessary for GC marking.
@ -2082,6 +2080,12 @@ CodeGenerator::visitApplyArgsGeneric(LApplyArgsGeneric *apply)
return true;
}
bool
CodeGenerator::visitBail(LBail *lir)
{
return bailout(lir->snapshot());
}
bool
CodeGenerator::visitGetDynamicName(LGetDynamicName *lir)
{
@ -5058,7 +5062,7 @@ CodeGenerator::visitIteratorStart(LIteratorStart *lir)
masm.or32(Imm32(JSITER_ACTIVE), Address(niTemp, offsetof(NativeIterator, flags)));
// Chain onto the active iterator stack.
masm.movePtr(ImmWord(GetIonContext()->compartment), temp1);
masm.movePtr(ImmWord(gen->compartment), temp1);
masm.loadPtr(Address(temp1, offsetof(JSCompartment, enumerators)), temp1);
// ni->next = list
@ -5369,7 +5373,7 @@ CodeGenerator::generate()
return false;
if (frameClass_ != FrameSizeClass::None()) {
deoptTable_ = GetIonContext()->compartment->ionCompartment()->getBailoutTable(frameClass_);
deoptTable_ = gen->ionRuntime()->getBailoutTable(frameClass_);
if (!deoptTable_)
return false;
}

Просмотреть файл

@ -105,6 +105,7 @@ class CodeGenerator : public CodeGeneratorSpecific
void emitPushArguments(LApplyArgsGeneric *apply, Register extraStackSpace);
void emitPopArguments(LApplyArgsGeneric *apply, Register extraStackSize);
bool visitApplyArgsGeneric(LApplyArgsGeneric *apply);
bool visitBail(LBail *lir);
bool visitGetDynamicName(LGetDynamicName *lir);
bool visitFilterArguments(LFilterArguments *lir);
bool visitCallDirectEval(LCallDirectEval *lir);

Просмотреть файл

@ -429,18 +429,18 @@ IonCompartment::sweep(FreeOp *fop)
}
IonCode *
IonCompartment::getBailoutTable(const FrameSizeClass &frameClass)
IonRuntime::getBailoutTable(const FrameSizeClass &frameClass)
{
JS_ASSERT(frameClass != FrameSizeClass::None());
return rt->bailoutTables_[frameClass.classId()];
return bailoutTables_[frameClass.classId()];
}
IonCode *
IonCompartment::getVMWrapper(const VMFunction &f)
IonRuntime::getVMWrapper(const VMFunction &f)
{
JS_ASSERT(rt->functionWrappers_);
JS_ASSERT(rt->functionWrappers_->initialized());
IonRuntime::VMWrapperMap::Ptr p = rt->functionWrappers_->readonlyThreadsafeLookup(&f);
JS_ASSERT(functionWrappers_);
JS_ASSERT(functionWrappers_->initialized());
IonRuntime::VMWrapperMap::Ptr p = functionWrappers_->readonlyThreadsafeLookup(&f);
JS_ASSERT(p);
return p->value;
@ -1790,7 +1790,7 @@ ion::CanEnterInParallel(JSContext *cx, HandleScript script)
// This can GC, so afterward, script->parallelIon is
// not guaranteed to be valid.
if (!cx->compartment()->ionCompartment()->enterJIT())
if (!cx->runtime()->ionRuntime()->enterIon())
return Method_Error;
// Subtle: it is possible for GC to occur during
@ -1827,7 +1827,7 @@ ion::CanEnterUsingFastInvoke(JSContext *cx, HandleScript script, uint32_t numAct
return Method_Error;
// This can GC, so afterward, script->ion is not guaranteed to be valid.
if (!cx->compartment()->ionCompartment()->enterJIT())
if (!cx->runtime()->ionRuntime()->enterIon())
return Method_Error;
if (!script->hasIonScript())
@ -1843,7 +1843,7 @@ EnterIon(JSContext *cx, EnterJitData &data)
JS_ASSERT(ion::IsEnabled(cx));
JS_ASSERT(!data.osrFrame);
EnterIonCode enter = cx->compartment()->ionCompartment()->enterJIT();
EnterIonCode enter = cx->runtime()->ionRuntime()->enterIon();
// Caller must construct |this| before invoking the Ion function.
JS_ASSERT_IF(data.constructing, data.maxArgv[0].isObject());
@ -1960,7 +1960,7 @@ ion::FastInvoke(JSContext *cx, HandleFunction fun, CallArgs &args)
JitActivation activation(cx, /* firstFrameIsConstructing = */false);
EnterIonCode enter = cx->compartment()->ionCompartment()->enterJIT();
EnterIonCode enter = cx->runtime()->ionRuntime()->enterIon();
void *calleeToken = CalleeToToken(fun);
RootedValue result(cx, Int32Value(args.length()));

Просмотреть файл

@ -6796,6 +6796,11 @@ IonBuilder::jsop_setelem()
break;
}
// Don't generate a fast path if there have been bounds check failures
// and this access might be on a sparse property.
if (ElementAccessHasExtraIndexedProperty(cx, object) && failedBoundsCheck_)
break;
return jsop_setelem_dense(conversion, SetElem_Normal, object, index, value);
} while(false);
}

Просмотреть файл

@ -499,7 +499,6 @@ class IonBuilder : public MIRGenerator
InliningStatus inlineUnsafeGetReservedSlot(CallInfo &callInfo);
// Parallel intrinsics.
InliningStatus inlineForceSequentialOrInParallelSection(CallInfo &callInfo);
InliningStatus inlineNewParallelArray(CallInfo &callInfo);
InliningStatus inlineParallelArray(CallInfo &callInfo);
InliningStatus inlineParallelArrayTail(CallInfo &callInfo,
@ -515,6 +514,10 @@ class IonBuilder : public MIRGenerator
InliningStatus inlineToObject(CallInfo &callInfo);
InliningStatus inlineDump(CallInfo &callInfo);
// Testing functions.
InliningStatus inlineForceSequentialOrInParallelSection(CallInfo &callInfo);
InliningStatus inlineBailout(CallInfo &callInfo);
// Main inlining functions
InliningStatus inlineNativeCall(CallInfo &callInfo, JSNative native);
bool inlineScriptedCall(CallInfo &callInfo, JSFunction *target);

Просмотреть файл

@ -2655,6 +2655,23 @@ IsElementSetInlineable(HandleObject obj, HandleValue index)
if (!index.isInt32())
return false;
// The object may have a setter definition,
// either directly, or via a prototype, or via the target object for a prototype
// which is a proxy, that handles a particular integer write.
// Scan the prototype and shape chain to make sure that this is not the case.
JSObject *curObj = obj;
while (curObj) {
// Ensure object is native.
if (!curObj->isNative())
return false;
// Ensure all indexed properties are stored in dense elements.
if (curObj->isIndexed())
return false;
curObj = curObj->getProto();
}
return true;
}

Просмотреть файл

@ -187,8 +187,6 @@ class IonRuntime
IonCode *generateDebugTrapHandler(JSContext *cx);
IonCode *generateVMWrapper(JSContext *cx, const VMFunction &f);
IonCode *debugTrapHandler(JSContext *cx);
public:
IonRuntime();
~IonRuntime();
@ -206,6 +204,55 @@ class IonRuntime
if (!flusher_ || !fl)
flusher_ = fl;
}
IonCode *getVMWrapper(const VMFunction &f);
IonCode *debugTrapHandler(JSContext *cx);
IonCode *getGenericBailoutHandler() const {
return bailoutHandler_;
}
IonCode *getExceptionTail() const {
return exceptionTail_;
}
IonCode *getBailoutTail() const {
return bailoutTail_;
}
IonCode *getBailoutTable(const FrameSizeClass &frameClass);
IonCode *getArgumentsRectifier(ExecutionMode mode) const {
switch (mode) {
case SequentialExecution: return argumentsRectifier_;
case ParallelExecution: return parallelArgumentsRectifier_;
default: MOZ_ASSUME_UNREACHABLE("No such execution mode");
}
}
void *getArgumentsRectifierReturnAddr() const {
return argumentsRectifierReturnAddr_;
}
IonCode *getInvalidationThunk() const {
return invalidator_;
}
EnterIonCode enterIon() const {
return enterJIT_->as<EnterIonCode>();
}
EnterIonCode enterBaseline() const {
return enterBaselineJIT_->as<EnterIonCode>();
}
IonCode *valuePreBarrier() const {
return valuePreBarrier_;
}
IonCode *shapePreBarrier() const {
return shapePreBarrier_;
}
};
class IonCompartment
@ -244,8 +291,6 @@ class IonCompartment
IonCode *generateStringConcatStub(JSContext *cx, ExecutionMode mode);
public:
IonCode *getVMWrapper(const VMFunction &f);
OffThreadCompilationVector &finishedOffThreadCompilations() {
return finishedOffThreadCompilations_;
}
@ -307,56 +352,6 @@ class IonCompartment
return rt->execAlloc_;
}
IonCode *getGenericBailoutHandler() {
return rt->bailoutHandler_;
}
IonCode *getExceptionTail() {
return rt->exceptionTail_;
}
IonCode *getBailoutTail() {
return rt->bailoutTail_;
}
IonCode *getBailoutTable(const FrameSizeClass &frameClass);
IonCode *getArgumentsRectifier(ExecutionMode mode) {
switch (mode) {
case SequentialExecution: return rt->argumentsRectifier_;
case ParallelExecution: return rt->parallelArgumentsRectifier_;
default: MOZ_ASSUME_UNREACHABLE("No such execution mode");
}
}
void *getArgumentsRectifierReturnAddr() {
return rt->argumentsRectifierReturnAddr_;
}
IonCode *getInvalidationThunk() {
return rt->invalidator_;
}
EnterIonCode enterJIT() {
return rt->enterJIT_->as<EnterIonCode>();
}
EnterIonCode enterBaselineJIT() {
return rt->enterBaselineJIT_->as<EnterIonCode>();
}
IonCode *valuePreBarrier() {
return rt->valuePreBarrier_;
}
IonCode *shapePreBarrier() {
return rt->shapePreBarrier_;
}
IonCode *debugTrapHandler(JSContext *cx) {
return rt->debugTrapHandler(cx);
}
IonCode *stringConcatStub(ExecutionMode mode) {
switch (mode) {
case SequentialExecution: return stringConcatStub_;

Просмотреть файл

@ -498,10 +498,10 @@ class MacroAssembler : public MacroAssemblerSpecific
Push(PreBarrierReg);
computeEffectiveAddress(address, PreBarrierReg);
JSCompartment *compartment = GetIonContext()->compartment;
JSRuntime *runtime = GetIonContext()->runtime;
IonCode *preBarrier = (type == MIRType_Shape)
? compartment->ionCompartment()->shapePreBarrier()
: compartment->ionCompartment()->valuePreBarrier();
? runtime->ionRuntime()->shapePreBarrier()
: runtime->ionRuntime()->valuePreBarrier();
call(preBarrier);
Pop(PreBarrierReg);

Просмотреть файл

@ -1062,6 +1062,12 @@ class LCallDOMNative : public LJSCallInstructionHelper<BOX_PIECES, 0, 4>
}
};
class LBail : public LInstructionHelper<0, 0, 0>
{
public:
LIR_HEADER(Bail)
};
template <size_t defs, size_t ops>
class LDOMPropertyInstructionHelper : public LCallInstructionHelper<defs, 1 + ops, 3>
{

Просмотреть файл

@ -44,6 +44,7 @@
_(CallGeneric) \
_(CallNative) \
_(ApplyArgsGeneric) \
_(Bail) \
_(GetDynamicName) \
_(FilterArguments) \
_(CallDirectEval) \

Просмотреть файл

@ -476,6 +476,13 @@ LIRGenerator::visitApplyArgs(MApplyArgs *apply)
return true;
}
bool
LIRGenerator::visitBail(MBail *bail)
{
LBail *lir = new LBail();
return assignSnapshot(lir) && add(lir, bail);
}
bool
LIRGenerator::visitGetDynamicName(MGetDynamicName *ins)
{

Просмотреть файл

@ -112,6 +112,7 @@ class LIRGenerator : public LIRGeneratorSpecific
bool visitReturnFromCtor(MReturnFromCtor *ins);
bool visitCall(MCall *call);
bool visitApplyArgs(MApplyArgs *apply);
bool visitBail(MBail *bail);
bool visitGetDynamicName(MGetDynamicName *ins);
bool visitFilterArguments(MFilterArguments *ins);
bool visitCallDirectEval(MCallDirectEval *ins);

Просмотреть файл

@ -130,8 +130,6 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSNative native)
// Parallel intrinsics.
if (native == intrinsic_ShouldForceSequential)
return inlineForceSequentialOrInParallelSection(callInfo);
if (native == testingFunc_inParallelSection)
return inlineForceSequentialOrInParallelSection(callInfo);
if (native == intrinsic_NewParallelArray)
return inlineNewParallelArray(callInfo);
if (native == ParallelArrayObject::construct)
@ -147,6 +145,12 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSNative native)
if (native == intrinsic_ToObject)
return inlineToObject(callInfo);
// Testing Functions
if (native == testingFunc_inParallelSection)
return inlineForceSequentialOrInParallelSection(callInfo);
if (native == testingFunc_bailout)
return inlineBailout(callInfo);
return InliningStatus_NotInlined;
}
@ -1498,5 +1502,17 @@ IonBuilder::inlineToObject(CallInfo &callInfo)
return InliningStatus_Inlined;
}
IonBuilder::InliningStatus
IonBuilder::inlineBailout(CallInfo &callInfo)
{
callInfo.unwrapArgs();
current->add(MBail::New());
MConstant *undefined = MConstant::New(UndefinedValue());
current->push(undefined);
return InliningStatus_Inlined;
}
} // namespace ion
} // namespace js

Просмотреть файл

@ -1796,6 +1796,24 @@ class MApplyArgs
}
};
class MBail : public MNullaryInstruction
{
protected:
MBail()
{
setGuard();
}
public:
INSTRUCTION_HEADER(Bail)
static MBail *
New() {
return new MBail();
}
};
class MGetDynamicName
: public MAryInstruction<2>,
public MixPolicy<ObjectPolicy<0>, StringPolicy<1> >

Просмотреть файл

@ -59,6 +59,9 @@ class MIRGenerator
IonCompartment *ionCompartment() const {
return compartment->ionCompartment();
}
IonRuntime *ionRuntime() const {
return compartment->rt->ionRuntime();
}
CompileInfo &info() {
return *info_;
}
@ -115,21 +118,12 @@ class MIRGenerator
JS_ASSERT(compilingAsmJS());
return performsAsmJSCall_;
}
#ifndef JS_CPU_ARM
bool noteHeapAccess(AsmJSHeapAccess heapAccess) {
return asmJSHeapAccesses_.append(heapAccess);
}
const Vector<AsmJSHeapAccess, 0, IonAllocPolicy> &heapAccesses() const {
return asmJSHeapAccesses_;
}
#else
bool noteBoundsCheck(uint32_t offsetBefore) {
return asmJSBoundsChecks_.append(AsmJSBoundsCheck(offsetBefore));
}
const Vector<AsmJSBoundsCheck, 0, IonAllocPolicy> &asmBoundsChecks() const {
return asmJSBoundsChecks_;
}
#endif
bool noteGlobalAccess(unsigned offset, unsigned globalDataOffset) {
return asmJSGlobalAccesses_.append(AsmJSGlobalAccess(offset, globalDataOffset));
}
@ -151,11 +145,7 @@ class MIRGenerator
uint32_t maxAsmJSStackArgBytes_;
bool performsAsmJSCall_;
#ifdef JS_CPU_ARM
AsmJSBoundsCheckVector asmJSBoundsChecks_;
#else
AsmJSHeapAccessVector asmJSHeapAccesses_;
#endif
AsmJSGlobalAccessVector asmJSGlobalAccesses_;
#if defined(JS_ION_PERF)

Просмотреть файл

@ -39,6 +39,7 @@ namespace ion {
_(PassArg) \
_(Call) \
_(ApplyArgs) \
_(Bail) \
_(GetDynamicName) \
_(FilterArguments) \
_(CallDirectEval) \

Просмотреть файл

@ -133,6 +133,7 @@ class ParallelSafetyVisitor : public MInstructionVisitor
SAFE_OP(PassArg)
CUSTOM_OP(Call)
UNSAFE_OP(ApplyArgs)
UNSAFE_OP(Bail)
UNSAFE_OP(GetDynamicName)
UNSAFE_OP(FilterArguments)
UNSAFE_OP(CallDirectEval)

Просмотреть файл

@ -785,77 +785,60 @@ class ABIArg
class AsmJSHeapAccess
{
uint32_t offset_;
uint8_t opLength_;
#if defined(JS_CPU_X86)
uint8_t cmpDelta_;
uint8_t cmpDelta_; // the number of bytes from the cmp to the load/store instruction
#endif
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
uint8_t opLength_; // the length of the load/store instruction
uint8_t isFloat32Load_;
ion::AnyRegister::Code loadedReg_ : 8;
#endif
JS_STATIC_ASSERT(ion::AnyRegister::Total < UINT8_MAX);
public:
#if defined(JS_CPU_X86)
AsmJSHeapAccess(uint32_t cmp, uint32_t offset, uint32_t after, ArrayBufferView::ViewType vt,
AnyRegister loadedReg)
: offset_(offset),
opLength_(after - offset),
cmpDelta_(offset - cmp),
isFloat32Load_(vt == ArrayBufferView::TYPE_FLOAT32),
loadedReg_(loadedReg.code())
{}
AsmJSHeapAccess(uint32_t cmp, uint32_t offset, uint8_t after)
: offset_(offset),
opLength_(after - offset),
cmpDelta_(offset - cmp),
isFloat32Load_(false),
loadedReg_(UINT8_MAX)
{}
#else
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
AsmJSHeapAccess(uint32_t offset, uint32_t after, ArrayBufferView::ViewType vt,
AnyRegister loadedReg)
AnyRegister loadedReg, uint32_t cmp = UINT32_MAX)
: offset_(offset),
# if defined(JS_CPU_X86)
cmpDelta_(offset - cmp),
# endif
opLength_(after - offset),
isFloat32Load_(vt == ArrayBufferView::TYPE_FLOAT32),
loadedReg_(loadedReg.code())
{}
AsmJSHeapAccess(uint32_t offset, uint8_t after)
AsmJSHeapAccess(uint32_t offset, uint8_t after, uint32_t cmp = UINT32_MAX)
: offset_(offset),
# if defined(JS_CPU_X86)
cmpDelta_(offset - cmp),
# endif
opLength_(after - offset),
isFloat32Load_(false),
loadedReg_(UINT8_MAX)
{}
#elif defined(JS_CPU_ARM)
explicit AsmJSHeapAccess(uint32_t offset)
: offset_(offset)
{}
#endif
uint32_t offset() const { return offset_; }
unsigned opLength() const { return opLength_; }
bool isLoad() const { return loadedReg_ != UINT8_MAX; }
bool isFloat32Load() const { return isFloat32Load_; }
ion::AnyRegister loadedReg() const { return ion::AnyRegister::FromCode(loadedReg_); }
void setOffset(uint32_t offset) { offset_ = offset; }
#if defined(JS_CPU_X86)
void *patchLengthAt(uint8_t *code) const { return code + (offset_ - cmpDelta_); }
void *patchOffsetAt(uint8_t *code) const { return code + (offset_ + opLength_); }
#endif
void updateOffset(uint32_t offset) { offset_ = offset; }
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
unsigned opLength() const { return opLength_; }
bool isLoad() const { return loadedReg_ != UINT8_MAX; }
bool isFloat32Load() const { return isFloat32Load_; }
ion::AnyRegister loadedReg() const { return ion::AnyRegister::FromCode(loadedReg_); }
#endif
};
typedef Vector<AsmJSHeapAccess, 0, IonAllocPolicy> AsmJSHeapAccessVector;
#ifdef JS_CPU_ARM
struct AsmJSBoundsCheck
{
unsigned offset_;
AsmJSBoundsCheck(unsigned offset)
: offset_(offset)
{}
void setOffset(uint32_t offset) { offset_ = offset; }
unsigned offset() {return offset_;}
};
typedef Vector<AsmJSBoundsCheck, 0, IonAllocPolicy> AsmJSBoundsCheckVector;
#endif
} // namespace ion
} // namespace js

Просмотреть файл

@ -132,9 +132,8 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
// Compute the snapshot offset from the bailout ID.
JitActivation *activation = activations.activation()->asJit();
JSCompartment *jsCompartment = activation->compartment();
IonCompartment *ionCompartment = jsCompartment->ionCompartment();
IonCode *code = ionCompartment->getBailoutTable(bailout->frameClass());
JSRuntime *rt = activation->compartment()->rt;
IonCode *code = rt->ionRuntime()->getBailoutTable(bailout->frameClass());
uintptr_t tableOffset = bailout->tableOffset();
uintptr_t tableStart = reinterpret_cast<uintptr_t>(code->raw());

Просмотреть файл

@ -161,9 +161,7 @@ CodeGeneratorARM::generateOutOfLineCode()
// Push the frame size, so the handler can recover the IonScript.
masm.ma_mov(Imm32(frameSize()), lr);
IonCompartment *ion = GetIonContext()->compartment->ionCompartment();
IonCode *handler = ion->getGenericBailoutHandler();
IonCode *handler = gen->ionRuntime()->getGenericBailoutHandler();
masm.branch(handler);
}
@ -1731,7 +1729,7 @@ CodeGeneratorARM::generateInvalidateEpilogue()
// Push the Ion script onto the stack (when we determine what that pointer is).
invalidateEpilogueData_ = masm.pushWithPatch(ImmWord(uintptr_t(-1)));
IonCode *thunk = GetIonContext()->compartment->ionCompartment()->getInvalidationThunk();
IonCode *thunk = gen->ionRuntime()->getInvalidationThunk();
masm.branch(thunk);
@ -1808,7 +1806,7 @@ CodeGeneratorARM::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins)
ToRegister(ins->output()), Offset, Assembler::Zero);
masm.ma_mov(Imm32(0), ToRegister(ins->output()), NoSetCond, Assembler::NonZero);
}
return gen->noteBoundsCheck(bo.getOffset());
return gen->noteHeapAccess(AsmJSHeapAccess(bo.getOffset()));
}
bool
@ -1846,7 +1844,7 @@ CodeGeneratorARM::visitAsmJSStoreHeap(LAsmJSStoreHeap *ins)
masm.ma_dataTransferN(IsStore, size, isSigned, HeapReg, index,
ToRegister(ins->value()), Offset, Assembler::Zero);
}
return gen->noteBoundsCheck(bo.getOffset());
return gen->noteHeapAccess(AsmJSHeapAccess(bo.getOffset()));
}
bool

Просмотреть файл

@ -3304,7 +3304,7 @@ MacroAssemblerARMCompat::handleFailureWithHandler(void *handler)
passABIArg(r0);
callWithABI(handler);
IonCode *excTail = GetIonContext()->compartment->ionCompartment()->getExceptionTail();
IonCode *excTail = GetIonContext()->runtime->ionRuntime()->getExceptionTail();
branch(excTail);
}

Просмотреть файл

@ -349,7 +349,7 @@ IonRuntime::generateInvalidator(JSContext *cx)
masm.ma_add(sp, r1, sp);
// Jump to shared bailout tail. The BailoutInfo pointer has to be in r2.
IonCode *bailoutTail = cx->compartment()->ionCompartment()->getBailoutTail();
IonCode *bailoutTail = cx->runtime()->ionRuntime()->getBailoutTail();
masm.branch(bailoutTail);
Linker linker(masm);
@ -553,7 +553,7 @@ GenerateBailoutThunk(JSContext *cx, MacroAssembler &masm, uint32_t frameClass)
}
// Jump to shared bailout tail. The BailoutInfo pointer has to be in r2.
IonCode *bailoutTail = cx->compartment()->ionCompartment()->getBailoutTail();
IonCode *bailoutTail = cx->runtime()->ionRuntime()->getBailoutTail();
masm.branch(bailoutTail);
}
@ -806,8 +806,7 @@ IonRuntime::generateDebugTrapHandler(JSContext *cx)
masm.movePtr(ImmWord((void *)NULL), BaselineStubReg);
EmitEnterStubFrame(masm, scratch2);
IonCompartment *ion = cx->compartment()->ionCompartment();
IonCode *code = ion->getVMWrapper(HandleDebugTrapInfo);
IonCode *code = cx->runtime()->ionRuntime()->getVMWrapper(HandleDebugTrapInfo);
if (!code)
return NULL;

Просмотреть файл

@ -33,8 +33,7 @@ BaselineCompilerShared::BaselineCompilerShared(JSContext *cx, HandleScript scrip
bool
BaselineCompilerShared::callVM(const VMFunction &fun)
{
IonCompartment *ion = cx->compartment()->ionCompartment();
IonCode *code = ion->getVMWrapper(fun);
IonCode *code = cx->runtime()->ionRuntime()->getVMWrapper(fun);
if (!code)
return false;

Просмотреть файл

@ -445,8 +445,7 @@ CodeGeneratorShared::callVM(const VMFunction &fun, LInstruction *ins, const Regi
#endif
// Get the wrapper of the VM function.
IonCompartment *ion = GetIonContext()->compartment->ionCompartment();
IonCode *wrapper = ion->getVMWrapper(fun);
IonCode *wrapper = gen->ionRuntime()->getVMWrapper(fun);
if (!wrapper)
return false;

Просмотреть файл

@ -245,9 +245,7 @@ CodeGeneratorX86Shared::generateOutOfLineCode()
// Push the frame size, so the handler can recover the IonScript.
masm.push(Imm32(frameSize()));
IonCompartment *ion = GetIonContext()->compartment->ionCompartment();
IonCode *handler = ion->getGenericBailoutHandler();
IonCode *handler = gen->ionRuntime()->getGenericBailoutHandler();
masm.jmp(handler->raw(), Relocation::IONCODE);
}
@ -1476,7 +1474,7 @@ CodeGeneratorX86Shared::generateInvalidateEpilogue()
// Push the Ion script onto the stack (when we determine what that pointer is).
invalidateEpilogueData_ = masm.pushWithPatch(ImmWord(uintptr_t(-1)));
IonCode *thunk = GetIonContext()->compartment->ionCompartment()->getInvalidationThunk();
IonCode *thunk = gen->ionRuntime()->getInvalidationThunk();
masm.call(thunk);

Просмотреть файл

@ -242,7 +242,7 @@ MacroAssemblerX64::handleFailureWithHandler(void *handler)
passABIArg(rax);
callWithABI(handler);
IonCode *excTail = GetIonContext()->compartment->ionCompartment()->getExceptionTail();
IonCode *excTail = GetIonContext()->runtime->ionRuntime()->getExceptionTail();
jmp(excTail);
}

Просмотреть файл

@ -312,7 +312,7 @@ IonRuntime::generateInvalidator(JSContext *cx)
masm.lea(Operand(rsp, rbx, TimesOne, sizeof(InvalidationBailoutStack)), rsp);
// Jump to shared bailout tail. The BailoutInfo pointer has to be in r9.
IonCode *bailoutTail = cx->compartment()->ionCompartment()->getBailoutTail();
IonCode *bailoutTail = cx->runtime()->ionRuntime()->getBailoutTail();
masm.jmp(bailoutTail);
Linker linker(masm);
@ -446,7 +446,7 @@ GenerateBailoutThunk(JSContext *cx, MacroAssembler &masm, uint32_t frameClass)
masm.lea(Operand(rsp, rcx, TimesOne, sizeof(void *)), rsp);
// Jump to shared bailout tail. The BailoutInfo pointer has to be in r9.
IonCode *bailoutTail = cx->compartment()->ionCompartment()->getBailoutTail();
IonCode *bailoutTail = cx->runtime()->ionRuntime()->getBailoutTail();
masm.jmp(bailoutTail);
}
@ -698,8 +698,7 @@ IonRuntime::generateDebugTrapHandler(JSContext *cx)
masm.movePtr(ImmWord((void *)NULL), BaselineStubReg);
EmitEnterStubFrame(masm, scratch3);
IonCompartment *ion = cx->compartment()->ionCompartment();
IonCode *code = ion->getVMWrapper(HandleDebugTrapInfo);
IonCode *code = cx->runtime()->ionRuntime()->getVMWrapper(HandleDebugTrapInfo);
if (!code)
return NULL;

Просмотреть файл

@ -85,9 +85,8 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
// Compute the snapshot offset from the bailout ID.
JitActivation *activation = activations.activation()->asJit();
JSCompartment *jsCompartment = activation->compartment();
IonCompartment *ionCompartment = jsCompartment->ionCompartment();
IonCode *code = ionCompartment->getBailoutTable(bailout->frameClass());
JSRuntime *rt = activation->compartment()->rt;
IonCode *code = rt->ionRuntime()->getBailoutTable(bailout->frameClass());
uintptr_t tableOffset = bailout->tableOffset();
uintptr_t tableStart = reinterpret_cast<uintptr_t>(code->raw());

Просмотреть файл

@ -496,13 +496,13 @@ CodeGeneratorX86::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins)
uint32_t after = masm.size();
masm.cvtss2sd(dest, dest);
masm.bind(ool->rejoin());
return gen->noteHeapAccess(AsmJSHeapAccess(cmp.offset(), before, after, vt, AnyRegister(dest)));
return gen->noteHeapAccess(AsmJSHeapAccess(before, after, vt, AnyRegister(dest), cmp.offset()));
}
uint32_t before = masm.size();
loadViewTypeElement(vt, srcAddr, out);
uint32_t after = masm.size();
masm.bind(ool->rejoin());
return gen->noteHeapAccess(AsmJSHeapAccess(cmp.offset(), before, after, vt, ToAnyRegister(out)));
return gen->noteHeapAccess(AsmJSHeapAccess(before, after, vt, ToAnyRegister(out), cmp.offset()));
}
bool
@ -583,13 +583,13 @@ CodeGeneratorX86::visitAsmJSStoreHeap(LAsmJSStoreHeap *ins)
masm.movssWithPatch(ScratchFloatReg, dstAddr);
uint32_t after = masm.size();
masm.bind(&rejoin);
return gen->noteHeapAccess(AsmJSHeapAccess(cmp.offset(), before, after));
return gen->noteHeapAccess(AsmJSHeapAccess(before, after, cmp.offset()));
}
uint32_t before = masm.size();
storeViewTypeElement(vt, value, dstAddr);
uint32_t after = masm.size();
masm.bind(&rejoin);
return gen->noteHeapAccess(AsmJSHeapAccess(cmp.offset(), before, after));
return gen->noteHeapAccess(AsmJSHeapAccess(before, after, cmp.offset()));
}
bool

Просмотреть файл

@ -214,7 +214,7 @@ MacroAssemblerX86::handleFailureWithHandler(void *handler)
passABIArg(eax);
callWithABI(handler);
IonCode *excTail = GetIonContext()->compartment->ionCompartment()->getExceptionTail();
IonCode *excTail = GetIonContext()->runtime->ionRuntime()->getExceptionTail();
jmp(excTail);
}

Просмотреть файл

@ -298,7 +298,7 @@ IonRuntime::generateInvalidator(JSContext *cx)
masm.lea(Operand(esp, ebx, TimesOne, sizeof(InvalidationBailoutStack)), esp);
// Jump to shared bailout tail. The BailoutInfo pointer has to be in ecx.
IonCode *bailoutTail = cx->compartment()->ionCompartment()->getBailoutTail();
IonCode *bailoutTail = cx->runtime()->ionRuntime()->getBailoutTail();
masm.jmp(bailoutTail);
Linker linker(masm);
@ -461,7 +461,7 @@ GenerateBailoutThunk(JSContext *cx, MacroAssembler &masm, uint32_t frameClass)
}
// Jump to shared bailout tail. The BailoutInfo pointer has to be in ecx.
IonCode *bailoutTail = cx->compartment()->ionCompartment()->getBailoutTail();
IonCode *bailoutTail = cx->runtime()->ionRuntime()->getBailoutTail();
masm.jmp(bailoutTail);
}
@ -724,8 +724,7 @@ IonRuntime::generateDebugTrapHandler(JSContext *cx)
masm.movePtr(ImmWord((void *)NULL), BaselineStubReg);
EmitEnterStubFrame(masm, scratch3);
IonCompartment *ion = cx->compartment()->ionCompartment();
IonCode *code = ion->getVMWrapper(HandleDebugTrapInfo);
IonCode *code = cx->runtime()->ionRuntime()->getVMWrapper(HandleDebugTrapInfo);
if (!code)
return NULL;

Просмотреть файл

@ -19,6 +19,12 @@ assertEq(asmLink(asmCompile(USE_ASM + 'function f() { return 10.0 } function g()
assertEq(asmLink(asmCompile(USE_ASM + 'function f() { return -10.0 } function g() { var d=0.1; d=+f(); return +d } return g'))(), -10.0);
assertAsmTypeFail(USE_ASM + "function f(i) { i=i|0; var j=1e10; j=i; return j|0 } return f");
assertAsmTypeFail(USE_ASM + "function f(i) { i=i|0; var j=9007199254740991e0; j=i; return j|0 } return f");
assertAsmTypeFail(USE_ASM + "function f(i) { i=i|0; var j=9007199254740992e0; j=i; return j|0 } return f");
assertAsmTypeFail(USE_ASM + "function f(i) { i=i|0; var j=9007199254740993e0; j=i; return j|0 } return f");
assertAsmTypeFail(USE_ASM + "function f(i) { i=i|0; var j=-9007199254740991e0; j=i; return j|0 } return f");
assertAsmTypeFail(USE_ASM + "function f(i) { i=i|0; var j=-9007199254740992e0; j=i; return j|0 } return f");
assertAsmTypeFail(USE_ASM + "function f(i) { i=i|0; var j=-9007199254740993e0; j=i; return j|0 } return f");
assertAsmTypeFail(USE_ASM + "function f(i) { i=i|0; var j=1e100; j=i; return j|0 } return f");
assertAsmTypeFail(USE_ASM + "function f(i) { i=i|0; var j=1e10000; j=i; return j|0 } return f");
assertAsmTypeFail(USE_ASM + "function f(i) { i=i|0; var j=1000000000000000000; j=i; return j|0 } return f");

Просмотреть файл

@ -1,5 +1,3 @@
var bailout = Proxy.createFunction({}, Math.sin);
var seen = -1;
// Test to make sure the jits get the number of calls, and return value

Просмотреть файл

@ -122,7 +122,6 @@ assertEq(args[2], 6);
//////////////////
var bailout = Proxy.createFunction({}, Math.sin);
function arg_len2() { assertEq(arguments.length, 4); }
function bailing_arg_len(a) {
if (a == 90) {

Просмотреть файл

@ -1,7 +1,6 @@
var o;
var f1;
var counter = 0;
var bailout = Proxy.createFunction({}, Math.sin);
function f2(a) {
bailout();

Просмотреть файл

@ -1247,7 +1247,7 @@ class ParallelIonInvoke
public:
Value *args;
ParallelIonInvoke(JSCompartment *compartment,
ParallelIonInvoke(JSRuntime *rt,
HandleFunction callee,
uint32_t argc)
: argc_(argc),
@ -1263,7 +1263,7 @@ class ParallelIonInvoke
IonScript *ion = callee->nonLazyScript()->parallelIonScript();
IonCode *code = ion->method();
jitcode_ = code->raw();
enter_ = compartment->ionCompartment()->enterJIT();
enter_ = rt->ionRuntime()->enterIon();
calleeToken_ = CalleeToParallelToken(callee);
}
@ -1470,7 +1470,7 @@ ForkJoinShared::executePortion(PerThreadData *perThread,
NULL, NULL, NULL);
setAbortFlag(false);
} else {
ParallelIonInvoke<3> fii(cx_->compartment(), callee, 3);
ParallelIonInvoke<3> fii(cx_->runtime(), callee, 3);
fii.args[0] = Int32Value(slice.sliceId);
fii.args[1] = Int32Value(slice.numSlices);

Просмотреть файл

@ -383,54 +383,79 @@ DEFINE_CC_TYPE_NAME_FUNCTION (lamp_state, CC_TYPE,
//define cause_getname(cc_cause_t);
DEFINE_CC_TYPE_NAME_FUNCTION (cause, CC_TYPE,
ENAME_DECL(CC_CAUSE_MIN),
ENAME_DECL(CC_CAUSE_BASE),
ENAME_DECL(CC_CAUSE_OK),
ENAME_DECL(CC_CAUSE_ERROR),
ENAME_DECL(CC_CAUSE_UNASSIGNED_NUM),
ENAME_DECL(CC_CAUSE_NO_RESOURCE),
ENAME_DECL(CC_CAUSE_NO_ROUTE),
ENAME_DECL(CC_CAUSE_NORMAL),
ENAME_DECL(CC_CAUSE_BUSY),
ENAME_DECL(CC_CAUSE_NO_USER_RESP),
ENAME_DECL(CC_CAUSE_NO_USER_ANS),
ENAME_DECL(CC_CAUSE_REJECT),
ENAME_DECL(CC_CAUSE_INVALID_NUMBER),
ENAME_DECL(CC_CAUSE_FACILITY_REJECTED),
ENAME_DECL(CC_CAUSE_CALL_ID_IN_USE),
ENAME_DECL(CC_CAUSE_XFER_LOCAL),
ENAME_DECL(CC_CAUSE_XFER_REMOTE),
ENAME_DECL(CC_CAUSE_XFER_BY_REMOTE),
ENAME_DECL(CC_CAUSE_XFER_CNF),
ENAME_DECL(CC_CAUSE_CONGESTION),
ENAME_DECL(CC_CAUSE_ANONYMOUS),
ENAME_DECL(CC_CAUSE_REDIRECT),
ENAME_DECL(CC_CAUSE_PAYLOAD_MISMATCH),
ENAME_DECL(CC_CAUSE_CONF),
ENAME_DECL(CC_CAUSE_REPLACE),
ENAME_DECL(CC_CAUSE_NO_REPLACE_CALL),
ENAME_DECL(CC_CAUSE_NO_RESUME),
ENAME_DECL(CC_CAUSE_NO_MEDIA),
ENAME_DECL(CC_CAUSE_REQUEST_PENDING),
ENAME_DECL(CC_CAUSE_INVALID_PARTICIPANT),
ENAME_DECL(CC_CAUSE_NO_CNF_BRIDE),
ENAME_DECL(CC_MAXIMUM_PARTICIPANT),
ENAME_DECL(CC_KEY_NOT_ACTIVE),
ENAME_DECL(CC_TEMP_NOT_AVAILABLE),
ENAME_DECL(CC_CAUSE_REMOTE_SERVER_ERROR),
ENAME_DECL(CC_CAUSE_NOT_FOUND),
ENAME_DECL(CC_CAUSE_SECURITY_FAILURE),
ENAME_DECL(CC_CAUSE_MONITOR),
ENAME_DECL(CC_CAUSE_UI_STATE_BUSY),
ENAME_DECL(CC_SIP_CAUSE_ANSWERED_ELSEWHERE),
ENAME_DECL(CC_CAUSE_RETRIEVED),
ENAME_DECL(CC_CAUSE_FORWARDED),
ENAME_DECL(CC_CAUSE_ABANDONED),
ENAME_DECL(CC_CAUSE_XFER_LOCAL_WITH_DIALSTRING),
ENAME_DECL(CC_CAUSE_BW_OK),
ENAME_DECL(CC_CAUSE_XFER_COMPLETE),
ENAME_DECL(CC_CAUSE_RESP_TIMEOUT),
ENAME_DECL(CC_CAUSE_MAX)
ENAME_DECL(CC_CAUSE_MIN),
ENAME_DECL(CC_CAUSE_BASE),
ENAME_DECL(CC_CAUSE_OK),
ENAME_DECL(CC_CAUSE_ERROR),
ENAME_DECL(CC_CAUSE_UNASSIGNED_NUM),
ENAME_DECL(CC_CAUSE_NO_RESOURCE),
ENAME_DECL(CC_CAUSE_NO_ROUTE),
ENAME_DECL(CC_CAUSE_NORMAL),
ENAME_DECL(CC_CAUSE_BUSY),
ENAME_DECL(CC_CAUSE_NO_USER_RESP),
ENAME_DECL(CC_CAUSE_NO_USER_ANS),
ENAME_DECL(CC_CAUSE_REJECT),
ENAME_DECL(CC_CAUSE_INVALID_NUMBER),
ENAME_DECL(CC_CAUSE_FACILITY_REJECTED),
ENAME_DECL(CC_CAUSE_CALL_ID_IN_USE),
ENAME_DECL(CC_CAUSE_XFER_LOCAL),
ENAME_DECL(CC_CAUSE_XFER_REMOTE),
ENAME_DECL(CC_CAUSE_XFER_BY_REMOTE),
ENAME_DECL(CC_CAUSE_XFER_CNF),
ENAME_DECL(CC_CAUSE_CONGESTION),
ENAME_DECL(CC_CAUSE_ANONYMOUS),
ENAME_DECL(CC_CAUSE_REDIRECT),
ENAME_DECL(CC_CAUSE_PAYLOAD_MISMATCH),
ENAME_DECL(CC_CAUSE_CONF),
ENAME_DECL(CC_CAUSE_REPLACE),
ENAME_DECL(CC_CAUSE_NO_REPLACE_CALL),
ENAME_DECL(CC_CAUSE_NO_RESUME),
ENAME_DECL(CC_CAUSE_NO_MEDIA),
ENAME_DECL(CC_CAUSE_REQUEST_PENDING),
ENAME_DECL(CC_CAUSE_INVALID_PARTICIPANT),
ENAME_DECL(CC_CAUSE_NO_CNF_BRIDE),
ENAME_DECL(CC_MAXIMUM_PARTICIPANT),
ENAME_DECL(CC_KEY_NOT_ACTIVE),
ENAME_DECL(CC_TEMP_NOT_AVAILABLE),
ENAME_DECL(CC_CAUSE_REMOTE_SERVER_ERROR),
ENAME_DECL(CC_CAUSE_NOT_FOUND),
ENAME_DECL(CC_CAUSE_SECURITY_FAILURE),
ENAME_DECL(CC_CAUSE_MONITOR),
ENAME_DECL(CC_CAUSE_UI_STATE_BUSY),
ENAME_DECL(CC_SIP_CAUSE_ANSWERED_ELSEWHERE),
ENAME_DECL(CC_CAUSE_RETRIEVED),
ENAME_DECL(CC_CAUSE_FORWARDED),
ENAME_DECL(CC_CAUSE_ABANDONED),
ENAME_DECL(CC_CAUSE_XFER_LOCAL_WITH_DIALSTRING),
ENAME_DECL(CC_CAUSE_BW_OK),
ENAME_DECL(CC_CAUSE_XFER_COMPLETE),
ENAME_DECL(CC_CAUSE_RESP_TIMEOUT),
ENAME_DECL(CC_CAUSE_SERV_ERR_UNAVAIL),
ENAME_DECL(CC_CAUSE_REMOTE_DISCONN_REQ_PLAYTONE),
ENAME_DECL(CC_CAUSE_OUT_OF_MEM),
ENAME_DECL(CC_CAUSE_VALUE_NOT_FOUND),
ENAME_DECL(CC_CAUSE_BAD_ICE_ATTRIBUTE),
ENAME_DECL(CC_CAUSE_DTLS_ATTRIBUTE_ERROR),
ENAME_DECL(CC_CAUSE_DTLS_DIGEST_ALGORITHM_EMPTY),
ENAME_DECL(CC_CAUSE_DTLS_DIGEST_ALGORITHM_TOO_LONG),
ENAME_DECL(CC_CAUSE_DTLS_DIGEST_EMPTY),
ENAME_DECL(CC_CAUSE_DTLS_DIGEST_TOO_LONG),
ENAME_DECL(CC_CAUSE_DTLS_FINGERPRINT_PARSE_ERROR),
ENAME_DECL(CC_CAUSE_DTLS_FINGERPRINT_TOO_LONG),
ENAME_DECL(CC_CAUSE_INVALID_SDP_POINTER),
ENAME_DECL(CC_CAUSE_NO_AUDIO),
ENAME_DECL(CC_CAUSE_NO_DTLS_FINGERPRINT),
ENAME_DECL(CC_CAUSE_MISSING_ICE_ATTRIBUTES),
ENAME_DECL(CC_CAUSE_NO_MEDIA_CAPABILITY),
ENAME_DECL(CC_CAUSE_NO_M_LINE),
ENAME_DECL(CC_CAUSE_NO_PEERCONNECTION),
ENAME_DECL(CC_CAUSE_NO_SDP),
ENAME_DECL(CC_CAUSE_NULL_POINTER),
ENAME_DECL(CC_CAUSE_SDP_CREATE_FAILED),
ENAME_DECL(CC_CAUSE_SDP_ENCODE_FAILED),
ENAME_DECL(CC_CAUSE_SDP_PARSE_FAILED),
ENAME_DECL(CC_CAUSE_SETTING_ICE_SESSION_PARAMETERS_FAILED),
ENAME_DECL(CC_CAUSE_MAX)
);
//define subscriptions_ext_getname(cc_subscriptions_ext_t);

Просмотреть файл

@ -1565,7 +1565,7 @@ gsmsdp_set_sdp_direction (fsmdef_media_t *media,
* attributes_ctp - count of array of media line attributes
*/
static boolean
static cc_causes_t
gsmsdp_get_ice_attributes (sdp_attr_e sdp_attr, uint16_t level, void *sdp_p, char ***ice_attribs, int *attributes_ctp)
{
uint16_t num_a_lines = 0;
@ -1576,18 +1576,18 @@ gsmsdp_get_ice_attributes (sdp_attr_e sdp_attr, uint16_t level, void *sdp_p, cha
result = sdp_attr_num_instances(sdp_p, level, 0, sdp_attr, &num_a_lines);
if (result != SDP_SUCCESS) {
GSM_ERR_MSG("enumerating ICE attributes failed");
return FALSE;
return result;
}
if (num_a_lines < 1) {
GSM_ERR_MSG("enumerating ICE attributes returned 0 attributes");
return TRUE;
GSM_DEBUG("enumerating ICE attributes returned 0 attributes");
return CC_CAUSE_OK;
}
*ice_attribs = (char **)cpr_malloc(num_a_lines * sizeof(char *));
if (!(*ice_attribs))
return FALSE;
return CC_CAUSE_OUT_OF_MEM;
*attributes_ctp = 0;
@ -1595,19 +1595,24 @@ gsmsdp_get_ice_attributes (sdp_attr_e sdp_attr, uint16_t level, void *sdp_p, cha
result = sdp_attr_get_ice_attribute (sdp_p, level, 0, sdp_attr, (uint16_t) (i + 1),
&ice_attrib);
if (result != SDP_SUCCESS) {
GSM_ERR_MSG("Failed to retrieve ICE attribute");
cpr_free(*ice_attribs);
return FALSE;
}
GSM_ERR_MSG("Failed to retrieve ICE attribute");
cpr_free(*ice_attribs);
return result == SDP_INVALID_SDP_PTR ?
CC_CAUSE_INVALID_SDP_POINTER :
result == SDP_INVALID_PARAMETER ?
CC_CAUSE_BAD_ICE_ATTRIBUTE :
/* otherwise */
CC_CAUSE_ERROR;
}
(*ice_attribs)[i] = (char *) cpr_calloc(1, strlen(ice_attrib) + 1);
if(!(*ice_attribs)[i])
return FALSE;
return CC_CAUSE_OUT_OF_MEM;
sstrncpy((*ice_attribs)[i], ice_attrib, strlen(ice_attrib) + 1);
(*attributes_ctp)++;
}
return TRUE;
return CC_CAUSE_OK;
}
/*
@ -4997,7 +5002,7 @@ gsmsdp_get_offered_media_types (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean *has_
*
* returns cc_causes_t
* CC_CAUSE_OK - indicates success
* CC_CAUSE_ERROR - indicates failure
* Any other code - indicates failure
*/
static cc_causes_t
gsmsdp_init_local_sdp (const char *peerconnection, cc_sdp_t **sdp_pp)
@ -5013,8 +5018,11 @@ gsmsdp_init_local_sdp (const char *peerconnection, cc_sdp_t **sdp_pp)
cpr_ip_mode_e ip_mode;
char *strtok_state;
if (!peerconnection || !sdp_pp) {
return CC_CAUSE_ERROR;
if (!peerconnection) {
return CC_CAUSE_NO_PEERCONNECTION;
}
if (!sdp_pp) {
return CC_CAUSE_NULL_POINTER;
}
ip_mode = platform_get_ip_address_mode();
@ -5054,7 +5062,7 @@ gsmsdp_init_local_sdp (const char *peerconnection, cc_sdp_t **sdp_pp)
sdp_p = *sdp_pp;
if ( sdp_p == NULL )
return CC_CAUSE_ERROR;
return CC_CAUSE_NO_SDP;
local_sdp_p = sdp_p->src_sdp;
@ -5305,7 +5313,7 @@ gsmsdp_add_media_line (fsmdef_dcb_t *dcb_p, const cc_media_cap_t *media_cap,
*
* returns cc_causes_t
* CC_CAUSE_OK - indicates success
* CC_CAUSE_ERROR - indicates failure
* Any other code- indicates failure
*/
cc_causes_t
gsmsdp_create_local_sdp (fsmdef_dcb_t *dcb_p, boolean force_streams_enabled,
@ -5321,10 +5329,12 @@ gsmsdp_create_local_sdp (fsmdef_dcb_t *dcb_p, boolean force_streams_enabled,
boolean has_audio;
int sdpmode = 0;
boolean media_enabled;
cc_causes_t cause;
if ( CC_CAUSE_OK != gsmsdp_init_local_sdp(dcb_p->peerconnection,
&(dcb_p->sdp)) )
return CC_CAUSE_ERROR;
cause = gsmsdp_init_local_sdp(dcb_p->peerconnection, &(dcb_p->sdp));
if ( cause != CC_CAUSE_OK) {
return cause;
}
config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode));
@ -5336,7 +5346,7 @@ gsmsdp_create_local_sdp (fsmdef_dcb_t *dcb_p, boolean force_streams_enabled,
/* should not happen */
GSM_ERR_MSG(GSM_L_C_F_PREFIX"no media capbility available",
dcb_p->line, dcb_p->call_id, fname);
return (CC_CAUSE_ERROR);
return (CC_CAUSE_NO_MEDIA_CAPABILITY);
}
media_cap = &media_cap_tbl->cap[0];
@ -5409,7 +5419,7 @@ gsmsdp_create_local_sdp (fsmdef_dcb_t *dcb_p, boolean force_streams_enabled,
*/
GSM_ERR_MSG(GSM_L_C_F_PREFIX"no media line for SDP",
dcb_p->line, dcb_p->call_id, fname);
return (CC_CAUSE_ERROR);
return (CC_CAUSE_NO_M_LINE);
}
/*
@ -5442,7 +5452,7 @@ gsmsdp_create_local_sdp (fsmdef_dcb_t *dcb_p, boolean force_streams_enabled,
/* No audio, do not allow */
GSM_ERR_MSG(GSM_L_C_F_PREFIX"no audio media line for SDP",
dcb_p->line, dcb_p->call_id, fname);
return (CC_CAUSE_ERROR);
return (CC_CAUSE_NO_AUDIO);
}
}
@ -5464,7 +5474,7 @@ gsmsdp_create_options_sdp (cc_sdp_t ** sdp_pp)
cc_sdp_t *sdp_p;
/* This empty string represents to associated peerconnection object */
if (gsmsdp_init_local_sdp("", sdp_pp) == CC_CAUSE_ERROR) {
if (gsmsdp_init_local_sdp("", sdp_pp) != CC_CAUSE_OK) {
return;
}
@ -6163,17 +6173,17 @@ gsmsdp_encode_sdp (cc_sdp_t *sdp_p, cc_msgbody_info_t *msg_body)
uint32_t body_length;
if (!msg_body || !sdp_p) {
return CC_CAUSE_ERROR;
return CC_CAUSE_NULL_POINTER;
}
/* Support single SDP encoding for now */
sdp_body = sipsdp_write_to_buf(sdp_p->src_sdp, &body_length);
if (sdp_body == NULL) {
return CC_CAUSE_ERROR;
return CC_CAUSE_SDP_ENCODE_FAILED;
} else if (body_length == 0) {
cpr_free(sdp_body);
return CC_CAUSE_ERROR;
return CC_CAUSE_SDP_ENCODE_FAILED;
}
/* Clear off the bodies info */
@ -6211,21 +6221,20 @@ cc_causes_t
gsmsdp_encode_sdp_and_update_version (fsmdef_dcb_t *dcb_p, cc_msgbody_info_t *msg_body)
{
char version_str[GSMSDP_VERSION_STR_LEN];
cc_causes_t cause;
snprintf(version_str, sizeof(version_str), "%d", dcb_p->src_sdp_version);
if ( dcb_p->sdp == NULL || dcb_p->sdp->src_sdp == NULL )
{
if ( CC_CAUSE_OK != gsmsdp_init_local_sdp(dcb_p->peerconnection,
&(dcb_p->sdp)) )
{
return CC_CAUSE_ERROR;
}
if ( dcb_p->sdp == NULL || dcb_p->sdp->src_sdp == NULL ) {
cause = gsmsdp_init_local_sdp(dcb_p->peerconnection, &(dcb_p->sdp));
if ( cause != CC_CAUSE_OK) {
return cause;
}
}
(void) sdp_set_owner_version(dcb_p->sdp->src_sdp, version_str);
if (gsmsdp_encode_sdp(dcb_p->sdp, msg_body) != CC_CAUSE_OK) {
return CC_CAUSE_ERROR;
return CC_CAUSE_SDP_ENCODE_FAILED;
}
dcb_p->src_sdp_version++;
@ -6327,7 +6336,7 @@ gsmsdp_realloc_dest_sdp (fsmdef_dcb_t *dcb_p)
/* No SDP info block and parsed control block are available */
if ((dcb_p->sdp == NULL) || (dcb_p->sdp->dest_sdp == NULL)) {
/* Unable to create internal SDP structure to parse SDP. */
return CC_CAUSE_ERROR;
return CC_CAUSE_SDP_CREATE_FAILED;
}
return CC_CAUSE_OK;
}
@ -6363,20 +6372,21 @@ gsmsdp_negotiate_answer_sdp (fsm_fcb_t *fcb_p, cc_msgbody_info_t *msg_body)
/*
* Clear the call - we don't have any remote SDP info!
*/
return CC_CAUSE_ERROR;
return CC_CAUSE_NO_SDP;
}
/* There are SDPs to process, prepare for parsing the SDP */
if (gsmsdp_realloc_dest_sdp(dcb_p) != CC_CAUSE_OK) {
status = gsmsdp_realloc_dest_sdp(dcb_p);
if (status != CC_CAUSE_OK) {
/* Unable to create internal SDP structure to parse SDP. */
return CC_CAUSE_ERROR;
return status;
}
/*
* Parse the SDP into internal structure,
* now just parse one
*/
status = CC_CAUSE_ERROR;
status = CC_CAUSE_SDP_PARSE_FAILED;
for (i = 0; (i < num_sdp_bodies); i++) {
if ((sdp_bodies[i]->body != NULL) && (sdp_bodies[i]->body_length > 0)) {
/* Found a body */
@ -6478,8 +6488,10 @@ gsmsdp_process_offer_sdp (fsm_fcb_t *fcb_p,
* of a session. Otherwise, we will send what we have.
*/
if (init) {
if ( CC_CAUSE_OK != gsmsdp_create_local_sdp(dcb_p, FALSE, TRUE, TRUE, TRUE, TRUE)) {
return CC_CAUSE_ERROR;
status = gsmsdp_create_local_sdp(dcb_p, FALSE, TRUE,
TRUE, TRUE, TRUE);
if ( status != CC_CAUSE_OK) {
return status;
}
} else {
/*
@ -6492,16 +6504,17 @@ gsmsdp_process_offer_sdp (fsm_fcb_t *fcb_p,
}
/* There are SDPs to process, prepare for parsing the SDP */
if (gsmsdp_realloc_dest_sdp(dcb_p) != CC_CAUSE_OK) {
status = gsmsdp_realloc_dest_sdp(dcb_p);
if (status != CC_CAUSE_OK) {
/* Unable to create internal SDP structure to parse SDP. */
return CC_CAUSE_ERROR;
return status;
}
/*
* Parse the SDP into internal structure,
* now just parse one
*/
status = CC_CAUSE_ERROR;
status = CC_CAUSE_SDP_PARSE_FAILED;
for (i = 0; (i < num_sdp_bodies); i++) {
if ((sdp_bodies[i]->body != NULL) && (sdp_bodies[i]->body_length > 0)) {
/* Found a body */
@ -6580,7 +6593,7 @@ gsmsdp_check_ice_attributes_exist(fsm_fcb_t *fcb_p) {
if (sdp_res != SDP_SUCCESS || !ufrag) {
GSM_ERR_MSG(GSM_L_C_F_PREFIX"missing ICE ufrag parameter.",
dcb_p->line, dcb_p->call_id, __FUNCTION__);
return CC_CAUSE_ERROR;
return CC_CAUSE_MISSING_ICE_ATTRIBUTES;
}
}
@ -6591,7 +6604,7 @@ gsmsdp_check_ice_attributes_exist(fsm_fcb_t *fcb_p) {
if (sdp_res != SDP_SUCCESS || !pwd) {
GSM_ERR_MSG(GSM_L_C_F_PREFIX"missing ICE pwd parameter.",
dcb_p->line, dcb_p->call_id, __FUNCTION__);
return CC_CAUSE_ERROR;
return CC_CAUSE_MISSING_ICE_ATTRIBUTES;
}
}
}
@ -6621,7 +6634,7 @@ gsmsdp_install_peer_ice_attributes(fsm_fcb_t *fcb_p)
cc_sdp_t *sdp_p = dcb_p->sdp;
fsmdef_media_t *media;
int level;
short result;
cc_causes_t result;
/* Tolerate missing ufrag/pwd here at the session level
because it might be at the media level */
@ -6638,7 +6651,7 @@ gsmsdp_install_peer_ice_attributes(fsm_fcb_t *fcb_p)
if (ufrag && pwd) {
vcm_res = vcmSetIceSessionParams(dcb_p->peerconnection, ufrag, pwd);
if (vcm_res)
return (CC_CAUSE_ERROR);
return (CC_CAUSE_SETTING_ICE_SESSION_PARAMETERS_FAILED);
}
/* Now process all the media lines */
@ -6660,8 +6673,8 @@ gsmsdp_install_peer_ice_attributes(fsm_fcb_t *fcb_p)
candidates = NULL;
result = gsmsdp_get_ice_attributes (SDP_ATTR_ICE_CANDIDATE, media->level, sdp_p->dest_sdp,
&candidates, &candidate_ct);
if(!result)
return (CC_CAUSE_ERROR);
if(result != CC_CAUSE_OK)
return (result);
/* Set ICE parameters into ICE engine */
@ -6680,7 +6693,7 @@ gsmsdp_install_peer_ice_attributes(fsm_fcb_t *fcb_p)
}
if (vcm_res)
return (CC_CAUSE_ERROR);
return (CC_CAUSE_SETTING_ICE_SESSION_PARAMETERS_FAILED);
}
@ -6733,47 +6746,47 @@ gsmsdp_configure_dtls_data_attributes(fsm_fcb_t *fcb_p)
if (SDP_SUCCESS == sdp_res ) {
if (strlen(fingerprint) >= sizeof(line_to_split))
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_FINGERPRINT_TOO_LONG;
sstrncpy(line_to_split, fingerprint, sizeof(line_to_split));
} else if (SDP_SUCCESS == sdp_session_res) {
if (strlen(session_fingerprint) >= sizeof(line_to_split))
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_FINGERPRINT_TOO_LONG;
sstrncpy(line_to_split, session_fingerprint, sizeof(line_to_split));
} else {
cause = CC_CAUSE_ERROR;
cause = CC_CAUSE_NO_DTLS_FINGERPRINT;
continue;
}
if (SDP_SUCCESS == sdp_res || SDP_SUCCESS == sdp_session_res) {
if(!(token = PL_strtok_r(line_to_split, delim, &strtok_state)))
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_FINGERPRINT_PARSE_ERROR;
if (strlen(token) >= sizeof(digest_alg))
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_DIGEST_ALGORITHM_TOO_LONG;
sstrncpy(digest_alg, token, sizeof(digest_alg));
if(!(token = PL_strtok_r(NULL, delim, &strtok_state)))
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_FINGERPRINT_PARSE_ERROR;
if (strlen(token) >= sizeof(digest))
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_DIGEST_TOO_LONG;
sstrncpy(digest, token, sizeof(digest));
if (strlen(digest_alg) >= sizeof(media->negotiated_crypto.algorithm))
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_DIGEST_ALGORITHM_TOO_LONG;
sstrncpy(media->negotiated_crypto.algorithm, digest_alg, sizeof(media->negotiated_crypto.algorithm));
if (strlen(media->negotiated_crypto.algorithm) == 0) {
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_DIGEST_ALGORITHM_EMPTY;
}
if (strlen(digest) >= sizeof(media->negotiated_crypto.digest))
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_DIGEST_TOO_LONG;
sstrncpy(media->negotiated_crypto.digest, digest, sizeof(media->negotiated_crypto.digest));
if (strlen(media->negotiated_crypto.digest) == 0) {
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_DIGEST_EMPTY;
}
/* Here we have DTLS data */
@ -6782,7 +6795,7 @@ gsmsdp_configure_dtls_data_attributes(fsm_fcb_t *fcb_p)
} else {
GSM_DEBUG(DEB_F_PREFIX"DTLS attribute error",
DEB_F_PREFIX_ARGS(GSM, __FUNCTION__));
return CC_CAUSE_ERROR;
return CC_CAUSE_DTLS_ATTRIBUTE_ERROR;
}
}

Просмотреть файл

@ -53,7 +53,7 @@ sub_send_msg (cprBuffer_t buf, uint32_t cmd, uint16_t len, cc_srcs_t dst_id)
/* This buffer is assumed to be at least of size int */
MOZ_ASSERT(len >= sizeof(int));
if (len < sizeof(int)) {
return CPR_FAILURE;
return CC_RC_ERROR;
}
CC_DEBUG_MSG sub_print_msg((char *)buf, len);

Просмотреть файл

@ -343,6 +343,29 @@ static const char *cc_cause_names[] = {
"RESP_TIMEOUT",
"SERV_ERR_UNAVAIL",
"REMOTE_DISCONN_REQ_PLAYTONE",
"OUT_OF_MEM",
"VALUE_NOT_FOUND",
"BAD_ICE_ATTRIBUTE",
"DTLS_ATTRIBUTE_ERROR",
"DTLS_DIGEST_ALGORITHM_EMPTY",
"DTLS_DIGEST_ALGORITHM_TOO_LONG",
"DTLS_DIGEST_EMPTY",
"DTLS_DIGEST_TOO_LONG",
"DTLS_FINGERPRINT_PARSE_ERROR",
"DTLS_FINGERPRINT_TOO_LONG",
"INVALID_SDP_POINTER",
"NO_AUDIO",
"NO_DTLS_FINGERPRINT",
"MISSING_ICE_ATTRIBUTES",
"NO_MEDIA_CAPABILITY",
"NO_M_LINE",
"NO_PEERCONNECTION",
"NO_SDP",
"NULL_POINTER",
"SDP_CREATE_FAILED",
"SDP_ENCODE_FAILED",
"SDP_PARSE_FAILED",
"SETTING_ICE_SESSION_PARAMETERS_FAILED",
"MAX_CAUSE"
};
#endif //__CC_CAUSE_STRINGS__

Просмотреть файл

@ -421,60 +421,81 @@ typedef enum {
* Important: when update this enum, please update the cc_cause_name accordingly.
*/
typedef enum {
CC_CAUSE_MIN = -1,
CC_CAUSE_BASE = -1,
CC_CAUSE_OK,
CC_CAUSE_ERROR,
CC_CAUSE_UNASSIGNED_NUM,
CC_CAUSE_NO_RESOURCE,
CC_CAUSE_NO_ROUTE,
CC_CAUSE_NORMAL,
CC_CAUSE_BUSY,
CC_CAUSE_NO_USER_RESP,
CC_CAUSE_NO_USER_ANS,
CC_CAUSE_REJECT,
CC_CAUSE_INVALID_NUMBER,
CC_CAUSE_FACILITY_REJECTED,
CC_CAUSE_CALL_ID_IN_USE,
CC_CAUSE_XFER_LOCAL,
CC_CAUSE_XFER_REMOTE,
CC_CAUSE_XFER_BY_REMOTE,
CC_CAUSE_XFER_CNF,
CC_CAUSE_CONGESTION,
CC_CAUSE_ANONYMOUS,
CC_CAUSE_REDIRECT,
CC_CAUSE_PAYLOAD_MISMATCH,
CC_CAUSE_CONF,
CC_CAUSE_REPLACE,
CC_CAUSE_NO_REPLACE_CALL,
CC_CAUSE_NO_RESUME,
CC_CAUSE_NO_MEDIA,
CC_CAUSE_REQUEST_PENDING,
CC_CAUSE_INVALID_PARTICIPANT,
CC_CAUSE_NO_CNF_BRIDE,
CC_MAXIMUM_PARTICIPANT,
CC_KEY_NOT_ACTIVE,
CC_TEMP_NOT_AVAILABLE,
CC_CAUSE_REMOTE_SERVER_ERROR,
CC_CAUSE_BARGE,
CC_CAUSE_CBARGE,
CC_CAUSE_NOT_FOUND,
CC_CAUSE_SECURITY_FAILURE,
CC_CAUSE_MONITOR,
CC_CAUSE_UI_STATE_BUSY,
CC_SIP_CAUSE_ANSWERED_ELSEWHERE,
CC_CAUSE_RETRIEVED,
CC_CAUSE_FORWARDED,
CC_CAUSE_ABANDONED,
CC_CAUSE_XFER_LOCAL_WITH_DIALSTRING,
CC_CAUSE_BW_OK,
CC_CAUSE_XFER_COMPLETE,
CC_CAUSE_RESP_TIMEOUT,
CC_CAUSE_SERV_ERR_UNAVAIL,
CC_CAUSE_MIN = -1,
CC_CAUSE_BASE = -1,
CC_CAUSE_OK,
CC_CAUSE_ERROR,
CC_CAUSE_UNASSIGNED_NUM,
CC_CAUSE_NO_RESOURCE,
CC_CAUSE_NO_ROUTE,
CC_CAUSE_NORMAL,
CC_CAUSE_BUSY,
CC_CAUSE_NO_USER_RESP,
CC_CAUSE_NO_USER_ANS,
CC_CAUSE_REJECT,
CC_CAUSE_INVALID_NUMBER,
CC_CAUSE_FACILITY_REJECTED,
CC_CAUSE_CALL_ID_IN_USE,
CC_CAUSE_XFER_LOCAL,
CC_CAUSE_XFER_REMOTE,
CC_CAUSE_XFER_BY_REMOTE,
CC_CAUSE_XFER_CNF,
CC_CAUSE_CONGESTION,
CC_CAUSE_ANONYMOUS,
CC_CAUSE_REDIRECT,
CC_CAUSE_PAYLOAD_MISMATCH,
CC_CAUSE_CONF,
CC_CAUSE_REPLACE,
CC_CAUSE_NO_REPLACE_CALL,
CC_CAUSE_NO_RESUME,
CC_CAUSE_NO_MEDIA,
CC_CAUSE_REQUEST_PENDING,
CC_CAUSE_INVALID_PARTICIPANT,
CC_CAUSE_NO_CNF_BRIDE,
CC_MAXIMUM_PARTICIPANT,
CC_KEY_NOT_ACTIVE,
CC_TEMP_NOT_AVAILABLE,
CC_CAUSE_REMOTE_SERVER_ERROR,
CC_CAUSE_BARGE,
CC_CAUSE_CBARGE,
CC_CAUSE_NOT_FOUND,
CC_CAUSE_SECURITY_FAILURE,
CC_CAUSE_MONITOR,
CC_CAUSE_UI_STATE_BUSY,
CC_SIP_CAUSE_ANSWERED_ELSEWHERE,
CC_CAUSE_RETRIEVED,
CC_CAUSE_FORWARDED,
CC_CAUSE_ABANDONED,
CC_CAUSE_XFER_LOCAL_WITH_DIALSTRING,
CC_CAUSE_BW_OK,
CC_CAUSE_XFER_COMPLETE,
CC_CAUSE_RESP_TIMEOUT,
CC_CAUSE_SERV_ERR_UNAVAIL,
CC_CAUSE_REMOTE_DISCONN_REQ_PLAYTONE,
CC_CAUSE_OUT_OF_MEM,
CC_CAUSE_VALUE_NOT_FOUND,
CC_CAUSE_MAX
CC_CAUSE_BAD_ICE_ATTRIBUTE,
CC_CAUSE_DTLS_ATTRIBUTE_ERROR,
CC_CAUSE_DTLS_DIGEST_ALGORITHM_EMPTY,
CC_CAUSE_DTLS_DIGEST_ALGORITHM_TOO_LONG,
CC_CAUSE_DTLS_DIGEST_EMPTY,
CC_CAUSE_DTLS_DIGEST_TOO_LONG,
CC_CAUSE_DTLS_FINGERPRINT_PARSE_ERROR,
CC_CAUSE_DTLS_FINGERPRINT_TOO_LONG,
CC_CAUSE_INVALID_SDP_POINTER,
CC_CAUSE_NO_AUDIO,
CC_CAUSE_NO_DTLS_FINGERPRINT,
CC_CAUSE_MISSING_ICE_ATTRIBUTES,
CC_CAUSE_NO_MEDIA_CAPABILITY,
CC_CAUSE_NO_M_LINE,
CC_CAUSE_NO_PEERCONNECTION,
CC_CAUSE_NO_SDP,
CC_CAUSE_NULL_POINTER,
CC_CAUSE_SDP_CREATE_FAILED,
CC_CAUSE_SDP_ENCODE_FAILED,
CC_CAUSE_SDP_PARSE_FAILED,
CC_CAUSE_SETTING_ICE_SESSION_PARAMETERS_FAILED,
CC_CAUSE_MAX
} cc_cause_t;
/**

Просмотреть файл

@ -489,9 +489,6 @@ abstract public class GeckoApp
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (outState == null)
outState = new Bundle();
outState.putBoolean(SAVED_STATE_IN_BACKGROUND, isApplicationInBackground());
outState.putString(SAVED_STATE_PRIVATE_SESSION, mPrivateBrowsingSession);