Author: [email protected]
Date: Wed Jul 15 05:30:28 2009
New Revision: 2477
Modified:
branches/bleeding_edge/src/bootstrapper.cc
branches/bleeding_edge/src/ia32/ic-ia32.cc
branches/bleeding_edge/src/ic.cc
branches/bleeding_edge/src/ic.h
branches/bleeding_edge/src/x64/assembler-x64.cc
branches/bleeding_edge/src/x64/debug-x64.cc
branches/bleeding_edge/src/x64/ic-x64.cc
Log:
Disable inline caching on X64 separately for loads, stores, and calls,
while they are being implemented and tested one-by-one.
Review URL: http://codereview.chromium.org/149673
Modified: branches/bleeding_edge/src/bootstrapper.cc
==============================================================================
--- branches/bleeding_edge/src/bootstrapper.cc (original)
+++ branches/bleeding_edge/src/bootstrapper.cc Wed Jul 15 05:30:28 2009
@@ -1107,12 +1107,6 @@
global_context()->set_empty_script(*script);
}
-#ifdef V8_HOST_ARCH_64_BIT
- // TODO(X64): Remove this when inline caches work.
- FLAG_use_ic = false;
-#endif // V8_HOST_ARCH_64_BIT
-
-
if (FLAG_natives_file == NULL) {
// Without natives file, install default natives.
for (int i = Natives::GetDelayCount();
Modified: branches/bleeding_edge/src/ia32/ic-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/ia32/ic-ia32.cc (original)
+++ branches/bleeding_edge/src/ia32/ic-ia32.cc Wed Jul 15 05:30:28 2009
@@ -153,6 +153,9 @@
}
+// The offset from the inlined patch site to the start of the
+// inlined load instruction. It is 7 bytes (test eax, imm) plus
+// 6 bytes (jne slow_label).
const int LoadIC::kOffsetToLoadInstruction = 13;
Modified: branches/bleeding_edge/src/ic.cc
==============================================================================
--- branches/bleeding_edge/src/ic.cc (original)
+++ branches/bleeding_edge/src/ic.cc Wed Jul 15 05:30:28 2009
@@ -365,10 +365,13 @@
return TypeError("undefined_method", object, name);
}
+ // TODO(X64): Enable inline cache for calls.
+#ifndef V8_TARGET_ARCH_X64
// Lookup is valid: Update inline cache and stub cache.
if (FLAG_use_ic && lookup.IsLoaded()) {
UpdateCaches(&lookup, state, object, name);
}
+#endif
// Get the property.
PropertyAttributes attr;
@@ -609,10 +612,13 @@
}
}
+ // 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) {
@@ -737,7 +743,9 @@
return TypeError("non_object_property_load", object, name);
}
- if (FLAG_use_ic) {
+ // TODO(X64): Enable specialized stubs for length and prototype lookup.
+#ifndef V8_TARGET_ARCH_X64
+ if (false && 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);
@@ -747,7 +755,7 @@
set_target(Code::cast(code));
#ifdef DEBUG
TraceIC("KeyedLoadIC", name, state, target());
-#endif
+#endif // DEBUG
return Smi::FromInt(string->length());
}
@@ -759,7 +767,7 @@
set_target(Code::cast(code));
#ifdef DEBUG
TraceIC("KeyedLoadIC", name, state, target());
-#endif
+#endif // DEBUG
return JSArray::cast(*object)->length();
}
@@ -772,10 +780,11 @@
set_target(Code::cast(code));
#ifdef DEBUG
TraceIC("KeyedLoadIC", name, state, target());
-#endif
+#endif // DEBUG
return Accessors::FunctionGetPrototype(*object, 0);
}
}
+#endif // !V8_TARGET_ARCH_X64
// Check if the name is trivially convertible to an index and get
// the element or char if so.
@@ -798,10 +807,13 @@
}
}
+ // 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) {
@@ -972,6 +984,10 @@
return *value;
}
+ // TODO(X64): Enable inline cache for StoreIC.
+#ifdef V8_TARGET_ARCH_X64
+ USE(&LookupForWrite); // The compiler complains otherwise.
+#else
// Lookup the property locally in the receiver.
if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) {
LookupResult lookup;
@@ -979,6 +995,7 @@
UpdateCaches(&lookup, state, receiver, name, value);
}
}
+#endif
// Set the property.
return receiver->SetProperty(*name, *value, NONE);
@@ -1097,10 +1114,13 @@
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);
Modified: branches/bleeding_edge/src/ic.h
==============================================================================
--- branches/bleeding_edge/src/ic.h (original)
+++ branches/bleeding_edge/src/ic.h Wed Jul 15 05:30:28 2009
@@ -49,7 +49,8 @@
ICU(StoreInterceptorProperty)
//
-// IC is the base class for LoadIC, StoreIC and CallIC.
+// IC is the base class for LoadIC, StoreIC, CallIC, KeyedLoadIC,
+// and KeyedStoreIC.
//
class IC {
public:
@@ -219,8 +220,8 @@
static void GenerateFunctionPrototype(MacroAssembler* masm);
// The offset from the inlined patch site to the start of the
- // inlined load instruction. It is 7 bytes (test eax, imm) plus
- // 6 bytes (jne slow_label).
+ // inlined load instruction. It is architecture-dependent, and not
+ // used on ARM.
static const int kOffsetToLoadInstruction;
private:
Modified: branches/bleeding_edge/src/x64/assembler-x64.cc
==============================================================================
--- branches/bleeding_edge/src/x64/assembler-x64.cc (original)
+++ branches/bleeding_edge/src/x64/assembler-x64.cc Wed Jul 15 05:30:28 2009
@@ -2183,48 +2183,3 @@
} } // namespace v8::internal
-
-
-// TODO(x64): Implement and move these to their correct cc-files:
-#include "ast.h"
-#include "bootstrapper.h"
-#include "codegen-inl.h"
-#include "cpu.h"
-#include "debug.h"
-#include "disasm.h"
-#include "disassembler.h"
-#include "frames-inl.h"
-#include "x64/macro-assembler-x64.h"
-#include "x64/regexp-macro-assembler-x64.h"
-#include "ic-inl.h"
-#include "log.h"
-#include "macro-assembler.h"
-#include "parser.h"
-#include "regexp-macro-assembler.h"
-#include "regexp-stack.h"
-#include "register-allocator-inl.h"
-#include "register-allocator.h"
-#include "runtime.h"
-#include "scopes.h"
-#include "serialize.h"
-#include "stub-cache.h"
-#include "unicode.h"
-
-namespace v8 {
-namespace internal {
-
-
-void BreakLocationIterator::ClearDebugBreakAtReturn() {
- UNIMPLEMENTED();
-}
-
-bool BreakLocationIterator::IsDebugBreakAtReturn() {
- UNIMPLEMENTED();
- return false;
-}
-
-void BreakLocationIterator::SetDebugBreakAtReturn() {
- UNIMPLEMENTED();
-}
-
-} } // namespace v8::internal
Modified: branches/bleeding_edge/src/x64/debug-x64.cc
==============================================================================
--- branches/bleeding_edge/src/x64/debug-x64.cc (original)
+++ branches/bleeding_edge/src/x64/debug-x64.cc Wed Jul 15 05:30:28 2009
@@ -80,6 +80,21 @@
masm->int3(); // UNIMPLEMENTED
}
+void BreakLocationIterator::ClearDebugBreakAtReturn() {
+ // TODO(X64): Implement this when we start setting Debug breaks.
+ UNIMPLEMENTED();
+}
+
+bool BreakLocationIterator::IsDebugBreakAtReturn() {
+ // TODO(X64): Implement this when we start setting Debug breaks.
+ UNIMPLEMENTED();
+ return false;
+}
+
+void BreakLocationIterator::SetDebugBreakAtReturn() {
+ UNIMPLEMENTED();
+}
+
#endif // ENABLE_DEBUGGER_SUPPORT
} } // namespace v8::internal
Modified: branches/bleeding_edge/src/x64/ic-x64.cc
==============================================================================
--- branches/bleeding_edge/src/x64/ic-x64.cc (original)
+++ branches/bleeding_edge/src/x64/ic-x64.cc Wed Jul 15 05:30:28 2009
@@ -43,11 +43,11 @@
void KeyedLoadIC::ClearInlinedVersion(Address address) {
- UNIMPLEMENTED();
+ // TODO(X64): Implement this when LoadIC is enabled.
}
void KeyedStoreIC::ClearInlinedVersion(Address address) {
- UNIMPLEMENTED();
+ // TODO(X64): Implement this when LoadIC is enabled.
}
void KeyedStoreIC::RestoreInlinedVersion(Address address) {
@@ -78,22 +78,32 @@
void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xC0AB)); // Debugging aid.
+ // ----------- S t a t e -------------
+ // -- rsp[0] : return address
+ // -- rsp[8] : name
+ // -- rsp[16] : receiver
+ // -----------------------------------
+
+ Generate(masm, ExternalReference(Runtime::kKeyedGetProperty));
}
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xC1AB)); // Debugging aid.
+ // ----------- S t a t e -------------
+ // -- rsp[0] : return address
+ // -- rsp[8] : name
+ // -- rsp[16] : receiver
+ // -----------------------------------
+
+ Generate(masm, ExternalReference(Runtime::kKeyedGetProperty));
}
bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) {
- UNIMPLEMENTED();
+ // Never patch the map in the map check, so the check always fails.
return false;
}
bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) {
- UNIMPLEMENTED();
+ // Never patch the map in the map check, so the check always fails.
return false;
}
@@ -163,13 +173,11 @@
}
void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xC2AB)); // Debugging aid.
+ Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss)));
}
void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xC3AB)); // Debugging aid.
+ Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss)));
}
Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
@@ -228,20 +236,24 @@
__ InvokeFunction(rdi, actual, JUMP_FUNCTION);
}
-void CallIC::GenerateMegamorphic(MacroAssembler* a, int b) {
- UNIMPLEMENTED();
+void CallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
+ // Cache miss: Jump to runtime.
+ Generate(masm, argc, ExternalReference(IC_Utility(kCallIC_Miss)));
}
-void CallIC::GenerateNormal(MacroAssembler* a, int b) {
- UNIMPLEMENTED();
+void CallIC::GenerateNormal(MacroAssembler* masm, int argc) {
+ // Cache miss: Jump to runtime.
+ Generate(masm, argc, ExternalReference(IC_Utility(kCallIC_Miss)));
}
+// The offset from the inlined patch site to the start of the
+// inlined load instruction.
const int LoadIC::kOffsetToLoadInstruction = 20;
void LoadIC::ClearInlinedVersion(Address address) {
- UNIMPLEMENTED();
+ // TODO(X64): Implement this when LoadIC is enabled.
}
@@ -266,33 +278,27 @@
void LoadIC::GenerateArrayLength(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xC4AB)); // Debugging aid.
+ Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
}
void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xC5AB)); // Debugging aid.
+ Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
}
void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xC6AB)); // Debugging aid.
+ Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
}
void LoadIC::GenerateMiss(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xC7AB)); // Debugging aid.
+ Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
}
void LoadIC::GenerateNormal(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xC8AB)); // Debugging aid.
+ Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
}
void LoadIC::GenerateStringLength(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xC9AB)); // Debugging aid.
+ Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
}
bool LoadIC::PatchInlinedLoad(Address address, Object* map, int index) {
@@ -319,13 +325,11 @@
}
void StoreIC::GenerateExtendStorage(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xCAAB)); // Debugging aid.
+ Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss)));
}
void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
- masm->int3(); // UNIMPLEMENTED.
- masm->movq(kScratchRegister, Immediate(0xCBAB)); // Debugging aid.
+ Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss)));
}
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---