MIPS: port Handlify simple functions of [keyed] load stub compiler.
Port r9773 (4cf7a453) BUG= TEST= Review URL: http://codereview.chromium.org/8390035 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9785 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
55b7bfa2da
commit
d46c0d899f
@ -525,15 +525,10 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm,
|
||||
|
||||
void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) {
|
||||
ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC);
|
||||
Code* code = NULL;
|
||||
if (kind == Code::LOAD_IC) {
|
||||
code = masm->isolate()->builtins()->builtin(Builtins::kLoadIC_Miss);
|
||||
} else {
|
||||
code = masm->isolate()->builtins()->builtin(Builtins::kKeyedLoadIC_Miss);
|
||||
}
|
||||
|
||||
Handle<Code> ic(code);
|
||||
__ Jump(ic, RelocInfo::CODE_TARGET);
|
||||
Handle<Code> code = (kind == Code::LOAD_IC)
|
||||
? masm->isolate()->builtins()->LoadIC_Miss()
|
||||
: masm->isolate()->builtins()->KeyedLoadIC_Miss();
|
||||
__ Jump(code, RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
|
||||
@ -1385,36 +1380,35 @@ Register StubCompiler::CheckPrototypes(JSObject* object,
|
||||
}
|
||||
|
||||
|
||||
void StubCompiler::GenerateLoadField(JSObject* object,
|
||||
JSObject* holder,
|
||||
void StubCompiler::GenerateLoadField(Handle<JSObject> object,
|
||||
Handle<JSObject> holder,
|
||||
Register receiver,
|
||||
Register scratch1,
|
||||
Register scratch2,
|
||||
Register scratch3,
|
||||
int index,
|
||||
String* name,
|
||||
Handle<String> name,
|
||||
Label* miss) {
|
||||
// Check that the receiver isn't a smi.
|
||||
__ And(scratch1, receiver, Operand(kSmiTagMask));
|
||||
__ Branch(miss, eq, scratch1, Operand(zero_reg));
|
||||
|
||||
// Check that the maps haven't changed.
|
||||
Register reg =
|
||||
CheckPrototypes(object, receiver, holder, scratch1, scratch2, scratch3,
|
||||
name, miss);
|
||||
GenerateFastPropertyLoad(masm(), v0, reg, Handle<JSObject>(holder), index);
|
||||
Register reg = CheckPrototypes(
|
||||
object, receiver, holder, scratch1, scratch2, scratch3, name, miss);
|
||||
GenerateFastPropertyLoad(masm(), v0, reg, holder, index);
|
||||
__ Ret();
|
||||
}
|
||||
|
||||
|
||||
void StubCompiler::GenerateLoadConstant(JSObject* object,
|
||||
JSObject* holder,
|
||||
void StubCompiler::GenerateLoadConstant(Handle<JSObject> object,
|
||||
Handle<JSObject> holder,
|
||||
Register receiver,
|
||||
Register scratch1,
|
||||
Register scratch2,
|
||||
Register scratch3,
|
||||
Object* value,
|
||||
String* name,
|
||||
Handle<Object> value,
|
||||
Handle<String> name,
|
||||
Label* miss) {
|
||||
// Check that the receiver isn't a smi.
|
||||
__ JumpIfSmi(receiver, miss, scratch1);
|
||||
@ -1425,7 +1419,7 @@ void StubCompiler::GenerateLoadConstant(JSObject* object,
|
||||
scratch1, scratch2, scratch3, name, miss);
|
||||
|
||||
// Return the constant value.
|
||||
__ li(v0, Operand(Handle<Object>(value)));
|
||||
__ li(v0, Operand(value));
|
||||
__ Ret();
|
||||
}
|
||||
|
||||
@ -3005,9 +2999,9 @@ MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name,
|
||||
JSObject* object,
|
||||
JSObject* last) {
|
||||
Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<String> name,
|
||||
Handle<JSObject> object,
|
||||
Handle<JSObject> last) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- a0 : receiver
|
||||
// -- ra : return address
|
||||
@ -3023,15 +3017,8 @@ MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name,
|
||||
// If the last object in the prototype chain is a global object,
|
||||
// check that the global property cell is empty.
|
||||
if (last->IsGlobalObject()) {
|
||||
MaybeObject* cell = TryGenerateCheckPropertyCell(masm(),
|
||||
GlobalObject::cast(last),
|
||||
name,
|
||||
a1,
|
||||
&miss);
|
||||
if (cell->IsFailure()) {
|
||||
miss.Unuse();
|
||||
return cell;
|
||||
}
|
||||
GenerateCheckPropertyCell(
|
||||
masm(), Handle<GlobalObject>::cast(last), name, a1, &miss);
|
||||
}
|
||||
|
||||
// Return undefined if maps of the full prototype chain is still the same.
|
||||
@ -3042,14 +3029,14 @@ MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name,
|
||||
GenerateLoadMiss(masm(), Code::LOAD_IC);
|
||||
|
||||
// Return the generated code.
|
||||
return GetCode(NONEXISTENT, heap()->empty_string());
|
||||
return GetCode(NONEXISTENT, factory()->empty_string());
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* LoadStubCompiler::CompileLoadField(JSObject* object,
|
||||
JSObject* holder,
|
||||
Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object,
|
||||
Handle<JSObject> holder,
|
||||
int index,
|
||||
String* name) {
|
||||
Handle<String> name) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- a0 : receiver
|
||||
// -- a2 : name
|
||||
@ -3090,14 +3077,14 @@ MaybeObject* LoadStubCompiler::CompileLoadCallback(String* name,
|
||||
GenerateLoadMiss(masm(), Code::LOAD_IC);
|
||||
|
||||
// Return the generated code.
|
||||
return GetCode(CALLBACKS, name);
|
||||
return TryGetCode(CALLBACKS, name);
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object,
|
||||
JSObject* holder,
|
||||
Object* value,
|
||||
String* name) {
|
||||
Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object,
|
||||
Handle<JSObject> holder,
|
||||
Handle<Object> value,
|
||||
Handle<String> name) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- a0 : receiver
|
||||
// -- a2 : name
|
||||
@ -3141,7 +3128,7 @@ MaybeObject* LoadStubCompiler::CompileLoadInterceptor(JSObject* object,
|
||||
GenerateLoadMiss(masm(), Code::LOAD_IC);
|
||||
|
||||
// Return the generated code.
|
||||
return GetCode(INTERCEPTOR, name);
|
||||
return TryGetCode(INTERCEPTOR, name);
|
||||
}
|
||||
|
||||
|
||||
@ -3188,13 +3175,13 @@ MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
|
||||
GenerateLoadMiss(masm(), Code::LOAD_IC);
|
||||
|
||||
// Return the generated code.
|
||||
return GetCode(NORMAL, name);
|
||||
return TryGetCode(NORMAL, name);
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name,
|
||||
JSObject* receiver,
|
||||
JSObject* holder,
|
||||
Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name,
|
||||
Handle<JSObject> receiver,
|
||||
Handle<JSObject> holder,
|
||||
int index) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- ra : return address
|
||||
@ -3204,7 +3191,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name,
|
||||
Label miss;
|
||||
|
||||
// Check the key is the cached one.
|
||||
__ Branch(&miss, ne, a0, Operand(Handle<String>(name)));
|
||||
__ Branch(&miss, ne, a0, Operand(name));
|
||||
|
||||
GenerateLoadField(receiver, holder, a1, a2, a3, t0, index, name, &miss);
|
||||
__ bind(&miss);
|
||||
@ -3239,14 +3226,15 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback(
|
||||
__ bind(&miss);
|
||||
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
|
||||
|
||||
return GetCode(CALLBACKS, name);
|
||||
return TryGetCode(CALLBACKS, name);
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
|
||||
JSObject* receiver,
|
||||
JSObject* holder,
|
||||
Object* value) {
|
||||
Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant(
|
||||
Handle<String> name,
|
||||
Handle<JSObject> receiver,
|
||||
Handle<JSObject> holder,
|
||||
Handle<Object> value) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- ra : return address
|
||||
// -- a0 : key
|
||||
@ -3255,7 +3243,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
|
||||
Label miss;
|
||||
|
||||
// Check the key is the cached one.
|
||||
__ Branch(&miss, ne, a0, Operand(Handle<String>(name)));
|
||||
__ Branch(&miss, ne, a0, Operand(name));
|
||||
|
||||
GenerateLoadConstant(receiver, holder, a1, a2, a3, t0, value, name, &miss);
|
||||
__ bind(&miss);
|
||||
@ -3294,11 +3282,12 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
|
||||
__ bind(&miss);
|
||||
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
|
||||
|
||||
return GetCode(INTERCEPTOR, name);
|
||||
return TryGetCode(INTERCEPTOR, name);
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
|
||||
Handle<Code> KeyedLoadStubCompiler::CompileLoadArrayLength(
|
||||
Handle<String> name) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- ra : return address
|
||||
// -- a0 : key
|
||||
@ -3307,7 +3296,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
|
||||
Label miss;
|
||||
|
||||
// Check the key is the cached one.
|
||||
__ Branch(&miss, ne, a0, Operand(Handle<String>(name)));
|
||||
__ Branch(&miss, ne, a0, Operand(name));
|
||||
|
||||
GenerateLoadArrayLength(masm(), a1, a2, &miss);
|
||||
__ bind(&miss);
|
||||
@ -3317,7 +3306,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
|
||||
Handle<Code> KeyedLoadStubCompiler::CompileLoadStringLength(
|
||||
Handle<String> name) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- ra : return address
|
||||
// -- a0 : key
|
||||
@ -3329,7 +3319,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
|
||||
__ IncrementCounter(counters->keyed_load_string_length(), 1, a2, a3);
|
||||
|
||||
// Check the key is the cached one.
|
||||
__ Branch(&miss, ne, a0, Operand(Handle<String>(name)));
|
||||
__ Branch(&miss, ne, a0, Operand(name));
|
||||
|
||||
GenerateLoadStringLength(masm(), a1, a2, a3, &miss, true);
|
||||
__ bind(&miss);
|
||||
@ -3341,7 +3331,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
|
||||
Handle<Code> KeyedLoadStubCompiler::CompileLoadFunctionPrototype(
|
||||
Handle<String> name) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- ra : return address
|
||||
// -- a0 : key
|
||||
@ -3353,7 +3344,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
|
||||
__ IncrementCounter(counters->keyed_load_function_prototype(), 1, a2, a3);
|
||||
|
||||
// Check the name hasn't changed.
|
||||
__ Branch(&miss, ne, a0, Operand(Handle<String>(name)));
|
||||
__ Branch(&miss, ne, a0, Operand(name));
|
||||
|
||||
GenerateLoadFunctionPrototype(masm(), a1, a2, a3, &miss);
|
||||
__ bind(&miss);
|
||||
@ -3384,7 +3375,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) {
|
||||
__ Jump(ic, RelocInfo::CODE_TARGET);
|
||||
|
||||
// Return the generated code.
|
||||
return GetCode(NORMAL, NULL);
|
||||
return TryGetCode(NORMAL, NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -3412,7 +3403,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadPolymorphic(
|
||||
__ Jump(miss_ic, RelocInfo::CODE_TARGET);
|
||||
|
||||
// Return the generated code.
|
||||
return GetCode(NORMAL, NULL, MEGAMORPHIC);
|
||||
return TryGetCode(NORMAL, NULL, MEGAMORPHIC);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user