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

Unified Diff: src/runtime.cc

Issue 9111036: Promote double arrays to FAST_ELEMENT that use generic KeyedLoadIC (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 10 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/ic.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index d80b4a6945218e15ad17039b851db98822959266..27335c91747a85419a178322120afc0b5c0908af 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -4270,14 +4270,24 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_KeyedGetProperty) {
// If value is the hole do the general lookup.
}
}
- } else if (FLAG_smi_only_arrays && args.at<Object>(1)->IsSmi()) {
+ } else if (args.at<Object>(1)->IsSmi()) {
+ // Getting properties from FAST_DOUBLE_ELEMENTS arrays causes boxing. To
+ // proactively avoid excessive boxing, transition FAST_DOUBLE_ELEMENTS
+ // arrays to FAST_ELEMENTS if they are accessed via this function, which
+ // is called by the KeyedLoadIC::GenericStub.
+ Handle<JSObject> js_object(args.at<JSObject>(0));
+ if (js_object->HasFastDoubleElements()) {
+ MaybeObject* maybe_object =
+ js_object->TransitionElementsKind(FAST_ELEMENTS);
+ if (maybe_object->IsFailure()) return maybe_object;
+ }
+
// JSObject without a string key. If the key is a Smi, check for a
// definite out-of-bounds access to elements, which is a strong indicator
// that subsequent accesses will also call the runtime. Proactively
// transition elements to FAST_ELEMENTS to avoid excessive boxing of
// doubles for those future calls in the case that the elements would
// become FAST_DOUBLE_ELEMENTS.
- Handle<JSObject> js_object(args.at<JSObject>(0));
ElementsKind elements_kind = js_object->GetElementsKind();
if (elements_kind == FAST_SMI_ONLY_ELEMENTS ||
elements_kind == FAST_DOUBLE_ELEMENTS) {
« no previous file with comments | « src/ic.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698