X64: Enable more of LoadIC, disable individual stub types.
authorwhesse@chromium.org <whesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 20 Jul 2009 14:33:59 +0000 (14:33 +0000)
committerwhesse@chromium.org <whesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 20 Jul 2009 14:33:59 +0000 (14:33 +0000)
Review URL: http://codereview.chromium.org/155763

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2512 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/ic.cc
src/x64/ic-x64.cc
src/x64/stub-cache-x64.cc

index 63dc212..090d7a3 100644 (file)
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -609,13 +609,10 @@ Object* LoadIC::Load(State state, Handle<Object> object, Handle<String> name) {
     }
   }
 
-  // TODO(X64): Enable inline cache for load.
-  #ifndef V8_TARGET_ARCH_X64
   // Update inline cache and stub cache.
   if (FLAG_use_ic && lookup.IsLoaded()) {
     UpdateCaches(&lookup, state, object, name);
   }
-  #endif
 
   PropertyAttributes attr;
   if (lookup.IsValid() && lookup.type() == INTERCEPTOR) {
index 04dc54b..db74baf 100644 (file)
@@ -285,11 +285,34 @@ void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) {
   Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
 }
 
+
 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
+  // ----------- S t a t e -------------
+  //  -- rcx    : name
+  //  -- rsp[0] : return address
+  //  -- rsp[8] : receiver
+  // -----------------------------------
+
+  __ movq(rax, Operand(rsp, kPointerSize));
+
+  // Probe the stub cache.
+  Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC,
+                                         NOT_IN_LOOP,
+                                         MONOMORPHIC);
+  StubCache::GenerateProbe(masm, flags, rax, rcx, rbx, rdx);
+
+  // Cache miss: Jump to runtime.
   Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
 }
 
+
 void LoadIC::GenerateMiss(MacroAssembler* masm) {
+  // ----------- S t a t e -------------
+  //  -- rcx    : name
+  //  -- rsp[0] : return address
+  //  -- rsp[8] : receiver
+  // -----------------------------------
+
   Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
 }
 
@@ -302,7 +325,7 @@ void LoadIC::GenerateStringLength(MacroAssembler* masm) {
 }
 
 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int index) {
-  UNIMPLEMENTED();
+  // TODO(X64): Implement this function.  Until then, the code is not patched.
   return false;
 }
 
index 3edd629..e956265 100644 (file)
@@ -311,8 +311,8 @@ Object* LoadStubCompiler::CompileLoadCallback(JSObject* a,
                                               JSObject* b,
                                               AccessorInfo* c,
                                               String* d) {
-  UNIMPLEMENTED();
-  return NULL;
+  // TODO(X64): Implement a real stub.
+  return Failure::InternalError();
 }
 
 
@@ -320,8 +320,8 @@ Object* LoadStubCompiler::CompileLoadConstant(JSObject* a,
                                               JSObject* b,
                                               Object* c,
                                               String* d) {
-  UNIMPLEMENTED();
-  return NULL;
+  // TODO(X64): Implement a real stub.
+  return Failure::InternalError();
 }
 
 
@@ -329,16 +329,16 @@ Object* LoadStubCompiler::CompileLoadField(JSObject* a,
                                            JSObject* b,
                                            int c,
                                            String* d) {
-  UNIMPLEMENTED();
-  return NULL;
+  // TODO(X64): Implement a real stub.
+  return Failure::InternalError();
 }
 
 
 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* a,
                                                  JSObject* b,
                                                  String* c) {
-  UNIMPLEMENTED();
-  return NULL;
+  // TODO(X64): Implement a real stub.
+  return Failure::InternalError();
 }
 
 
@@ -347,8 +347,8 @@ Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
                                             JSGlobalPropertyCell* cell,
                                             String* name,
                                             bool is_dont_delete) {
-  UNIMPLEMENTED();
-  return NULL;
+  // TODO(X64): Implement a real stub.
+  return Failure::InternalError();
 }
 
 
@@ -488,6 +488,22 @@ void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm,
   }
 }
 
+
+void StubCache::GenerateProbe(MacroAssembler* masm,
+                              Code::Flags flags,
+                              Register receiver,
+                              Register name,
+                              Register scratch,
+                              Register extra) {
+  Label miss;
+  // TODO(X64): Probe the primary and secondary StubCache tables.
+
+  // Cache miss: Fall-through and let caller handle the miss by
+  // entering the runtime system.
+  __ bind(&miss);
+}
+
+
 #undef __