| Index: src/mips/full-codegen-mips.cc
|
| diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
|
| index 486eb9db2db7a9da86f06f3521a4bf692881a553..74b3807882733a4540c742f6a5dfd72f071ad534 100644
|
| --- a/src/mips/full-codegen-mips.cc
|
| +++ b/src/mips/full-codegen-mips.cc
|
| @@ -341,10 +341,6 @@ void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) {
|
|
|
| void FullCodeGenerator::EmitProfilingCounterReset() {
|
| int reset_value = FLAG_interrupt_budget;
|
| - if (info_->ShouldSelfOptimize() && !FLAG_retry_self_opt) {
|
| - // Self-optimization is a one-off thing: if it fails, don't try again.
|
| - reset_value = Smi::kMaxValue;
|
| - }
|
| if (isolate()->IsDebuggerActive()) {
|
| // Detect debug break requests as soon as possible.
|
| reset_value = FLAG_interrupt_budget >> 4;
|
| @@ -365,13 +361,10 @@ void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt,
|
| Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
|
| Comment cmnt(masm_, "[ Back edge bookkeeping");
|
| Label ok;
|
| - int weight = 1;
|
| - if (FLAG_weighted_back_edges) {
|
| - ASSERT(back_edge_target->is_bound());
|
| - int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
|
| - weight = Min(kMaxBackEdgeWeight,
|
| - Max(1, distance / kCodeSizeMultiplier));
|
| - }
|
| + ASSERT(back_edge_target->is_bound());
|
| + int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
|
| + int weight = Min(kMaxBackEdgeWeight,
|
| + Max(1, distance / kCodeSizeMultiplier));
|
| EmitProfilingCounterDecrement(weight);
|
| __ slt(at, a3, zero_reg);
|
| __ beq(at, zero_reg, &ok);
|
| @@ -404,32 +397,24 @@ void FullCodeGenerator::EmitReturnSequence() {
|
| __ push(v0);
|
| __ CallRuntime(Runtime::kTraceExit, 1);
|
| }
|
| - if (FLAG_interrupt_at_exit || FLAG_self_optimization) {
|
| - // Pretend that the exit is a backwards jump to the entry.
|
| - int weight = 1;
|
| - if (info_->ShouldSelfOptimize()) {
|
| - weight = FLAG_interrupt_budget / FLAG_self_opt_count;
|
| - } else if (FLAG_weighted_back_edges) {
|
| - int distance = masm_->pc_offset();
|
| - weight = Min(kMaxBackEdgeWeight,
|
| - Max(1, distance / kCodeSizeMultiplier));
|
| - }
|
| - EmitProfilingCounterDecrement(weight);
|
| - Label ok;
|
| - __ Branch(&ok, ge, a3, Operand(zero_reg));
|
| - __ push(v0);
|
| - if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) {
|
| - __ lw(a2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| - __ push(a2);
|
| - __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1);
|
| - } else {
|
| - __ Call(isolate()->builtins()->InterruptCheck(),
|
| - RelocInfo::CODE_TARGET);
|
| - }
|
| - __ pop(v0);
|
| - EmitProfilingCounterReset();
|
| - __ bind(&ok);
|
| + // Pretend that the exit is a backwards jump to the entry.
|
| + int weight = 1;
|
| + if (info_->ShouldSelfOptimize()) {
|
| + weight = FLAG_interrupt_budget / FLAG_self_opt_count;
|
| + } else {
|
| + int distance = masm_->pc_offset();
|
| + weight = Min(kMaxBackEdgeWeight,
|
| + Max(1, distance / kCodeSizeMultiplier));
|
| }
|
| + EmitProfilingCounterDecrement(weight);
|
| + Label ok;
|
| + __ Branch(&ok, ge, a3, Operand(zero_reg));
|
| + __ push(v0);
|
| + __ Call(isolate()->builtins()->InterruptCheck(),
|
| + RelocInfo::CODE_TARGET);
|
| + __ pop(v0);
|
| + EmitProfilingCounterReset();
|
| + __ bind(&ok);
|
|
|
| #ifdef DEBUG
|
| // Add a label for checking the size of the code used for returning.
|
| @@ -631,11 +616,13 @@ void FullCodeGenerator::StackValueContext::Plug(
|
| Label done;
|
| __ bind(materialize_true);
|
| __ LoadRoot(at, Heap::kTrueValueRootIndex);
|
| + // Push the value as the following branch can clobber at in long branch mode.
|
| + __ push(at);
|
| __ Branch(&done);
|
| __ bind(materialize_false);
|
| __ LoadRoot(at, Heap::kFalseValueRootIndex);
|
| - __ bind(&done);
|
| __ push(at);
|
| + __ bind(&done);
|
| }
|
|
|
|
|
| @@ -1780,6 +1767,10 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
| Comment cmnt(masm_, "[ ArrayLiteral");
|
|
|
| expr->BuildConstantElements(isolate());
|
| + int flags = expr->depth() == 1
|
| + ? ArrayLiteral::kShallowElements
|
| + : ArrayLiteral::kNoFlags;
|
| +
|
| ZoneList<Expression*>* subexprs = expr->values();
|
| int length = subexprs->length();
|
|
|
| @@ -1792,6 +1783,14 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
| Handle<FixedArrayBase> constant_elements_values(
|
| FixedArrayBase::cast(constant_elements->get(1)));
|
|
|
| + AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
|
| + ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
|
| + if (has_fast_elements && !FLAG_allocation_site_pretenuring) {
|
| + // If the only customer of allocation sites is transitioning, then
|
| + // we can turn it off if we don't have anywhere else to transition to.
|
| + allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
|
| + }
|
| +
|
| __ mov(a0, result_register());
|
| __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
|
| @@ -1801,26 +1800,24 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
| isolate()->heap()->fixed_cow_array_map()) {
|
| FastCloneShallowArrayStub stub(
|
| FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
|
| - DONT_TRACK_ALLOCATION_SITE,
|
| + allocation_site_mode,
|
| length);
|
| __ CallStub(&stub);
|
| __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(),
|
| 1, a1, a2);
|
| } else if (expr->depth() > 1 || Serializer::enabled() ||
|
| length > FastCloneShallowArrayStub::kMaximumClonedLength) {
|
| - __ Push(a3, a2, a1);
|
| - __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
|
| + __ li(a0, Operand(Smi::FromInt(flags)));
|
| + __ Push(a3, a2, a1, a0);
|
| + __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
|
| } else {
|
| ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
|
| FLAG_smi_only_arrays);
|
| FastCloneShallowArrayStub::Mode mode =
|
| FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
|
| - AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
|
| - ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
|
|
|
| if (has_fast_elements) {
|
| mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
|
| - allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
|
| }
|
|
|
| FastCloneShallowArrayStub stub(mode, allocation_site_mode, length);
|
| @@ -2307,7 +2304,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
|
| patch_site.EmitJumpIfSmi(scratch1, &smi_case);
|
|
|
| __ bind(&stub_call);
|
| - BinaryOpStub stub(op, mode);
|
| + BinaryOpICStub stub(op, mode);
|
| CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
|
| expr->BinaryOperationFeedbackId());
|
| patch_site.EmitPatchInfo();
|
| @@ -2316,7 +2313,6 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
|
| __ bind(&smi_case);
|
| // Smi case. This code works the same way as the smi-smi case in the type
|
| // recording binary operation stub, see
|
| - // BinaryOpStub::GenerateSmiSmiOperation for comments.
|
| switch (op) {
|
| case Token::SAR:
|
| __ Branch(&stub_call);
|
| @@ -2390,7 +2386,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
|
| OverwriteMode mode) {
|
| __ mov(a0, result_register());
|
| __ pop(a1);
|
| - BinaryOpStub stub(op, mode);
|
| + BinaryOpICStub stub(op, mode);
|
| JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
|
| CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
|
| expr->BinaryOperationFeedbackId());
|
| @@ -3724,6 +3720,7 @@ void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) {
|
| VisitForAccumulatorValue(args->at(1));
|
|
|
| __ pop(a1);
|
| + __ mov(a0, result_register()); // NewStringAddStub requires args in a0, a1.
|
| NewStringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED);
|
| __ CallStub(&stub);
|
| } else {
|
| @@ -4461,7 +4458,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| // Record position before stub call.
|
| SetSourcePosition(expr->position());
|
|
|
| - BinaryOpStub stub(Token::ADD, NO_OVERWRITE);
|
| + BinaryOpICStub stub(Token::ADD, NO_OVERWRITE);
|
| CallIC(stub.GetCode(isolate()),
|
| RelocInfo::CODE_TARGET,
|
| expr->CountBinOpFeedbackId());
|
|
|