| Index: src/arm/full-codegen-arm.cc
|
| diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
|
| index 4a3997068df1959aa858a99783726d0a42ef5b1a..f6d3ea36ab8ce6e0ce21759ce369e8be34db2666 100644
|
| --- a/src/arm/full-codegen-arm.cc
|
| +++ b/src/arm/full-codegen-arm.cc
|
| @@ -334,10 +334,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;
|
| @@ -355,13 +351,10 @@ void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt,
|
| Assembler::BlockConstPoolScope block_const_pool(masm_);
|
| 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);
|
| __ b(pl, &ok);
|
| __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET);
|
| @@ -394,32 +387,24 @@ void FullCodeGenerator::EmitReturnSequence() {
|
| __ push(r0);
|
| __ 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;
|
| - __ b(pl, &ok);
|
| - __ push(r0);
|
| - if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) {
|
| - __ ldr(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| - __ push(r2);
|
| - __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1);
|
| - } else {
|
| - __ Call(isolate()->builtins()->InterruptCheck(),
|
| - RelocInfo::CODE_TARGET);
|
| - }
|
| - __ pop(r0);
|
| - 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;
|
| + __ b(pl, &ok);
|
| + __ push(r0);
|
| + __ Call(isolate()->builtins()->InterruptCheck(),
|
| + RelocInfo::CODE_TARGET);
|
| + __ pop(r0);
|
| + EmitProfilingCounterReset();
|
| + __ bind(&ok);
|
|
|
| #ifdef DEBUG
|
| // Add a label for checking the size of the code used for returning.
|
| @@ -1770,6 +1755,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();
|
| Handle<FixedArray> constant_elements = expr->constant_elements();
|
| @@ -1780,6 +1769,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;
|
| + }
|
| +
|
| __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
|
| __ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
|
| @@ -1788,26 +1785,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, r1, r2);
|
| } else if (expr->depth() > 1 || Serializer::enabled() ||
|
| length > FastCloneShallowArrayStub::kMaximumClonedLength) {
|
| - __ Push(r3, r2, r1);
|
| - __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
|
| + __ mov(r0, Operand(Smi::FromInt(flags)));
|
| + __ Push(r3, r2, r1, r0);
|
| + __ 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);
|
| @@ -2288,7 +2283,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();
|
| @@ -2297,7 +2292,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:
|
| __ GetLeastBitsFromSmi(scratch1, right, 5);
|
| @@ -2366,7 +2360,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
|
| Token::Value op,
|
| OverwriteMode mode) {
|
| __ pop(r1);
|
| - 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());
|
| @@ -4406,7 +4400,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());
|
|
|