Bug 1508255 - More formatting changes in js/src r=jandem

These also help the clang-format result but are more subjective.

Depends on D12387

Differential Revision: https://phabricator.services.mozilla.com/D12388

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ted Campbell 2018-11-20 10:23:38 +00:00
Родитель ef11ff97a5
Коммит adb0d2daf3
15 изменённых файлов: 99 добавлений и 57 удалений

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

@ -56,11 +56,13 @@ intl_RelativeTimeFormat_availableLocales(JSContext* cx, unsigned argc, JS::Value
* Returns a relative time as a string formatted according to the effective
* locale and the formatting options of the given RelativeTimeFormat.
*
* t should be a number representing a number to be formatted.
* unit should be "second", "minute", "hour", "day", "week", "month", "quarter", or "year".
* numeric should be "always" or "auto".
* |t| should be a number representing a number to be formatted.
* |unit| should be "second", "minute", "hour", "day", "week", "month",
* "quarter", or "year".
* |numeric| should be "always" or "auto".
*
* Usage: formatted = intl_FormatRelativeTime(relativeTimeFormat, t, unit, numeric)
* Usage: formatted = intl_FormatRelativeTime(relativeTimeFormat, t,
* unit, numeric)
*/
extern MOZ_MUST_USE bool
intl_FormatRelativeTime(JSContext* cx, unsigned argc, JS::Value* vp);

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

@ -6976,7 +6976,8 @@ GeneralParser<ParseHandler, Unit>::tryStatement(YieldHandling yieldHandling)
*
* catch lvalue nodes are either:
* a single identifier
* TokenKind::RightBracket or TokenKind::RightCurly for a destructuring left-hand side
* TokenKind::RightBracket for a destructuring left-hand side
* TokenKind::RightCurly for a destructuring left-hand side
*
* finally nodes are TokenKind::LeftCurly statement lists.
*/
@ -7661,7 +7662,11 @@ GeneralParser<ParseHandler, Unit>::statement(YieldHandling yieldHandling)
// Peek only on the same line: ExpressionStatement's lookahead
// restriction is phrased as
//
// [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
// [lookahead ∉ { '{',
// function,
// async [no LineTerminator here] function,
// class,
// let '[' }]
//
// meaning that code like this is valid:
//
@ -9507,7 +9512,9 @@ GeneralParser<ParseHandler, Unit>::checkDestructuringAssignmentElement(Node expr
//
// AssignmentElement[Yield, Await]:
// DestructuringAssignmentTarget[?Yield, ?Await]
// DestructuringAssignmentTarget[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]
// DestructuringAssignmentTarget[?Yield, ?Await] Initializer[+In,
// ?Yield,
// ?Await]
// If |expr| is an assignment element with an initializer expression, its
// destructuring assignment target was already validated in assignExpr().

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

@ -379,8 +379,10 @@ struct BaselineStackBuilder
// BaselineStub - Baseline calling into Ion.
// PrevFramePtr needs to point to the BaselineStubFrame's saved frame pointer.
// STACK_START_ADDR + JitFrameLayout::Size() + PREV_FRAME_SIZE
// - BaselineStubFrameLayout::reverseOffsetOfSavedFramePtr()
// STACK_START_ADDR
// + JitFrameLayout::Size()
// + PREV_FRAME_SIZE
// - BaselineStubFrameLayout::reverseOffsetOfSavedFramePtr()
if (type == FrameType::BaselineStub) {
size_t offset = JitFrameLayout::Size() + topFrame->prevFrameLocalSize() +
BaselineStubFrameLayout::reverseOffsetOfSavedFramePtr();

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

@ -4228,7 +4228,9 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler& masm)
}
// Load the callee in R1, accounting for newTarget, if necessary
// Stack Layout: [ ..., CalleeVal, ThisVal, Arg0Val, ..., ArgNVal, [newTarget] +ICStackValueOffset+ ]
// Stack Layout:
// [ ..., CalleeVal, ThisVal, Arg0Val, ..., ArgNVal, [newTarget],
// +ICStackValueOffset+ ]
if (isSpread_) {
unsigned skipToCallee = (2 + isConstructing_) * sizeof(Value);
masm.loadValue(Address(masm.getStackPointer(), skipToCallee + ICStackValueOffset), R1);
@ -4295,7 +4297,8 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler& masm)
masm.push(argcReg);
// Stack now looks like:
// [..., Callee, ThisV, Arg0V, ..., ArgNV, NewTarget, StubFrameHeader, ArgC ]
// [ ..., Callee, ThisV, Arg0V, ..., ArgNV, NewTarget,
// StubFrameHeader, ArgC ]
masm.loadValue(Address(masm.getStackPointer(), STUB_FRAME_SIZE + sizeof(size_t)), R1);
masm.push(masm.extractObject(R1, ExtractTemp0));
@ -4338,7 +4341,8 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler& masm)
// clobbered after that.
//
// Stack now looks like:
// [..., Callee, ThisV, Arg0V, ..., ArgNV, [NewTarget], StubFrameHeader ]
// [ ..., Callee, ThisV, Arg0V, ..., ArgNV, [NewTarget],
// StubFrameHeader ]
if (isSpread_) {
masm.storeValue(R0, Address(masm.getStackPointer(),
(1 + isConstructing_) * sizeof(Value) + STUB_FRAME_SIZE));
@ -4427,18 +4431,22 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler& masm)
Label skipThisReplace;
masm.branchTestObject(Assembler::Equal, JSReturnOperand, &skipThisReplace);
// Current stack: [ Padding?, ARGVALS..., ThisVal, ActualArgc, Callee, Descriptor ]
// However, we can't use this ThisVal, because it hasn't been traced. We need to use
// The ThisVal higher up the stack:
// Current stack: [ ThisVal, ARGVALS..., ...STUB FRAME...,
// Padding?, ARGVALS..., ThisVal, ActualArgc, Callee, Descriptor ]
// Current stack: [ Padding?, ARGVALS..., ThisVal, ActualArgc, Callee,
// Descriptor ]
// However, we can't use this ThisVal, because it hasn't been traced.
// We need to use the ThisVal higher up the stack:
// Current stack: [ ThisVal, ARGVALS..., ...STUB FRAME..., Padding?,
// ARGVALS..., ThisVal, ActualArgc, Callee, Descriptor ]
// Restore the BaselineFrameReg based on the frame descriptor.
//
// BaselineFrameReg = BaselineStackReg
// + sizeof(Descriptor) + sizeof(Callee) + sizeof(ActualArgc)
// + sizeof(Descriptor)
// + sizeof(Callee)
// + sizeof(ActualArgc)
// + stubFrameSize(Descriptor)
// - sizeof(ICStubReg) - sizeof(BaselineFrameReg)
// - sizeof(ICStubReg)
// - sizeof(BaselineFrameReg)
Address descriptorAddr(masm.getStackPointer(), 0);
masm.loadPtr(descriptorAddr, BaselineFrameReg);
masm.rshiftPtr(Imm32(FRAMESIZE_SHIFT), BaselineFrameReg);
@ -4455,8 +4463,9 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler& masm)
masm.loadPtr(argcAddr, argcReg);
}
// Current stack: [ ThisVal, ARGVALS..., ...STUB FRAME..., <-- BaselineFrameReg
// Padding?, ARGVALS..., ThisVal, ActualArgc, Callee, Descriptor ]
// Current stack:
// [ ThisVal, ARGVALS..., ...STUB FRAME..., <-- BaselineFrameReg
// Padding?, ARGVALS..., ThisVal, ActualArgc, Callee, Descriptor ]
//
// &ThisVal = BaselineFrameReg + argc * sizeof(Value) + STUB_FRAME_SIZE + sizeof(Value)
// This last sizeof(Value) accounts for the newTarget on the end of the arguments vector
@ -4491,7 +4500,8 @@ static const VMFunction CopyStringSplitArrayInfo =
bool
ICCall_ConstStringSplit::Compiler::generateStubCode(MacroAssembler& masm)
{
// Stack Layout: [ ..., CalleeVal, ThisVal, strVal, sepVal, +ICStackValueOffset+ ]
// Stack Layout:
// [ ..., CalleeVal, ThisVal, strVal, sepVal, +ICStackValueOffset+ ]
static const size_t SEP_DEPTH = 0;
static const size_t STR_DEPTH = sizeof(Value);
static const size_t CALLEE_DEPTH = 3 * sizeof(Value);
@ -5032,7 +5042,9 @@ ICCall_ScriptedFunCall::Compiler::generateStubCode(MacroAssembler& masm)
regs.takeUnchecked(ICTailCallReg);
// Load the callee in R1.
// Stack Layout: [ ..., CalleeVal, ThisVal, Arg0Val, ..., ArgNVal, +ICStackValueOffset+ ]
// Stack Layout:
// [ ..., CalleeVal, ThisVal, Arg0Val, ..., ArgNVal,
// +ICStackValueOffset+ ]
BaseValueIndex calleeSlot(masm.getStackPointer(), argcReg, ICStackValueOffset + sizeof(Value));
masm.loadValue(calleeSlot, R1);
regs.take(R1);

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

@ -559,10 +559,10 @@ class VFPRegister
// to know if a register is available or not, as we have the following
// relations:
//
// d0.alignedOrDominatedAliasedSet() ==
// s0.alignedOrDominatedAliasedSet() | s1.alignedOrDominatedAliasedSet()
// d0.alignedOrDominatedAliasedSet() ==
// s0.alignedOrDominatedAliasedSet() | s1.alignedOrDominatedAliasedSet()
//
// s0.alignedOrDominatedAliasedSet() & s1.alignedOrDominatedAliasedSet() == 0
// s0.alignedOrDominatedAliasedSet() & s1.alignedOrDominatedAliasedSet() == 0
//
SetType alignedOrDominatedAliasedSet() const {
if (isSingle()) {

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

@ -178,7 +178,8 @@ JitRuntime::generateEnterJIT(JSContext* cx, MacroAssembler& masm)
// r4 is now the aligned on the bottom of the list of arguments.
static_assert(sizeof(JitFrameLayout) % JitStackAlignment == 0,
"No need to consider the JitFrameLayout for aligning the stack");
// sp' = ~(JitStackAlignment - 1) & (sp - argc * sizeof(Value)) - sizeof(JitFrameLayout)
// sp' = ~(JitStackAlignment - 1) & (sp - argc * sizeof(Value))
// - sizeof(JitFrameLayout)
aasm->as_sub(sp, r4, Imm8(sizeof(JitFrameLayout)));
// Get a copy of the number of args to use as a decrement counter, also set
@ -1264,7 +1265,8 @@ JitRuntime::generateProfilerExitFrameTailStub(MacroAssembler& masm, Label* profi
masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3);
masm.storePtr(scratch3, lastProfilingCallSite);
// scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size()
// scratch3 := RectFrame + Rect-Descriptor.Size +
// RectifierFrameLayout::Size()
masm.ma_add(scratch2, scratch1, scratch3);
masm.add32(Imm32(RectifierFrameLayout::Size()), scratch3);
masm.storePtr(scratch3, lastProfilingFrame);

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

@ -969,7 +969,8 @@ JitRuntime::generateProfilerExitFrameTailStub(MacroAssembler& masm, Label* profi
masm.storePtr(scratch2, lastProfilingCallSite);
// Store return frame in lastProfilingFrame.
// scratch2 := masm.getStackPointer() + Descriptor.size*1 + JitFrameLayout::Size();
// scratch2 := masm.getStackPointer() + Descriptor.size*1 +
// JitFrameLayout::Size();
masm.Add(ARMRegister(scratch2, 64), masm.GetStackPointer64(), ARMRegister(scratch1, 64));
masm.syncStackPtr();
masm.addPtr(Imm32(JitFrameLayout::Size()), scratch2, scratch2);
@ -1085,7 +1086,8 @@ JitRuntime::generateProfilerExitFrameTailStub(MacroAssembler& masm, Label* profi
masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3);
masm.storePtr(scratch3, lastProfilingCallSite);
// scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size()
// scratch3 := RectFrame + Rect-Descriptor.Size +
// RectifierFrameLayout::Size()
masm.addPtr(scratch2, scratch1, scratch3);
masm.add32(Imm32(RectifierFrameLayout::Size()), scratch3);
masm.storePtr(scratch3, lastProfilingFrame);

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

@ -1254,7 +1254,8 @@ JitRuntime::generateProfilerExitFrameTailStub(MacroAssembler& masm, Label* profi
masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3);
masm.storePtr(scratch3, lastProfilingCallSite);
// scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size()
// scratch3 := RectFrame + Rect-Descriptor.Size +
// RectifierFrameLayout::Size()
masm.as_addu(scratch3, scratch2, scratch1);
masm.add32(Imm32(RectifierFrameLayout::Size()), scratch3);
masm.storePtr(scratch3, lastProfilingFrame);

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

@ -456,11 +456,12 @@ JitRuntime::generateArgumentsRectifier(MacroAssembler& masm)
masm.as_dsubu(t1, numArgsReg, s3);
// Caller:
// [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]] <- sp <- t2
// [arg2] [arg1] [this] [ [argc] [callee] [descr] [raddr] ] <- sp <- t2
// '------ s3 -------'
//
// Rectifier frame:
// [undef] [undef] [undef] [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]]
// [undef] [undef] [undef] [arg2] [arg1] [this] [ [argc] [callee]
// [descr] [raddr] ]
// '-------- t1 ---------' '------- s3 -------'
// Copy number of actual arguments into numActArgsReg
@ -529,11 +530,12 @@ JitRuntime::generateArgumentsRectifier(MacroAssembler& masm)
}
// Caller:
// [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]] <- t2
// [arg2] [arg1] [this] [ [argc] [callee] [descr] [raddr] ] <- t2
//
//
// Rectifier frame:
// [undef] [undef] [undef] [arg2] [arg1] [this] <- sp [[argc] [callee] [descr] [raddr]]
// [undef] [undef] [undef] [arg2] [arg1] [this] <- sp [ [argc] [callee]
// [descr] [raddr] ]
// Construct sizeDescriptor.
masm.subPtr(StackPointer, t2);
@ -1205,7 +1207,8 @@ JitRuntime::generateProfilerExitFrameTailStub(MacroAssembler& masm, Label* profi
masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3);
masm.storePtr(scratch3, lastProfilingCallSite);
// scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size()
// scratch3 := RectFrame + Rect-Descriptor.Size +
// RectifierFrameLayout::Size()
masm.as_daddu(scratch3, scratch2, scratch1);
masm.addPtr(Imm32(RectifierFrameLayout::Size()), scratch3);
masm.storePtr(scratch3, lastProfilingFrame);

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

@ -408,11 +408,12 @@ JitRuntime::generateArgumentsRectifier(MacroAssembler& masm)
masm.subq(r8, rcx);
// Caller:
// [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]] <- rsp <- r9
// [arg2] [arg1] [this] [ [argc] [callee] [descr] [raddr] ] <- rsp <- r9
// '------ #r8 -------'
//
// Rectifier frame:
// [undef] [undef] [undef] [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]]
// [undef] [undef] [undef] [arg2] [arg1] [this] [ [argc] [callee]
// [descr] [raddr] ]
// '------- #rcx --------' '------ #r8 -------'
// Copy the number of actual arguments into rdx. Use lea to subtract 1 for
@ -475,11 +476,12 @@ JitRuntime::generateArgumentsRectifier(MacroAssembler& masm)
// Caller:
// [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]] <- r9
// [arg2] [arg1] [this] [ [argc] [callee] [descr] [raddr] ] <- r9
//
//
// Rectifier frame:
// [undef] [undef] [undef] [arg2] [arg1] [this] <- rsp [[argc] [callee] [descr] [raddr]]
// [undef] [undef] [undef] [arg2] [arg1] [this] <- rsp [ [argc] [callee]
// [descr] [raddr] ]
//
// Construct descriptor.
@ -1145,7 +1147,8 @@ JitRuntime::generateProfilerExitFrameTailStub(MacroAssembler& masm, Label* profi
masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3);
masm.storePtr(scratch3, lastProfilingCallSite);
// scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size()
// scratch3 := RectFrame + Rect-Descriptor.Size +
// RectifierFrameLayout::Size()
masm.lea(Operand(scratch2, scratch1, TimesOne, RectifierFrameLayout::Size()), scratch3);
masm.storePtr(scratch3, lastProfilingFrame);
masm.ret();

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

@ -359,7 +359,7 @@ JitRuntime::generateArgumentsRectifier(MacroAssembler& masm)
argumentsRectifierOffset_ = startTrampolineCode(masm);
// Caller:
// [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]] <- esp
// [arg2] [arg1] [this] [ [argc] [callee] [descr] [raddr] ] <- esp
// Load argc.
masm.loadPtr(Address(esp, RectifierFrameLayout::offsetOfNumActualArgs()), esi);
@ -410,14 +410,14 @@ JitRuntime::generateArgumentsRectifier(MacroAssembler& masm)
masm.push(FramePointer /* padding */);
// Caller:
// [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]]
// [arg2] [arg1] [this] [ [argc] [callee] [descr] [raddr] ]
// '-- #esi ---'
//
// Rectifier frame:
// [ebp'] <- ebp [padding] <- esp [undef] [undef] [arg2] [arg1] [this]
// '--- #ecx ----' '-- #esi ---'
//
// [[argc] [callee] [descr] [raddr]]
// [ [argc] [callee] [descr] [raddr] ]
// Push undefined.
{
@ -1170,7 +1170,8 @@ JitRuntime::generateProfilerExitFrameTailStub(MacroAssembler& masm, Label* profi
masm.loadPtr(Address(scratch2, RectifierFrameLayout::offsetOfReturnAddress()), scratch3);
masm.storePtr(scratch3, lastProfilingCallSite);
// scratch3 := RectFrame + Rect-Descriptor.Size + RectifierFrameLayout::Size()
// scratch3 := RectFrame + Rect-Descriptor.Size +
// RectifierFrameLayout::Size()
masm.lea(Operand(scratch2, scratch1, TimesOne, RectifierFrameLayout::Size()), scratch3);
masm.storePtr(scratch3, lastProfilingFrame);
masm.ret();

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

@ -1095,7 +1095,8 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool isToSource)
// NativeFunction when no source text is available.
//
// NativeFunction:
// function PropertyName[~Yield,~Await]opt ( FormalParameters[~Yield,~Await] ) { [native code] }
// function PropertyName[~Yield,~Await]opt (
// FormalParameters[~Yield,~Await] ) { [native code] }
//
// Additionally, if |fun| is a well-known intrinsic object and is not
// identified as an anonymous function, the portion of the returned

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

@ -152,19 +152,22 @@ struct ForOfPIC
* Array.prototype's shape (arrayProtoShape_)
* To ensure that Array.prototype has not been modified.
*
* ArrayIterator.prototype (arrayIteratorProto_)
* ArrayIterator.prototype's shape (arrayIteratorProtoShape_)
* ArrayIterator.prototype
* ArrayIterator.prototype's shape
* (arrayIteratorProto_, arrayIteratorProtoShape_)
* To ensure that an ArrayIterator.prototype has not been modified.
*
* Array.prototype's slot number for @@iterator (arrayProtoIteratorSlot_)
* Array.prototype's canonical value for @@iterator (canonicalIteratorFunc_)
* Array.prototype's slot number for @@iterator
* Array.prototype's canonical value for @@iterator
* (arrayProtoIteratorSlot_, canonicalIteratorFunc_)
* To quickly retrieve and ensure that the iterator constructor
* stored in the slot has not changed.
*
* ArrayIterator.prototype's slot number for 'next' (arrayIteratorProtoNextSlot_)
* ArrayIterator.prototype's canonical value for 'next' (canonicalNextFunc_)
* To quickly retrieve and ensure that the 'next' method for ArrayIterator
* objects has not changed.
* ArrayIterator.prototype's slot number for 'next'
* ArrayIterator.prototype's canonical value for 'next'
* (arrayIteratorProtoNextSlot_, canonicalNextFunc_)
* To quickly retrieve and ensure that the 'next' method for
* ArrayIterator objects has not changed.
*/
class Chain : public BaseChain
{

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

@ -90,9 +90,12 @@ class TraceLoggerEvent {
* TraceLoggerTextId. The last bit decides how to read the payload.
*
* payload_ = [ | 0 ]
* ------------------------ = TraceLoggerEventPayload* (incl. last bit)
* -----------------------
* TraceLoggerEventPayload* (incl. last bit)
*
* payload_ = [ | 1 ]
* ------------------- = TraceLoggerTextId (excl. last bit)
* -------------------
* TraceLoggerTextId (excl. last bit)
*/
uintptr_t payload_;

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

@ -1259,7 +1259,7 @@ GenerateImportInterpExit(MacroAssembler& masm, const FuncImport& fi, uint32_t fu
MOZ_ALWAYS_TRUE(invokeArgTypes.append(typeArray, ArrayLength(typeArray)));
// At the point of the call, the stack layout shall be (sp grows to the left):
// | stack args | padding | Value argv[] | padding | retaddr | caller stack args |
// | stack args | padding | argv[] | padding | retaddr | caller stack args |
// The padding between stack args and argv ensures that argv is aligned. The
// padding between argv and retaddr ensures that sp is aligned.
unsigned argOffset = AlignBytes(StackArgBytes(invokeArgTypes), sizeof(double));