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

Unified Diff: src/hydrogen.cc

Issue 754863002: Optimize testing for an index's existence in packed Arrays (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased for landing Created 6 years 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/array.js ('k') | src/macros.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 78f6f338422292880704cb6596c5c87777bc6b70..468de1eee448c4a26a042a67c13d67cf947153ce 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -11665,6 +11665,35 @@ void HOptimizedGraphBuilder::GenerateIsJSProxy(CallRuntime* call) {
}
+void HOptimizedGraphBuilder::GenerateHasFastPackedElements(CallRuntime* call) {
+ DCHECK(call->arguments()->length() == 1);
+ CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
+ HValue* object = Pop();
+ HIfContinuation continuation(graph()->CreateBasicBlock(),
+ graph()->CreateBasicBlock());
+ IfBuilder if_not_smi(this);
+ if_not_smi.IfNot<HIsSmiAndBranch>(object);
+ if_not_smi.Then();
+ {
+ NoObservableSideEffectsScope no_effects(this);
+
+ IfBuilder if_fast_packed(this);
+ HValue* elements_kind = BuildGetElementsKind(object);
+ if_fast_packed.If<HCompareNumericAndBranch>(
+ elements_kind, Add<HConstant>(FAST_SMI_ELEMENTS), Token::EQ);
+ if_fast_packed.Or();
+ if_fast_packed.If<HCompareNumericAndBranch>(
+ elements_kind, Add<HConstant>(FAST_ELEMENTS), Token::EQ);
+ if_fast_packed.Or();
+ if_fast_packed.If<HCompareNumericAndBranch>(
+ elements_kind, Add<HConstant>(FAST_DOUBLE_ELEMENTS), Token::EQ);
+ if_fast_packed.JoinContinuation(&continuation);
+ }
+ if_not_smi.JoinContinuation(&continuation);
+ return ast_context()->ReturnContinuation(&continuation, call->id());
+}
+
+
void HOptimizedGraphBuilder::GenerateIsNonNegativeSmi(CallRuntime* call) {
return Bailout(kInlinedRuntimeFunctionIsNonNegativeSmi);
}
« no previous file with comments | « src/array.js ('k') | src/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698