Commit a8962e89 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Use enum instead of bool for force_generic (MISS / MISS_FORCE_GENERIC)

Review URL: https://chromiumcodereview.appspot.com/11737032

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13314 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4ee20d85
......@@ -862,7 +862,7 @@ void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
__ mov(r0, r2);
__ Ret();
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -891,7 +891,7 @@ void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
__ RecordWrite(r3, r6, r9, kLRHasNotBeenSaved, kDontSaveFPRegs);
__ Ret();
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -925,7 +925,7 @@ void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm,
Object* KeyedLoadIC_Miss(Arguments args);
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// ---------- S t a t e --------------
// -- lr : return address
// -- r0 : key
......@@ -938,7 +938,7 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
__ Push(r1, r0);
// Perform tail call to the entry.
ExternalReference ref = force_generic
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric), isolate)
: ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate);
......@@ -1158,7 +1158,7 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
char_at_generator.GenerateSlow(masm, call_helper);
__ bind(&miss);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -1198,11 +1198,11 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
1);
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// ---------- S t a t e --------------
// -- r0 : value
// -- r1 : key
......@@ -1213,7 +1213,7 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
// Push receiver, key and value for runtime call.
__ Push(r2, r1, r0);
ExternalReference ref = force_generic
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric),
masm->isolate())
: ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate());
......
......@@ -1536,12 +1536,12 @@ static void Generate_KeyedLoadIC_Slow(MacroAssembler* masm) {
static void Generate_KeyedLoadIC_Miss(MacroAssembler* masm) {
KeyedLoadIC::GenerateMiss(masm, false);
KeyedLoadIC::GenerateMiss(masm, MISS);
}
static void Generate_KeyedLoadIC_MissForceGeneric(MacroAssembler* masm) {
KeyedLoadIC::GenerateMiss(masm, true);
KeyedLoadIC::GenerateMiss(masm, MISS_FORCE_GENERIC);
}
......@@ -1638,12 +1638,12 @@ static void Generate_KeyedStoreIC_Generic_Strict(MacroAssembler* masm) {
static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) {
KeyedStoreIC::GenerateMiss(masm, false);
KeyedStoreIC::GenerateMiss(masm, MISS);
}
static void Generate_KeyedStoreIC_MissForceGeneric(MacroAssembler* masm) {
KeyedStoreIC::GenerateMiss(masm, true);
KeyedStoreIC::GenerateMiss(masm, MISS_FORCE_GENERIC);
}
......
......@@ -647,7 +647,7 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
char_at_generator.GenerateSlow(masm, call_helper);
__ bind(&miss);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -689,7 +689,7 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
__ TailCallExternalReference(ref, 2, 1);
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -714,7 +714,7 @@ void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
__ mov(eax, unmapped_location);
__ Ret();
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -743,7 +743,7 @@ void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
__ RecordWrite(ebx, edi, edx, kDontSaveFPRegs);
__ Ret();
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -1385,7 +1385,7 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
}
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// ----------- S t a t e -------------
// -- ecx : key
// -- edx : receiver
......@@ -1400,7 +1400,7 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
__ push(ebx); // return address
// Perform tail call to the entry.
ExternalReference ref = force_generic
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric),
masm->isolate())
: ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate());
......@@ -1598,7 +1598,7 @@ void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// ----------- S t a t e -------------
// -- eax : value
// -- ecx : key
......@@ -1613,7 +1613,7 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
__ push(ebx);
// Do tail-call to runtime routine.
ExternalReference ref = force_generic
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric),
masm->isolate())
: ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate());
......
......@@ -1108,7 +1108,7 @@ static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) {
MaybeObject* KeyedLoadIC::Load(State state,
Handle<Object> object,
Handle<Object> key,
bool force_generic_stub) {
ICMissMode miss_mode) {
// Check for values that can be converted into a symbol directly or
// is representable as a smi.
key = TryConvertKey(key, isolate());
......@@ -1209,7 +1209,7 @@ MaybeObject* KeyedLoadIC::Load(State state,
if (use_ic) {
Handle<Code> stub = generic_stub();
if (!force_generic_stub) {
if (miss_mode != MISS_FORCE_GENERIC) {
if (object->IsString() && key->IsNumber()) {
if (state == UNINITIALIZED) {
stub = string_stub();
......@@ -1880,7 +1880,7 @@ MaybeObject* KeyedStoreIC::Store(State state,
Handle<Object> object,
Handle<Object> key,
Handle<Object> value,
bool force_generic) {
ICMissMode miss_mode) {
// Check for values that can be converted into a symbol directly or
// is representable as a smi.
key = TryConvertKey(key, isolate());
......@@ -1942,7 +1942,7 @@ MaybeObject* KeyedStoreIC::Store(State state,
if (receiver->elements()->map() ==
isolate()->heap()->non_strict_arguments_elements_map()) {
stub = non_strict_arguments_stub();
} else if (!force_generic) {
} else if (miss_mode != MISS_FORCE_GENERIC) {
if (key->IsSmi() && (target() != *non_strict_arguments_stub())) {
StubKind stub_kind = GetStubKind(receiver, key, value);
stub = ComputeStub(receiver, stub_kind, strict_mode, stub);
......@@ -2110,7 +2110,7 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss) {
ASSERT(args.length() == 2);
KeyedLoadIC ic(isolate);
IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
return ic.Load(state, args.at<Object>(0), args.at<Object>(1), false);
return ic.Load(state, args.at<Object>(0), args.at<Object>(1), MISS);
}
......@@ -2119,7 +2119,10 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissForceGeneric) {
ASSERT(args.length() == 2);
KeyedLoadIC ic(isolate);
IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
return ic.Load(state, args.at<Object>(0), args.at<Object>(1), true);
return ic.Load(state,
args.at<Object>(0),
args.at<Object>(1),
MISS_FORCE_GENERIC);
}
......@@ -2211,7 +2214,7 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Miss) {
args.at<Object>(0),
args.at<Object>(1),
args.at<Object>(2),
false);
MISS);
}
......@@ -2244,7 +2247,7 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissForceGeneric) {
args.at<Object>(0),
args.at<Object>(1),
args.at<Object>(2),
true);
MISS_FORCE_GENERIC);
}
......
......@@ -476,6 +476,12 @@ class KeyedIC: public IC {
};
enum ICMissMode {
MISS_FORCE_GENERIC,
MISS
};
class KeyedLoadIC: public KeyedIC {
public:
explicit KeyedLoadIC(Isolate* isolate) : KeyedIC(isolate) {
......@@ -485,16 +491,16 @@ class KeyedLoadIC: public KeyedIC {
MUST_USE_RESULT MaybeObject* Load(State state,
Handle<Object> object,
Handle<Object> key,
bool force_generic_stub);
ICMissMode force_generic);
// Code generator routines.
static void GenerateMiss(MacroAssembler* masm, bool force_generic);
static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic);
static void GenerateRuntimeGetProperty(MacroAssembler* masm);
static void GenerateInitialize(MacroAssembler* masm) {
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
static void GeneratePreMonomorphic(MacroAssembler* masm) {
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
static void GenerateGeneric(MacroAssembler* masm);
static void GenerateString(MacroAssembler* masm);
......@@ -654,13 +660,13 @@ class KeyedStoreIC: public KeyedIC {
Handle<Object> object,
Handle<Object> name,
Handle<Object> value,
bool force_generic);
ICMissMode force_generic);
// Code generators for stub routines. Only called once at startup.
static void GenerateInitialize(MacroAssembler* masm) {
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
static void GenerateMiss(MacroAssembler* masm, bool force_generic);
static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic);
static void GenerateSlow(MacroAssembler* masm);
static void GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictModeFlag strict_mode);
......@@ -686,7 +692,7 @@ class KeyedStoreIC: public KeyedIC {
StrictModeFlag strict_mode,
KeyedAccessGrowMode grow_mode);
private:
private:
// Update the inline cache.
void UpdateCaches(LookupResult* lookup,
State state,
......
......@@ -858,7 +858,7 @@ void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
__ Ret(USE_DELAY_SLOT);
__ mov(v0, a2);
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -893,7 +893,7 @@ void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
__ Ret(USE_DELAY_SLOT);
__ mov(v0, a0); // (In delay slot) return the value stored in v0.
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -926,7 +926,7 @@ void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm,
Object* KeyedLoadIC_Miss(Arguments args);
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// ---------- S t a t e --------------
// -- ra : return address
// -- a0 : key
......@@ -939,7 +939,7 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
__ Push(a1, a0);
// Perform tail call to the entry.
ExternalReference ref = force_generic
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric), isolate)
: ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate);
......@@ -1166,7 +1166,7 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
char_at_generator.GenerateSlow(masm, call_helper);
__ bind(&miss);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -1452,11 +1452,11 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
IC_Utility(kKeyedLoadPropertyWithInterceptor), masm->isolate()), 2, 1);
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// ---------- S t a t e --------------
// -- a0 : value
// -- a1 : key
......@@ -1467,7 +1467,7 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
// Push receiver, key and value for runtime call.
__ Push(a2, a1, a0);
ExternalReference ref = force_generic
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric),
masm->isolate())
: ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate());
......
......@@ -576,7 +576,7 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
char_at_generator.GenerateSlow(masm, call_helper);
__ bind(&miss);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -619,7 +619,7 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
1);
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -1278,7 +1278,7 @@ void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
__ movq(rax, unmapped_location);
__ Ret();
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -1317,7 +1317,7 @@ void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
INLINE_SMI_CHECK);
__ Ret();
__ bind(&slow);
GenerateMiss(masm, false);
GenerateMiss(masm, MISS);
}
......@@ -1411,7 +1411,7 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
}
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// ----------- S t a t e -------------
// -- rax : key
// -- rdx : receiver
......@@ -1427,7 +1427,7 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
__ push(rbx); // return address
// Perform tail call to the entry.
ExternalReference ref = force_generic
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric),
masm->isolate())
: ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate());
......@@ -1638,7 +1638,7 @@ void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// ----------- S t a t e -------------
// -- rax : value
// -- rcx : key
......@@ -1653,7 +1653,7 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
__ push(rbx); // return address
// Do tail-call to runtime routine.
ExternalReference ref = force_generic
ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric),
masm->isolate())
: ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate());
......
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