Commit a97f2b10 authored by akos.palfi@imgtec.com's avatar akos.palfi@imgtec.com

MIPS64: Removing ic.h from code-stubs.h

Port r23977 (d0cba839)

Original commit message:
CodeStubs use state types defined in ic.h, but this has the unfortunate effect of spreading ic.h all over the place. Instead, define these shared state types in ic-public.h and allow ic.h to concern itself with internal state change of the ICs.

More work could/should be done here, but this is a first step.

BUG=
R=paul.lind@imgtec.com

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23984 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e4c3b699
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "src/ic/call-optimization.h" #include "src/ic/call-optimization.h"
#include "src/ic/handler-compiler.h" #include "src/ic/handler-compiler.h"
#include "src/ic/ic.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#if V8_TARGET_ARCH_MIPS64 #if V8_TARGET_ARCH_MIPS64
#include "src/ic/ic.h"
#include "src/ic/ic-compiler.h" #include "src/ic/ic-compiler.h"
namespace v8 { namespace v8 {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "src/code-stubs.h" #include "src/code-stubs.h"
#include "src/codegen.h" #include "src/codegen.h"
#include "src/ic/handler-compiler.h" #include "src/ic/handler-compiler.h"
#include "src/ic/ic.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/jsregexp.h" #include "src/jsregexp.h"
#include "src/regexp-macro-assembler.h" #include "src/regexp-macro-assembler.h"
...@@ -591,12 +592,12 @@ static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, ...@@ -591,12 +592,12 @@ static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm,
static void CompareICStub_CheckInputType(MacroAssembler* masm, Register input, static void CompareICStub_CheckInputType(MacroAssembler* masm, Register input,
Register scratch, Register scratch,
CompareIC::State expected, CompareICState::State expected,
Label* fail) { Label* fail) {
Label ok; Label ok;
if (expected == CompareIC::SMI) { if (expected == CompareICState::SMI) {
__ JumpIfNotSmi(input, fail); __ JumpIfNotSmi(input, fail);
} else if (expected == CompareIC::NUMBER) { } else if (expected == CompareICState::NUMBER) {
__ JumpIfSmi(input, &ok); __ JumpIfSmi(input, &ok);
__ CheckMap(input, scratch, Heap::kHeapNumberMapRootIndex, fail, __ CheckMap(input, scratch, Heap::kHeapNumberMapRootIndex, fail,
DONT_DO_SMI_CHECK); DONT_DO_SMI_CHECK);
...@@ -2821,7 +2822,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) { ...@@ -2821,7 +2822,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
__ TailCallStub(&stub); __ TailCallStub(&stub);
__ bind(&miss); __ bind(&miss);
GenerateMiss(masm, IC::kCallIC_Customization_Miss); GenerateMiss(masm);
// The slow case, we need this no matter what to complete a call after a miss. // The slow case, we need this no matter what to complete a call after a miss.
CallFunctionNoFeedback(masm, CallFunctionNoFeedback(masm,
...@@ -2897,7 +2898,7 @@ void CallICStub::Generate(MacroAssembler* masm) { ...@@ -2897,7 +2898,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
// We are here because tracing is on or we are going monomorphic. // We are here because tracing is on or we are going monomorphic.
__ bind(&miss); __ bind(&miss);
GenerateMiss(masm, IC::kCallIC_Miss); GenerateMiss(masm);
// the slow case // the slow case
__ bind(&slow_start); __ bind(&slow_start);
...@@ -2912,7 +2913,7 @@ void CallICStub::Generate(MacroAssembler* masm) { ...@@ -2912,7 +2913,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
} }
void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) { void CallICStub::GenerateMiss(MacroAssembler* masm) {
// Get the receiver of the function from the stack; 1 ~ return address. // Get the receiver of the function from the stack; 1 ~ return address.
__ ld(a4, MemOperand(sp, (arg_count() + 1) * kPointerSize)); __ ld(a4, MemOperand(sp, (arg_count() + 1) * kPointerSize));
...@@ -2923,6 +2924,9 @@ void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) { ...@@ -2923,6 +2924,9 @@ void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) {
__ Push(a4, a1, a2, a3); __ Push(a4, a1, a2, a3);
// Call the entry. // Call the entry.
IC::UtilityId id = GetICState() == DEFAULT ? IC::kCallIC_Miss
: IC::kCallIC_Customization_Miss;
ExternalReference miss = ExternalReference(IC_Utility(id), ExternalReference miss = ExternalReference(IC_Utility(id),
masm->isolate()); masm->isolate());
__ CallExternalReference(miss, 4); __ CallExternalReference(miss, 4);
...@@ -3475,7 +3479,7 @@ void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { ...@@ -3475,7 +3479,7 @@ void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
void CompareICStub::GenerateSmis(MacroAssembler* masm) { void CompareICStub::GenerateSmis(MacroAssembler* masm) {
DCHECK(state() == CompareIC::SMI); DCHECK(state() == CompareICState::SMI);
Label miss; Label miss;
__ Or(a2, a1, a0); __ Or(a2, a1, a0);
__ JumpIfNotSmi(a2, &miss); __ JumpIfNotSmi(a2, &miss);
...@@ -3498,16 +3502,16 @@ void CompareICStub::GenerateSmis(MacroAssembler* masm) { ...@@ -3498,16 +3502,16 @@ void CompareICStub::GenerateSmis(MacroAssembler* masm) {
void CompareICStub::GenerateNumbers(MacroAssembler* masm) { void CompareICStub::GenerateNumbers(MacroAssembler* masm) {
DCHECK(state() == CompareIC::NUMBER); DCHECK(state() == CompareICState::NUMBER);
Label generic_stub; Label generic_stub;
Label unordered, maybe_undefined1, maybe_undefined2; Label unordered, maybe_undefined1, maybe_undefined2;
Label miss; Label miss;
if (left() == CompareIC::SMI) { if (left() == CompareICState::SMI) {
__ JumpIfNotSmi(a1, &miss); __ JumpIfNotSmi(a1, &miss);
} }
if (right() == CompareIC::SMI) { if (right() == CompareICState::SMI) {
__ JumpIfNotSmi(a0, &miss); __ JumpIfNotSmi(a0, &miss);
} }
...@@ -3565,8 +3569,8 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { ...@@ -3565,8 +3569,8 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) {
__ bind(&unordered); __ bind(&unordered);
__ bind(&generic_stub); __ bind(&generic_stub);
CompareICStub stub(isolate(), op(), CompareIC::GENERIC, CompareIC::GENERIC, CompareICStub stub(isolate(), op(), CompareICState::GENERIC,
CompareIC::GENERIC); CompareICState::GENERIC, CompareICState::GENERIC);
__ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
__ bind(&maybe_undefined1); __ bind(&maybe_undefined1);
...@@ -3591,7 +3595,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { ...@@ -3591,7 +3595,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) {
void CompareICStub::GenerateInternalizedStrings(MacroAssembler* masm) { void CompareICStub::GenerateInternalizedStrings(MacroAssembler* masm) {
DCHECK(state() == CompareIC::INTERNALIZED_STRING); DCHECK(state() == CompareICState::INTERNALIZED_STRING);
Label miss; Label miss;
// Registers containing left and right operands respectively. // Registers containing left and right operands respectively.
...@@ -3631,7 +3635,7 @@ void CompareICStub::GenerateInternalizedStrings(MacroAssembler* masm) { ...@@ -3631,7 +3635,7 @@ void CompareICStub::GenerateInternalizedStrings(MacroAssembler* masm) {
void CompareICStub::GenerateUniqueNames(MacroAssembler* masm) { void CompareICStub::GenerateUniqueNames(MacroAssembler* masm) {
DCHECK(state() == CompareIC::UNIQUE_NAME); DCHECK(state() == CompareICState::UNIQUE_NAME);
DCHECK(GetCondition() == eq); DCHECK(GetCondition() == eq);
Label miss; Label miss;
...@@ -3675,7 +3679,7 @@ void CompareICStub::GenerateUniqueNames(MacroAssembler* masm) { ...@@ -3675,7 +3679,7 @@ void CompareICStub::GenerateUniqueNames(MacroAssembler* masm) {
void CompareICStub::GenerateStrings(MacroAssembler* masm) { void CompareICStub::GenerateStrings(MacroAssembler* masm) {
DCHECK(state() == CompareIC::STRING); DCHECK(state() == CompareICState::STRING);
Label miss; Label miss;
bool equality = Token::IsEqualityOp(op()); bool equality = Token::IsEqualityOp(op());
...@@ -3761,7 +3765,7 @@ void CompareICStub::GenerateStrings(MacroAssembler* masm) { ...@@ -3761,7 +3765,7 @@ void CompareICStub::GenerateStrings(MacroAssembler* masm) {
void CompareICStub::GenerateObjects(MacroAssembler* masm) { void CompareICStub::GenerateObjects(MacroAssembler* masm) {
DCHECK(state() == CompareIC::OBJECT); DCHECK(state() == CompareICState::OBJECT);
Label miss; Label miss;
__ And(a2, a1, Operand(a0)); __ And(a2, a1, Operand(a0));
__ JumpIfSmi(a2, &miss); __ JumpIfSmi(a2, &miss);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "src/compiler.h" #include "src/compiler.h"
#include "src/debug.h" #include "src/debug.h"
#include "src/full-codegen.h" #include "src/full-codegen.h"
#include "src/ic/ic.h"
#include "src/isolate-inl.h" #include "src/isolate-inl.h"
#include "src/parser.h" #include "src/parser.h"
#include "src/scopes.h" #include "src/scopes.h"
...@@ -2611,12 +2612,11 @@ void FullCodeGenerator::CallIC(Handle<Code> code, ...@@ -2611,12 +2612,11 @@ void FullCodeGenerator::CallIC(Handle<Code> code,
void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
Expression* callee = expr->expression(); Expression* callee = expr->expression();
CallIC::CallType call_type = callee->IsVariableProxy() CallICState::CallType call_type =
? CallIC::FUNCTION callee->IsVariableProxy() ? CallICState::FUNCTION : CallICState::METHOD;
: CallIC::METHOD;
// Get the target function. // Get the target function.
if (call_type == CallIC::FUNCTION) { if (call_type == CallICState::FUNCTION) {
{ StackValueContext context(this); { StackValueContext context(this);
EmitVariableLoad(callee->AsVariableProxy()); EmitVariableLoad(callee->AsVariableProxy());
PrepareForBailout(callee, NO_REGISTERS); PrepareForBailout(callee, NO_REGISTERS);
...@@ -2660,11 +2660,11 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, ...@@ -2660,11 +2660,11 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr,
__ push(at); __ push(at);
__ sd(v0, MemOperand(sp, kPointerSize)); __ sd(v0, MemOperand(sp, kPointerSize));
EmitCall(expr, CallIC::METHOD); EmitCall(expr, CallICState::METHOD);
} }
void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) {
// Load the arguments. // Load the arguments.
ZoneList<Expression*>* args = expr->arguments(); ZoneList<Expression*>* args = expr->arguments();
int arg_count = args->length(); int arg_count = args->length();
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "src/code-factory.h" #include "src/code-factory.h"
#include "src/code-stubs.h" #include "src/code-stubs.h"
#include "src/hydrogen-osr.h" #include "src/hydrogen-osr.h"
#include "src/ic/ic.h"
#include "src/ic/stub-cache.h" #include "src/ic/stub-cache.h"
#include "src/mips64/lithium-codegen-mips64.h" #include "src/mips64/lithium-codegen-mips64.h"
#include "src/mips64/lithium-gap-resolver-mips64.h" #include "src/mips64/lithium-gap-resolver-mips64.h"
......
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