Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: src/ic.cc

Issue 10515008: Added LoadIC stub for getters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed presubmit failure. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index 134ef8b843fbff585aa05ada077b5a919eca7a06..94e99e2445169c36ebf8607cd37505fcd942da67 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -36,6 +36,10 @@
#include "runtime.h"
#include "stub-cache.h"
+#if DEBUG
+#define DEBUG_LOADIC 0
+#endif
+
namespace v8 {
namespace internal {
@@ -900,6 +904,13 @@ MaybeObject* LoadIC::Load(State state,
// Named lookup in the object.
LookupResult lookup(isolate());
LookupForRead(object, name, &lookup);
+#if DEBUG_LOADIC
+ PrintF("==============================2 LoadIC::Load ");
+ name->Print();
+ PrintF(", ");
+ lookup.Print(stdout);
+ PrintF("\n");
+#endif
// If we did not find a property, check if we need to throw an exception.
if (!lookup.IsProperty()) {
@@ -938,6 +949,11 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
State state,
Handle<Object> object,
Handle<String> name) {
+#if DEBUG_LOADIC
+ PrintF("==============================3 LoadIC::UpdateCaches ");
+ name->Print();
+ PrintF(", state=%s\n", Code::ICState2String(state));
+#endif
// Bail out if the result is not cacheable.
if (!lookup->IsCacheable()) return;
@@ -988,13 +1004,40 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
}
break;
case CALLBACKS: {
- Handle<Object> callback_object(lookup->GetCallbackObject());
- if (!callback_object->IsAccessorInfo()) return;
- Handle<AccessorInfo> callback =
- Handle<AccessorInfo>::cast(callback_object);
- if (v8::ToCData<Address>(callback->getter()) == 0) return;
- code = isolate()->stub_cache()->ComputeLoadCallback(
- name, receiver, holder, callback);
+#if DEBUG_LOADIC
+ PrintF("==============================4 LoadIC::UpdateCaches ");
+ name->Print();
+ PrintF(", CALLBACKS case, target=");
+ target()->Print();
+ PrintF("\n");
+#endif
+ Handle<Object> callback(lookup->GetCallbackObject());
+ if (callback->IsAccessorInfo()) {
+ Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(callback);
+ if (v8::ToCData<Address>(info->getter()) == 0) return;
+ code = isolate()->stub_cache()->ComputeLoadCallback(
+ name, receiver, holder, info);
+ } else if (callback->IsAccessorPair()) {
+ Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter());
+ if (!getter->IsJSFunction()) return;
+ if (holder->IsGlobalObject()) return;
+ if (!receiver->HasFastProperties()) return;
+ code = isolate()->stub_cache()->ComputeLoadViaGetter(
+ name, receiver, holder, Handle<JSFunction>::cast(getter));
+ // TODO(svenpanne) Remove me when all platforms work.
+ if (code.is_null()) return;
+#if DEBUG_LOADIC
+ PrintF("==============================5 LoadIC::UpdateCaches ");
+ name->Print();
+ PrintF(", code=");
+ code->Print();
+ PrintF("\n");
+#endif
+ } else {
+ ASSERT(callback->IsForeign());
+ // No IC support for old-style native accessors.
+ return;
+ }
break;
}
case INTERCEPTOR:
@@ -2027,6 +2070,11 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_Miss) {
// Used from ic-<arch>.cc.
RUNTIME_FUNCTION(MaybeObject*, LoadIC_Miss) {
+#if DEBUG_LOADIC
+ PrintF("==============================1 LoadIC_Miss ");
+ args.at<String>(1)->Print();
+ PrintF("\n");
+#endif
HandleScope scope(isolate);
ASSERT(args.length() == 2);
LoadIC ic(isolate);

Powered by Google App Engine
This is Rietveld 408576698