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

Unified Diff: src/hydrogen.cc

Issue 12700006: Replace ICStub for array.length with hydrogen stub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Even more dead code Created 7 years, 9 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.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | src/ic.cc » ('J')
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 8499b9925eaee3523628d2352cfdfc5ad2c626b6..ca728be0c70564523c132697d698e18450eb42c7 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1050,6 +1050,11 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
elements_kind, is_store);
}
+HInstruction* HGraphBuilder::BuildFastArrayLengthLoad(HValue* object) {
+ Zone* zone = this->zone();
+ return new (zone) HJSArrayLength(object, NULL, HType::Smi());
+}
+
HValue* HGraphBuilder::BuildAllocateElements(HContext* context,
ElementsKind kind,
@@ -6734,6 +6739,15 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic(
Handle<Map> map) {
// Handle a load from a known field.
ASSERT(!map->is_dictionary_map());
+
+ // Handle access to various length properties
+ if (name->Equals(isolate()->heap()->length_string())) {
+ if (map->instance_type() == JS_ARRAY_TYPE) {
+ AddCheckMapsWithTransitions(object, map);
danno 2013/03/13 11:49:48 I think with your changes, you may not need WithTr
Dmitry Lomov (no reviews) 2013/03/13 16:14:31 Done.
+ return BuildFastArrayLengthLoad(object);
+ }
+ }
+
LookupResult lookup(isolate());
map->LookupDescriptor(NULL, *name, &lookup);
if (lookup.IsField()) {
@@ -7220,13 +7234,7 @@ void HOptimizedGraphBuilder::VisitProperty(Property* expr) {
CHECK_ALIVE(VisitForValue(expr->obj()));
HInstruction* instr = NULL;
- if (expr->AsProperty()->IsArrayLength()) {
- HValue* array = Pop();
- AddInstruction(new(zone()) HCheckNonSmi(array));
- HInstruction* mapcheck =
- AddInstruction(HCheckInstanceType::NewIsJSArray(array, zone()));
- instr = new(zone()) HJSArrayLength(array, mapcheck);
- } else if (expr->IsStringLength()) {
+ if (expr->IsStringLength()) {
HValue* string = Pop();
AddInstruction(new(zone()) HCheckNonSmi(string));
AddInstruction(HCheckInstanceType::NewIsString(string, zone()));
« no previous file with comments | « src/hydrogen.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | src/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698