More X64 inline cache implementation.
Review URL: http://codereview.chromium.org/160268 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2560 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
281fbcc917
commit
b357dc043e
@ -739,7 +739,7 @@ Object* KeyedLoadIC::Load(State state,
|
||||
|
||||
// TODO(X64): Enable specialized stubs for length and prototype lookup.
|
||||
#ifndef V8_TARGET_ARCH_X64
|
||||
if (false && FLAG_use_ic) {
|
||||
if (FLAG_use_ic) {
|
||||
// Use specialized code for getting the length of strings.
|
||||
if (object->IsString() && name->Equals(Heap::length_symbol())) {
|
||||
Handle<String> string = Handle<String>::cast(object);
|
||||
@ -801,13 +801,9 @@ Object* KeyedLoadIC::Load(State state,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(X64): Enable inline caching for load.
|
||||
#ifndef V8_TARGET_ARCH_X64
|
||||
// Update the inline cache.
|
||||
if (FLAG_use_ic && lookup.IsLoaded()) {
|
||||
UpdateCaches(&lookup, state, object, name);
|
||||
}
|
||||
#endif
|
||||
|
||||
PropertyAttributes attr;
|
||||
if (lookup.IsValid() && lookup.type() == INTERCEPTOR) {
|
||||
@ -1103,13 +1099,10 @@ Object* KeyedStoreIC::Store(State state,
|
||||
LookupResult lookup;
|
||||
receiver->LocalLookup(*name, &lookup);
|
||||
|
||||
// TODO(X64): Enable inline cache for KeyedStoreIC.
|
||||
#ifndef V8_TARGET_ARCH_X64
|
||||
// Update inline cache and stub cache.
|
||||
if (FLAG_use_ic && lookup.IsLoaded()) {
|
||||
UpdateCaches(&lookup, state, receiver, name, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set the property.
|
||||
return receiver->SetProperty(*name, *value, NONE);
|
||||
|
@ -306,8 +306,7 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
|
||||
// -- rsp[8] : name
|
||||
// -- rsp[16] : receiver
|
||||
// -----------------------------------
|
||||
|
||||
Generate(masm, ExternalReference(Runtime::kKeyedGetProperty));
|
||||
Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss)));
|
||||
}
|
||||
|
||||
|
||||
@ -341,9 +340,25 @@ void KeyedStoreIC::Generate(MacroAssembler* masm, ExternalReference const& f) {
|
||||
__ TailCallRuntime(f, 3);
|
||||
}
|
||||
|
||||
|
||||
void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) {
|
||||
__ int3();
|
||||
__ movq(rax, Immediate(0xdead1234));
|
||||
// ----------- S t a t e -------------
|
||||
// -- rax : value
|
||||
// -- rcx : transition map
|
||||
// -- rsp[0] : return address
|
||||
// -- rsp[8] : key
|
||||
// -- rsp[16] : receiver
|
||||
// -----------------------------------
|
||||
|
||||
__ pop(rbx);
|
||||
__ push(Operand(rsp, 1 * kPointerSize)); // receiver
|
||||
__ push(rcx); // transition map
|
||||
__ push(rax); // value
|
||||
__ push(rbx); // return address
|
||||
|
||||
// Do tail-call to runtime routine.
|
||||
__ TailCallRuntime(
|
||||
ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3);
|
||||
}
|
||||
|
||||
|
||||
@ -460,15 +475,6 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
|
||||
int index,
|
||||
Map* transition,
|
||||
String* name) {
|
||||
UNIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void CallIC::Generate(MacroAssembler* masm,
|
||||
int argc,
|
||||
ExternalReference const& f) {
|
||||
|
@ -415,51 +415,6 @@ Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
|
||||
}
|
||||
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
|
||||
UNIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name,
|
||||
JSObject* object,
|
||||
JSObject* holder,
|
||||
AccessorInfo* callback) {
|
||||
UNIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
|
||||
JSObject* object,
|
||||
JSObject* holder,
|
||||
Object* callback) {
|
||||
UNIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
|
||||
UNIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* object,
|
||||
JSObject* holder,
|
||||
String* name) {
|
||||
UNIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
|
||||
UNIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Object* StoreStubCompiler::CompileStoreCallback(JSObject* a,
|
||||
AccessorInfo* b,
|
||||
String* c) {
|
||||
@ -575,6 +530,89 @@ Object* KeyedLoadStubCompiler::CompileLoadField(String* name,
|
||||
}
|
||||
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
|
||||
// TODO(X64): Implement a real stub.
|
||||
return Failure::InternalError();
|
||||
}
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name,
|
||||
JSObject* object,
|
||||
JSObject* holder,
|
||||
AccessorInfo* callback) {
|
||||
// TODO(X64): Implement a real stub.
|
||||
return Failure::InternalError();
|
||||
}
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
|
||||
JSObject* object,
|
||||
JSObject* holder,
|
||||
Object* callback) {
|
||||
// TODO(X64): Implement a real stub.
|
||||
return Failure::InternalError();
|
||||
}
|
||||
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
|
||||
// TODO(X64): Implement a real stub.
|
||||
return Failure::InternalError();
|
||||
}
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* object,
|
||||
JSObject* holder,
|
||||
String* name) {
|
||||
// TODO(X64): Implement a real stub.
|
||||
return Failure::InternalError();
|
||||
}
|
||||
|
||||
Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
|
||||
// TODO(X64): Implement a real stub.
|
||||
return Failure::InternalError();
|
||||
}
|
||||
|
||||
|
||||
Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
|
||||
int index,
|
||||
Map* transition,
|
||||
String* name) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- rax : value
|
||||
// -- rsp[0] : return address
|
||||
// -- rsp[8] : key
|
||||
// -- rsp[16] : receiver
|
||||
// -----------------------------------
|
||||
Label miss;
|
||||
|
||||
__ IncrementCounter(&Counters::keyed_store_field, 1);
|
||||
|
||||
// Get the name from the stack.
|
||||
__ movq(rcx, Operand(rsp, 1 * kPointerSize));
|
||||
// Check that the name has not changed.
|
||||
__ Cmp(rcx, Handle<String>(name));
|
||||
__ j(not_equal, &miss);
|
||||
|
||||
// Get the object from the stack.
|
||||
__ movq(rbx, Operand(rsp, 2 * kPointerSize));
|
||||
|
||||
// Generate store field code. Trashes the name register.
|
||||
GenerateStoreField(masm(),
|
||||
Builtins::KeyedStoreIC_ExtendStorage,
|
||||
object,
|
||||
index,
|
||||
transition,
|
||||
rbx, rcx, rdx,
|
||||
&miss);
|
||||
|
||||
// Handle store cache miss.
|
||||
__ bind(&miss);
|
||||
__ DecrementCounter(&Counters::keyed_store_field, 1);
|
||||
Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss));
|
||||
__ Jump(ic, RelocInfo::CODE_TARGET);
|
||||
|
||||
// Return the generated code.
|
||||
return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
|
||||
}
|
||||
|
||||
|
||||
// TODO(1241006): Avoid having lazy compile stubs specialized by the
|
||||
// number of arguments. It is not needed anymore.
|
||||
Object* StubCompiler::CompileLazyCompile(Code::Flags flags) {
|
||||
|
Loading…
Reference in New Issue
Block a user