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

Commit

Permalink
Version 5.0.71.13 (cherry-pick)
Browse files Browse the repository at this point in the history
Merged 85c7357
Merged c854853
Merged e3453a8
Merged 50a394d
Merged 9945b3d
Merged f040b7f
Merged 4c57e05
Merged 96efefd
Merged cafe34a

MIPS: Fix c-linkage.

MIPS: Fix TF EmitPrepareArguments after 85c7357.

MIPS: Adjust code after JALR to JAL optimization removal

MIPS64: Fix 'MIPS: use DAHI/DATH for li macro on mips64r6.'

MIPS64: Fix '[stubs] Introduce a dedicated FastNewObjectStub.'

MIPS64: Fix '[runtime] Optimize and unify rest parameters.'.

MIPS64: Fix 'Fix 'MIPS: use DAHI/DATH for li macro on mips64r6.''

MIPS: Fix [stubs] Introduce a dedicated FastNewObjectStub

MIPS64: Fix [stubs] Introduce a dedicated FastNewObjectStub

R=hablich@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1779783002 .

Cr-Commit-Position: refs/branch-heads/5.0@{#19}
Cr-Branched-From: ad16e6c-refs/heads/5.0.71@{#1}
Cr-Branched-From: bd9df50-refs/heads/master@{#34215}
  • Loading branch information
Akos Palfi committed Mar 9, 2016
1 parent dcbda17 commit 613c941
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 194 deletions.
2 changes: 1 addition & 1 deletion include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 0
#define V8_BUILD_NUMBER 71
#define V8_PATCH_LEVEL 12
#define V8_PATCH_LEVEL 13

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
1 change: 1 addition & 0 deletions src/compiler/c-linkage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ LinkageLocation regloc(Register reg) {
// ===========================================================================
// == mips ===================================================================
// ===========================================================================
#define STACK_SHADOW_WORDS 4
#define PARAM_REGISTERS a0, a1, a2, a3
#define CALLEE_SAVE_REGISTERS \
s0.bit() | s1.bit() | s2.bit() | s3.bit() | s4.bit() | s5.bit() | s6.bit() | \
Expand Down
8 changes: 5 additions & 3 deletions src/compiler/mips/instruction-selector-mips.cc
Original file line number Diff line number Diff line change
Expand Up @@ -852,9 +852,11 @@ void InstructionSelector::EmitPrepareArguments(
// Poke any stack arguments.
int slot = kCArgSlotCount;
for (PushParameter input : (*arguments)) {
Emit(kMipsStoreToStackSlot, g.NoOutput(), g.UseRegister(input.node()),
g.TempImmediate(slot << kPointerSizeLog2));
++slot;
if (input.node()) {
Emit(kMipsStoreToStackSlot, g.NoOutput(), g.UseRegister(input.node()),
g.TempImmediate(slot << kPointerSizeLog2));
++slot;
}
}
} else {
// Possibly align stack here for functions.
Expand Down
2 changes: 1 addition & 1 deletion src/full-codegen/mips64/full-codegen-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void FullCodeGenerator::Generate() {
if (rest_param) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
if (!function_in_register_a1) {
__ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ ld(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
FastNewRestParameterStub stub(isolate());
__ CallStub(&stub);
Expand Down
13 changes: 5 additions & 8 deletions src/mips/assembler-mips.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,14 +520,11 @@ class Assembler : public AssemblerBase {
// a target is resolved and written.
static const int kSpecialTargetSize = 0;

// Number of consecutive instructions used to store 32bit constant.
// Before jump-optimizations, this constant was used in
// RelocInfo::target_address_address() function to tell serializer address of
// the instruction that follows LUI/ORI instruction pair. Now, with new jump
// optimization, where jump-through-register instruction that usually
// follows LUI/ORI pair is substituted with J/JAL, this constant equals
// to 3 instructions (LUI+ORI+J/JAL/JR/JALR).
static const int kInstructionsFor32BitConstant = 3;
// Number of consecutive instructions used to store 32bit constant. This
// constant is used in RelocInfo::target_address_address() function to tell
// serializer address of the instruction that follows LUI/ORI instruction
// pair.
static const int kInstructionsFor32BitConstant = 2;

// Distance between the instruction referring to the address of the call
// target and the return address.
Expand Down
2 changes: 1 addition & 1 deletion src/mips/code-stubs-mips.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4767,7 +4767,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ lw(a2, FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset));
__ JumpIfSmi(a2, &new_object);
__ GetObjectType(a2, a0, a0);
__ Branch(&new_object, ne, a2, Operand(MAP_TYPE));
__ Branch(&new_object, ne, a0, Operand(MAP_TYPE));

// Fall back to runtime if the target differs from the new target's
// initial map constructor.
Expand Down
152 changes: 14 additions & 138 deletions src/mips64/builtins-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,9 @@ void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) {
__ bind(&new_object);
{
FrameScope scope(masm, StackFrame::INTERNAL);
__ Push(a0, a1, a3); // first argument, constructor, new target
__ CallRuntime(Runtime::kNewObject);
__ Push(a0);
FastNewObjectStub stub(masm->isolate());
__ CallStub(&stub);
__ Pop(a0);
}
__ Ret(USE_DELAY_SLOT);
Expand Down Expand Up @@ -460,8 +461,9 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
__ bind(&new_object);
{
FrameScope scope(masm, StackFrame::INTERNAL);
__ Push(a0, a1, a3); // first argument, constructor, new target
__ CallRuntime(Runtime::kNewObject);
__ Push(a0);
FastNewObjectStub stub(masm->isolate());
__ CallStub(&stub);
__ Pop(a0);
}
__ Ret(USE_DELAY_SLOT);
Expand Down Expand Up @@ -542,143 +544,17 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ Push(a2, a0);

if (create_implicit_receiver) {
// Try to allocate the object without transitioning into C code. If any of
// the preconditions is not met, the code bails out to the runtime call.
Label rt_call, allocated;
if (FLAG_inline_new) {
// Verify that the new target is a JSFunction.
__ GetObjectType(a3, a5, a4);
__ Branch(&rt_call, ne, a4, Operand(JS_FUNCTION_TYPE));

// Load the initial map and verify that it is in fact a map.
// a3: new target
__ ld(a2,
FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset));
__ JumpIfSmi(a2, &rt_call);
__ GetObjectType(a2, t1, t0);
__ Branch(&rt_call, ne, t0, Operand(MAP_TYPE));

// Fall back to runtime if the expected base constructor and base
// constructor differ.
__ ld(a5, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset));
__ Branch(&rt_call, ne, a1, Operand(a5));

// Check that the constructor is not constructing a JSFunction (see
// comments in Runtime_NewObject in runtime.cc). In which case the
// initial map's instance type would be JS_FUNCTION_TYPE.
// a1: constructor function
// a2: initial map
__ lbu(t1, FieldMemOperand(a2, Map::kInstanceTypeOffset));
__ Branch(&rt_call, eq, t1, Operand(JS_FUNCTION_TYPE));

// Now allocate the JSObject on the heap.
// a1: constructor function
// a2: initial map
__ lbu(a4, FieldMemOperand(a2, Map::kInstanceSizeOffset));
__ Allocate(a4, t0, a4, t2, &rt_call, SIZE_IN_WORDS);

// Allocated the JSObject, now initialize the fields. Map is set to
// initial map and properties and elements are set to empty fixed array.
// a1: constructor function
// a2: initial map
// a3: object size
// t0: JSObject (not HeapObject tagged - the actual address).
// a4: start of next object
__ LoadRoot(t2, Heap::kEmptyFixedArrayRootIndex);
__ mov(t1, t0);
STATIC_ASSERT(0 * kPointerSize == JSObject::kMapOffset);
__ sd(a2, MemOperand(t1, JSObject::kMapOffset));
STATIC_ASSERT(1 * kPointerSize == JSObject::kPropertiesOffset);
__ sd(t2, MemOperand(t1, JSObject::kPropertiesOffset));
STATIC_ASSERT(2 * kPointerSize == JSObject::kElementsOffset);
__ sd(t2, MemOperand(t1, JSObject::kElementsOffset));
STATIC_ASSERT(3 * kPointerSize == JSObject::kHeaderSize);
__ Daddu(t1, t1, Operand(3 * kPointerSize));

// Add the object tag to make the JSObject real, so that we can continue
// and jump into the continuation code at any time from now on.
__ Daddu(t0, t0, Operand(kHeapObjectTag));

// Fill all the in-object properties with appropriate filler.
// t0: JSObject (tagged)
// t1: First in-object property of JSObject (not tagged)
__ LoadRoot(t3, Heap::kUndefinedValueRootIndex);

if (!is_api_function) {
Label no_inobject_slack_tracking;

MemOperand bit_field3 = FieldMemOperand(a2, Map::kBitField3Offset);
// Check if slack tracking is enabled.
__ lwu(t2, bit_field3);
__ DecodeField<Map::ConstructionCounter>(a6, t2);
// a6: slack tracking counter
__ Branch(&no_inobject_slack_tracking, lt, a6,
Operand(Map::kSlackTrackingCounterEnd));
// Decrease generous allocation count.
__ Dsubu(t2, t2, Operand(1 << Map::ConstructionCounter::kShift));
__ sw(t2, bit_field3);

// Allocate object with a slack.
__ lbu(a0, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset));
__ dsll(a0, a0, kPointerSizeLog2);
__ dsubu(a0, a4, a0);
// a0: offset of first field after pre-allocated fields
if (FLAG_debug_code) {
__ Assert(le, kUnexpectedNumberOfPreAllocatedPropertyFields, t1,
Operand(a0));
}
__ InitializeFieldsWithFiller(t1, a0, t3);

// To allow truncation fill the remaining fields with one pointer
// filler map.
__ LoadRoot(t3, Heap::kOnePointerFillerMapRootIndex);
__ InitializeFieldsWithFiller(t1, a4, t3);

// a6: slack tracking counter value before decreasing.
__ Branch(&allocated, ne, a6, Operand(Map::kSlackTrackingCounterEnd));

// Push the constructor, new_target and the object to the stack,
// and then the initial map as an argument to the runtime call.
__ Push(a1, a3, t0, a2);
__ CallRuntime(Runtime::kFinalizeInstanceSize);
__ Pop(a1, a3, t0);

// Continue with JSObject being successfully allocated.
// a1: constructor function
// a3: new target
// t0: JSObject
__ jmp(&allocated);

__ bind(&no_inobject_slack_tracking);
}

__ InitializeFieldsWithFiller(t1, a4, t3);

// Continue with JSObject being successfully allocated.
// a1: constructor function
// a3: new target
// t0: JSObject
__ jmp(&allocated);
}

// Allocate the new receiver object using the runtime call.
// a1: constructor function
// a3: new target
__ bind(&rt_call);

// Push the constructor and new_target twice, second pair as arguments
// to the runtime call.
__ Push(a1, a3, a1, a3); // constructor function, new target
__ CallRuntime(Runtime::kNewObject);
__ Push(a1, a3);
FastNewObjectStub stub(masm->isolate());
__ CallStub(&stub);
__ mov(t0, v0);
__ Pop(a1, a3);

// Receiver for constructor call allocated.
// a1: constructor function
// a3: new target
// t0: JSObject
__ bind(&allocated);

// ----------- S t a t e -------------
// -- a1: constructor function
// -- a3: new target
// -- t0: newly allocated object
// -----------------------------------
__ ld(a0, MemOperand(sp));
}
__ SmiUntag(a0);
Expand Down
13 changes: 7 additions & 6 deletions src/mips64/code-stubs-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4773,7 +4773,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ ld(a2, FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset));
__ JumpIfSmi(a2, &new_object);
__ GetObjectType(a2, a0, a0);
__ Branch(&new_object, ne, a2, Operand(MAP_TYPE));
__ Branch(&new_object, ne, a0, Operand(MAP_TYPE));

// Fall back to runtime if the target differs from the new target's
// initial map constructor.
Expand All @@ -4792,7 +4792,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ sd(a3, MemOperand(v0, JSObject::kPropertiesOffset));
__ sd(a3, MemOperand(v0, JSObject::kElementsOffset));
STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
__ Addu(a1, v0, Operand(JSObject::kHeaderSize));
__ Daddu(a1, v0, Operand(JSObject::kHeaderSize));

// ----------- S t a t e -------------
// -- v0 : result (untagged)
Expand All @@ -4806,7 +4806,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
// Perform in-object slack tracking if requested.
Label slack_tracking;
STATIC_ASSERT(Map::kNoSlackTracking == 0);
__ lw(a3, FieldMemOperand(a2, Map::kBitField3Offset));
__ lwu(a3, FieldMemOperand(a2, Map::kBitField3Offset));
__ And(at, a3, Operand(Map::ConstructionCounter::kMask));
__ Branch(USE_DELAY_SLOT, &slack_tracking, ne, at, Operand(zero_reg));
__ LoadRoot(a0, Heap::kUndefinedValueRootIndex); // In delay slot.
Expand All @@ -4817,7 +4817,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
// Add the object tag to make the JSObject real.
STATIC_ASSERT(kHeapObjectTag == 1);
__ Ret(USE_DELAY_SLOT);
__ Addu(v0, v0, Operand(kHeapObjectTag)); // In delay slot.
__ Daddu(v0, v0, Operand(kHeapObjectTag)); // In delay slot.
}
__ bind(&slack_tracking);
{
Expand All @@ -4842,7 +4842,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ And(a3, a3, Operand(Map::ConstructionCounter::kMask));
__ Branch(USE_DELAY_SLOT, &finalize, eq, a3, Operand(zero_reg));
STATIC_ASSERT(kHeapObjectTag == 1);
__ Addu(v0, v0, Operand(kHeapObjectTag)); // In delay slot.
__ Daddu(v0, v0, Operand(kHeapObjectTag)); // In delay slot.
__ Ret();

// Finalize the instance size.
Expand All @@ -4863,14 +4863,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize == 1);
__ dsll(a4, a4, kPointerSizeLog2 + kSmiShiftSize + kSmiTagSize);
__ SmiTag(a4);
__ Push(a2, a4);
__ CallRuntime(Runtime::kAllocateInNewSpace);
__ Pop(a2);
}
STATIC_ASSERT(kHeapObjectTag == 1);
__ Dsubu(v0, v0, Operand(kHeapObjectTag));
__ lbu(a5, FieldMemOperand(a2, Map::kInstanceSizeOffset));
__ Lsa(a5, v0, a5, kPointerSizeLog2);
__ Dlsa(a5, v0, a5, kPointerSizeLog2);
__ jmp(&done_allocate);

// Fall back to %NewObject.
Expand Down
Loading

0 comments on commit 613c941

Please sign in to comment.