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

Unified Diff: src/ic.cc

Issue 23484060: Optimize typed-array length loading. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix bug Created 7 years, 3 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
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index 163172d8eb4df42e68c395c528f1864fb68ca49c..84e65ace6d7d640c528ee30dff1995b104eb86f9 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -1349,6 +1349,19 @@ Handle<Code> LoadIC::ComputeLoadHandler(LookupResult* lookup,
return isolate()->stub_cache()->ComputeLoadNormal(name, receiver);
case CALLBACKS: {
Handle<Object> callback(lookup->GetCallbackObject(), isolate());
+ if (name->Equals(isolate()->heap()->length_string())) {
+ if (receiver->IsJSArray()) {
+ PropertyIndex lengthIndex = PropertyIndex::NewHeaderIndex(
+ JSArray::kLengthOffset / kPointerSize);
+ return isolate()->stub_cache()->ComputeLoadField(
+ name, receiver, receiver, lengthIndex, Representation::Tagged());
+ } else if (receiver->IsJSTypedArray()) {
+ PropertyIndex lengthIndex = PropertyIndex::NewHeaderIndex(
+ JSTypedArray::kLengthOffset / kPointerSize);
+ return isolate()->stub_cache()->ComputeLoadField(
+ name, receiver, receiver, lengthIndex, Representation::Tagged());
+ }
+ }
if (callback->IsExecutableAccessorInfo()) {
Handle<ExecutableAccessorInfo> info =
Handle<ExecutableAccessorInfo>::cast(callback);
@@ -1371,12 +1384,6 @@ Handle<Code> LoadIC::ComputeLoadHandler(LookupResult* lookup,
}
return isolate()->stub_cache()->ComputeLoadViaGetter(
name, receiver, holder, function);
- } else if (receiver->IsJSArray() &&
- name->Equals(isolate()->heap()->length_string())) {
- PropertyIndex lengthIndex = PropertyIndex::NewHeaderIndex(
- JSArray::kLengthOffset / kPointerSize);
- return isolate()->stub_cache()->ComputeLoadField(
- name, receiver, holder, lengthIndex, Representation::Tagged());
}
// TODO(dcarney): Handle correctly.
if (callback->IsDeclaredAccessorInfo()) break;
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698