MIPS: Port count-based profiler

Port r11120 (548ba49bd).

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9835083
Patch from Daniel Kalmar <kalmard@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11141 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a47d1c07
...@@ -119,7 +119,7 @@ void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code, ...@@ -119,7 +119,7 @@ void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code,
const int kInstrSize = Assembler::kInstrSize; const int kInstrSize = Assembler::kInstrSize;
// This structure comes from FullCodeGenerator::EmitStackCheck. // This structure comes from FullCodeGenerator::EmitStackCheck.
// The call of the stack guard check has the following form: // The call of the stack guard check has the following form:
// sltu at, sp, t0 // sltu at, sp, t0 / slt at, a3, zero_reg (in case of count based interrupts)
// beq at, zero_reg, ok // beq at, zero_reg, ok
// lui t9, <stack guard address> upper // lui t9, <stack guard address> upper
// ori t9, <stack guard address> lower // ori t9, <stack guard address> lower
...@@ -167,7 +167,11 @@ void Deoptimizer::RevertStackCheckCodeAt(Code* unoptimized_code, ...@@ -167,7 +167,11 @@ void Deoptimizer::RevertStackCheckCodeAt(Code* unoptimized_code,
// Restore the sltu instruction so beq can be taken again. // Restore the sltu instruction so beq can be taken again.
CodePatcher patcher(pc_after - 6 * kInstrSize, 1); CodePatcher patcher(pc_after - 6 * kInstrSize, 1);
if (FLAG_count_based_interrupts) {
patcher.masm()->slt(at, a3, zero_reg);
} else {
patcher.masm()->sltu(at, sp, t0); patcher.masm()->sltu(at, sp, t0);
}
// Replace the on-stack replacement address in the load-immediate (lui/ori // Replace the on-stack replacement address in the load-immediate (lui/ori
// pair) with the entry address of the normal stack-check code. // pair) with the entry address of the normal stack-check code.
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "compiler.h" #include "compiler.h"
#include "debug.h" #include "debug.h"
#include "full-codegen.h" #include "full-codegen.h"
#include "isolate-inl.h"
#include "parser.h" #include "parser.h"
#include "scopes.h" #include "scopes.h"
#include "stub-cache.h" #include "stub-cache.h"
...@@ -119,7 +120,9 @@ class JumpPatchSite BASE_EMBEDDED { ...@@ -119,7 +120,9 @@ class JumpPatchSite BASE_EMBEDDED {
}; };
// TODO(jkummerow): Obsolete as soon as x64 is updated. Remove.
int FullCodeGenerator::self_optimization_header_size() { int FullCodeGenerator::self_optimization_header_size() {
UNREACHABLE();
return 10 * Instruction::kInstrSize; return 10 * Instruction::kInstrSize;
} }
...@@ -142,32 +145,11 @@ void FullCodeGenerator::Generate() { ...@@ -142,32 +145,11 @@ void FullCodeGenerator::Generate() {
CompilationInfo* info = info_; CompilationInfo* info = info_;
handler_table_ = handler_table_ =
isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED);
profiling_counter_ = isolate()->factory()->NewJSGlobalPropertyCell(
Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget)));
SetFunctionPosition(function()); SetFunctionPosition(function());
Comment cmnt(masm_, "[ function compiled by full code generator"); Comment cmnt(masm_, "[ function compiled by full code generator");
// We can optionally optimize based on counters rather than statistical
// sampling.
if (info->ShouldSelfOptimize()) {
if (FLAG_trace_opt_verbose) {
PrintF("[adding self-optimization header to %s]\n",
*info->function()->debug_name()->ToCString());
}
has_self_optimization_header_ = true;
MaybeObject* maybe_cell = isolate()->heap()->AllocateJSGlobalPropertyCell(
Smi::FromInt(Compiler::kCallsUntilPrimitiveOpt));
JSGlobalPropertyCell* cell;
if (maybe_cell->To(&cell)) {
__ li(a2, Handle<JSGlobalPropertyCell>(cell));
__ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
__ Subu(a3, a3, Operand(Smi::FromInt(1)));
__ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
Handle<Code> compile_stub(
isolate()->builtins()->builtin(Builtins::kLazyRecompile));
__ Jump(compile_stub, RelocInfo::CODE_TARGET, eq, a3, Operand(zero_reg));
ASSERT_EQ(masm_->pc_offset(), self_optimization_header_size());
}
}
#ifdef DEBUG #ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 && if (strlen(FLAG_stop_at) > 0 &&
info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
...@@ -341,6 +323,34 @@ void FullCodeGenerator::ClearAccumulator() { ...@@ -341,6 +323,34 @@ void FullCodeGenerator::ClearAccumulator() {
} }
void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) {
__ li(a2, Operand(profiling_counter_));
__ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
__ Subu(a3, a3, Operand(Smi::FromInt(delta)));
__ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
}
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 = 10;
}
__ li(a2, Operand(profiling_counter_));
__ li(a3, Operand(Smi::FromInt(reset_value)));
__ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
}
static const int kMaxBackEdgeWeight = 127;
static const int kBackEdgeDistanceDivisor = 142;
void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
Label* back_edge_target) { Label* back_edge_target) {
// The generated code is used in Deoptimizer::PatchStackCheckCodeAt so we need // The generated code is used in Deoptimizer::PatchStackCheckCodeAt so we need
...@@ -351,16 +361,35 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, ...@@ -351,16 +361,35 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
Comment cmnt(masm_, "[ Stack check"); Comment cmnt(masm_, "[ Stack check");
Label ok; Label ok;
if (FLAG_count_based_interrupts) {
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 / kBackEdgeDistanceDivisor));
}
EmitProfilingCounterDecrement(weight);
__ slt(at, a3, zero_reg);
__ beq(at, zero_reg, &ok);
// CallStub will emit a li t9 first, so it is safe to use the delay slot.
InterruptStub stub;
__ CallStub(&stub);
} else {
__ LoadRoot(t0, Heap::kStackLimitRootIndex); __ LoadRoot(t0, Heap::kStackLimitRootIndex);
__ sltu(at, sp, t0); __ sltu(at, sp, t0);
__ beq(at, zero_reg, &ok); __ beq(at, zero_reg, &ok);
// CallStub will emit a li t9, ... first, so it is safe to use the delay slot. // CallStub will emit a li t9 first, so it is safe to use the delay slot.
StackCheckStub stub; StackCheckStub stub;
__ CallStub(&stub); __ CallStub(&stub);
}
// Record a mapping of this PC offset to the OSR id. This is used to find // Record a mapping of this PC offset to the OSR id. This is used to find
// the AST id from the unoptimized code in order to use it as a key into // the AST id from the unoptimized code in order to use it as a key into
// the deoptimization input data found in the optimized code. // the deoptimization input data found in the optimized code.
RecordStackCheck(stmt->OsrEntryId()); RecordStackCheck(stmt->OsrEntryId());
if (FLAG_count_based_interrupts) {
EmitProfilingCounterReset();
}
__ bind(&ok); __ bind(&ok);
PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
...@@ -383,6 +412,32 @@ void FullCodeGenerator::EmitReturnSequence() { ...@@ -383,6 +412,32 @@ void FullCodeGenerator::EmitReturnSequence() {
__ push(v0); __ push(v0);
__ CallRuntime(Runtime::kTraceExit, 1); __ 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 / kBackEdgeDistanceDivisor));
}
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 {
InterruptStub stub;
__ CallStub(&stub);
}
__ pop(v0);
EmitProfilingCounterReset();
__ bind(&ok);
}
#ifdef DEBUG #ifdef DEBUG
// Add a label for checking the size of the code used for returning. // Add a label for checking the size of the code used for returning.
...@@ -902,7 +957,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { ...@@ -902,7 +957,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
// Record position before stub call for type feedback. // Record position before stub call for type feedback.
SetSourcePosition(clause->position()); SetSourcePosition(clause->position());
Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT);
__ Call(ic, RelocInfo::CODE_TARGET, clause->CompareId()); CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId());
patch_site.EmitPatchInfo(); patch_site.EmitPatchInfo();
__ Branch(&next_test, ne, v0, Operand(zero_reg)); __ Branch(&next_test, ne, v0, Operand(zero_reg));
...@@ -1195,7 +1250,7 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, ...@@ -1195,7 +1250,7 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
? RelocInfo::CODE_TARGET ? RelocInfo::CODE_TARGET
: RelocInfo::CODE_TARGET_CONTEXT; : RelocInfo::CODE_TARGET_CONTEXT;
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
__ Call(ic, mode); CallIC(ic, mode);
} }
...@@ -1279,7 +1334,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { ...@@ -1279,7 +1334,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
__ lw(a0, GlobalObjectOperand()); __ lw(a0, GlobalObjectOperand());
__ li(a2, Operand(var->name())); __ li(a2, Operand(var->name()));
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
__ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); CallIC(ic, RelocInfo::CODE_TARGET_CONTEXT);
context()->Plug(v0); context()->Plug(v0);
break; break;
} }
...@@ -1493,7 +1548,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1493,7 +1548,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->StoreIC_Initialize() ? isolate()->builtins()->StoreIC_Initialize()
: isolate()->builtins()->StoreIC_Initialize_Strict(); : isolate()->builtins()->StoreIC_Initialize_Strict();
__ Call(ic, RelocInfo::CODE_TARGET, key->id()); CallIC(ic, RelocInfo::CODE_TARGET, key->id());
PrepareForBailoutForId(key->id(), NO_REGISTERS); PrepareForBailoutForId(key->id(), NO_REGISTERS);
} else { } else {
VisitForEffect(value); VisitForEffect(value);
...@@ -1766,7 +1821,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { ...@@ -1766,7 +1821,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
__ li(a2, Operand(key->handle())); __ li(a2, Operand(key->handle()));
// Call load IC. It has arguments receiver and property name a0 and a2. // Call load IC. It has arguments receiver and property name a0 and a2.
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
__ Call(ic, RelocInfo::CODE_TARGET, prop->id()); CallIC(ic, RelocInfo::CODE_TARGET, prop->id());
} }
...@@ -1775,7 +1830,7 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { ...@@ -1775,7 +1830,7 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
__ mov(a0, result_register()); __ mov(a0, result_register());
// Call keyed load IC. It has arguments key and receiver in a0 and a1. // Call keyed load IC. It has arguments key and receiver in a0 and a1.
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
__ Call(ic, RelocInfo::CODE_TARGET, prop->id()); CallIC(ic, RelocInfo::CODE_TARGET, prop->id());
} }
...@@ -1803,7 +1858,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, ...@@ -1803,7 +1858,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
__ bind(&stub_call); __ bind(&stub_call);
BinaryOpStub stub(op, mode); BinaryOpStub stub(op, mode);
__ Call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id()); CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id());
patch_site.EmitPatchInfo(); patch_site.EmitPatchInfo();
__ jmp(&done); __ jmp(&done);
...@@ -1886,7 +1941,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, ...@@ -1886,7 +1941,7 @@ void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
__ pop(a1); __ pop(a1);
BinaryOpStub stub(op, mode); BinaryOpStub stub(op, mode);
JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
__ Call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id()); CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id());
patch_site.EmitPatchInfo(); patch_site.EmitPatchInfo();
context()->Plug(v0); context()->Plug(v0);
} }
...@@ -1927,7 +1982,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { ...@@ -1927,7 +1982,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->StoreIC_Initialize() ? isolate()->builtins()->StoreIC_Initialize()
: isolate()->builtins()->StoreIC_Initialize_Strict(); : isolate()->builtins()->StoreIC_Initialize_Strict();
__ Call(ic); CallIC(ic);
break; break;
} }
case KEYED_PROPERTY: { case KEYED_PROPERTY: {
...@@ -1940,7 +1995,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { ...@@ -1940,7 +1995,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize() ? isolate()->builtins()->KeyedStoreIC_Initialize()
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
__ Call(ic); CallIC(ic);
break; break;
} }
} }
...@@ -1958,7 +2013,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, ...@@ -1958,7 +2013,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->StoreIC_Initialize() ? isolate()->builtins()->StoreIC_Initialize()
: isolate()->builtins()->StoreIC_Initialize_Strict(); : isolate()->builtins()->StoreIC_Initialize_Strict();
__ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); CallIC(ic, RelocInfo::CODE_TARGET_CONTEXT);
} else if (op == Token::INIT_CONST) { } else if (op == Token::INIT_CONST) {
// Const initializers need a write barrier. // Const initializers need a write barrier.
...@@ -2077,7 +2132,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { ...@@ -2077,7 +2132,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->StoreIC_Initialize() ? isolate()->builtins()->StoreIC_Initialize()
: isolate()->builtins()->StoreIC_Initialize_Strict(); : isolate()->builtins()->StoreIC_Initialize_Strict();
__ Call(ic, RelocInfo::CODE_TARGET, expr->id()); CallIC(ic, RelocInfo::CODE_TARGET, expr->id());
// If the assignment ends an initialization block, revert to fast case. // If the assignment ends an initialization block, revert to fast case.
if (expr->ends_initialization_block()) { if (expr->ends_initialization_block()) {
...@@ -2129,7 +2184,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { ...@@ -2129,7 +2184,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize() ? isolate()->builtins()->KeyedStoreIC_Initialize()
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
__ Call(ic, RelocInfo::CODE_TARGET, expr->id()); CallIC(ic, RelocInfo::CODE_TARGET, expr->id());
// If the assignment ends an initialization block, revert to fast case. // If the assignment ends an initialization block, revert to fast case.
if (expr->ends_initialization_block()) { if (expr->ends_initialization_block()) {
...@@ -2164,6 +2219,14 @@ void FullCodeGenerator::VisitProperty(Property* expr) { ...@@ -2164,6 +2219,14 @@ void FullCodeGenerator::VisitProperty(Property* expr) {
} }
void FullCodeGenerator::CallIC(Handle<Code> code,
RelocInfo::Mode rmode,
unsigned ast_id) {
ic_total_count_++;
__ Call(code, rmode, ast_id);
}
void FullCodeGenerator::EmitCallWithIC(Call* expr, void FullCodeGenerator::EmitCallWithIC(Call* expr,
Handle<Object> name, Handle<Object> name,
RelocInfo::Mode mode) { RelocInfo::Mode mode) {
...@@ -2181,7 +2244,7 @@ void FullCodeGenerator::EmitCallWithIC(Call* expr, ...@@ -2181,7 +2244,7 @@ void FullCodeGenerator::EmitCallWithIC(Call* expr,
// Call the IC initialization code. // Call the IC initialization code.
Handle<Code> ic = Handle<Code> ic =
isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
__ Call(ic, mode, expr->id()); CallIC(ic, mode, expr->id());
RecordJSReturnSite(expr); RecordJSReturnSite(expr);
// Restore context register. // Restore context register.
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
...@@ -2214,7 +2277,7 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, ...@@ -2214,7 +2277,7 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
Handle<Code> ic = Handle<Code> ic =
isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count);
__ lw(a2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. __ lw(a2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key.
__ Call(ic, RelocInfo::CODE_TARGET, expr->id()); CallIC(ic, RelocInfo::CODE_TARGET, expr->id());
RecordJSReturnSite(expr); RecordJSReturnSite(expr);
// Restore context register. // Restore context register.
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
...@@ -3828,7 +3891,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { ...@@ -3828,7 +3891,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
RelocInfo::Mode mode = RelocInfo::CODE_TARGET; RelocInfo::Mode mode = RelocInfo::CODE_TARGET;
Handle<Code> ic = Handle<Code> ic =
isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
__ Call(ic, mode, expr->id()); CallIC(ic, mode, expr->id());
// Restore context register. // Restore context register.
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
} else { } else {
...@@ -3984,7 +4047,7 @@ void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, ...@@ -3984,7 +4047,7 @@ void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr,
VisitForAccumulatorValue(expr->expression()); VisitForAccumulatorValue(expr->expression());
SetSourcePosition(expr->position()); SetSourcePosition(expr->position());
__ mov(a0, result_register()); __ mov(a0, result_register());
__ Call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id()); CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id());
context()->Plug(v0); context()->Plug(v0);
} }
...@@ -4095,7 +4158,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4095,7 +4158,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
SetSourcePosition(expr->position()); SetSourcePosition(expr->position());
BinaryOpStub stub(Token::ADD, NO_OVERWRITE); BinaryOpStub stub(Token::ADD, NO_OVERWRITE);
__ Call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountId()); CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountId());
patch_site.EmitPatchInfo(); patch_site.EmitPatchInfo();
__ bind(&done); __ bind(&done);
...@@ -4128,7 +4191,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4128,7 +4191,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->StoreIC_Initialize() ? isolate()->builtins()->StoreIC_Initialize()
: isolate()->builtins()->StoreIC_Initialize_Strict(); : isolate()->builtins()->StoreIC_Initialize_Strict();
__ Call(ic, RelocInfo::CODE_TARGET, expr->id()); CallIC(ic, RelocInfo::CODE_TARGET, expr->id());
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
if (expr->is_postfix()) { if (expr->is_postfix()) {
if (!context()->IsEffect()) { if (!context()->IsEffect()) {
...@@ -4146,7 +4209,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4146,7 +4209,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
Handle<Code> ic = is_classic_mode() Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize() ? isolate()->builtins()->KeyedStoreIC_Initialize()
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
__ Call(ic, RelocInfo::CODE_TARGET, expr->id()); CallIC(ic, RelocInfo::CODE_TARGET, expr->id());
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
if (expr->is_postfix()) { if (expr->is_postfix()) {
if (!context()->IsEffect()) { if (!context()->IsEffect()) {
...@@ -4172,7 +4235,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { ...@@ -4172,7 +4235,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
// Use a regular load, not a contextual load, to avoid a reference // Use a regular load, not a contextual load, to avoid a reference
// error. // error.
__ Call(ic); CallIC(ic);
PrepareForBailout(expr, TOS_REG); PrepareForBailout(expr, TOS_REG);
context()->Plug(v0); context()->Plug(v0);
} else if (proxy != NULL && proxy->var()->IsLookupSlot()) { } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
...@@ -4350,7 +4413,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { ...@@ -4350,7 +4413,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
// Record position and call the compare IC. // Record position and call the compare IC.
SetSourcePosition(expr->position()); SetSourcePosition(expr->position());
Handle<Code> ic = CompareIC::GetUninitialized(op); Handle<Code> ic = CompareIC::GetUninitialized(op);
__ Call(ic, RelocInfo::CODE_TARGET, expr->id()); CallIC(ic, RelocInfo::CODE_TARGET, expr->id());
patch_site.EmitPatchInfo(); patch_site.EmitPatchInfo();
PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
Split(cc, v0, Operand(zero_reg), if_true, if_false, fall_through); Split(cc, v0, Operand(zero_reg), if_true, if_false, fall_through);
......
...@@ -175,7 +175,9 @@ void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) { ...@@ -175,7 +175,9 @@ void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) {
// prepared to generate it, but we don't expect to have to. // prepared to generate it, but we don't expect to have to.
bool found_code = false; bool found_code = false;
Code* stack_check_code = NULL; Code* stack_check_code = NULL;
#if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_ARM) #if defined(V8_TARGET_ARCH_IA32) || \
defined(V8_TARGET_ARCH_ARM) || \
defined(V8_TARGET_ARCH_MIPS)
if (FLAG_count_based_interrupts) { if (FLAG_count_based_interrupts) {
InterruptStub interrupt_stub; InterruptStub interrupt_stub;
found_code = interrupt_stub.FindCodeInCache(&stack_check_code); found_code = interrupt_stub.FindCodeInCache(&stack_check_code);
...@@ -351,7 +353,9 @@ void RuntimeProfiler::OptimizeNow() { ...@@ -351,7 +353,9 @@ void RuntimeProfiler::OptimizeNow() {
void RuntimeProfiler::NotifyTick() { void RuntimeProfiler::NotifyTick() {
#if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_ARM) #if defined(V8_TARGET_ARCH_IA32) || \
defined(V8_TARGET_ARCH_ARM) || \
defined(V8_TARGET_ARCH_MIPS)
if (FLAG_count_based_interrupts) return; if (FLAG_count_based_interrupts) return;
#endif #endif
isolate_->stack_guard()->RequestRuntimeProfilerTick(); isolate_->stack_guard()->RequestRuntimeProfilerTick();
......
...@@ -8358,7 +8358,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { ...@@ -8358,7 +8358,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
PrintF("]\n"); PrintF("]\n");
} }
Handle<Code> check_code; Handle<Code> check_code;
#if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_ARM) #if defined(V8_TARGET_ARCH_IA32) || \
defined(V8_TARGET_ARCH_ARM) || \
defined(V8_TARGET_ARCH_MIPS)
if (FLAG_count_based_interrupts) { if (FLAG_count_based_interrupts) {
InterruptStub interrupt_stub; InterruptStub interrupt_stub;
check_code = interrupt_stub.GetCode(); check_code = interrupt_stub.GetCode();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment