Revision: 2560
Author: [email protected]
Date: Tue Jul 28 06:44:17 2009
Log: More X64 inline cache implementation.
Review URL: http://codereview.chromium.org/160268
http://code.google.com/p/v8/source/detail?r=2560
Modified:
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/src/x64/ic-x64.cc
/branches/bleeding_edge/src/x64/stub-cache-x64.cc
=======================================
--- /branches/bleeding_edge/src/ic.cc Mon Jul 27 03:39:21 2009
+++ /branches/bleeding_edge/src/ic.cc Tue Jul 28 06:44:17 2009
@@ -739,7 +739,7 @@
// 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 @@
}
}
- // 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 @@
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);
=======================================
--- /branches/bleeding_edge/src/x64/ic-x64.cc Tue Jul 28 05:46:08 2009
+++ /branches/bleeding_edge/src/x64/ic-x64.cc Tue Jul 28 06:44:17 2009
@@ -306,8 +306,7 @@
// -- rsp[8] : name
// -- rsp[16] : receiver
// -----------------------------------
-
- Generate(masm, ExternalReference(Runtime::kKeyedGetProperty));
+ Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss)));
}
@@ -340,10 +339,26 @@
// Do tail-call to runtime routine.
__ 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);
}
@@ -458,15 +473,6 @@
__ RecordWrite(rcx, 0, rdx, rbx);
__ ret(0);
}
-
-
-Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
- int index,
- Map* transition,
- String* name) {
- UNIMPLEMENTED();
- return NULL;
-}
void CallIC::Generate(MacroAssembler* masm,
=======================================
--- /branches/bleeding_edge/src/x64/stub-cache-x64.cc Tue Jul 28 05:46:08
2009
+++ /branches/bleeding_edge/src/x64/stub-cache-x64.cc Tue Jul 28 06:44:17
2009
@@ -415,51 +415,6 @@
}
-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) {
@@ -573,6 +528,89 @@
// Return the generated code.
return GetCode(FIELD, 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
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---