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

Side by Side Diff: src/hydrogen.cc

Issue 11344012: Make so that array length property access uses a new IC that tracks the array map. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ast.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 6614 matching lines...) Expand 10 before | Expand all | Expand 10 after
6625 expr->RecordTypeFeedback(oracle(), zone()); 6625 expr->RecordTypeFeedback(oracle(), zone());
6626 6626
6627 if (TryArgumentsAccess(expr)) return; 6627 if (TryArgumentsAccess(expr)) return;
6628 6628
6629 CHECK_ALIVE(VisitForValue(expr->obj())); 6629 CHECK_ALIVE(VisitForValue(expr->obj()));
6630 6630
6631 HInstruction* instr = NULL; 6631 HInstruction* instr = NULL;
6632 if (expr->AsProperty()->IsArrayLength()) { 6632 if (expr->AsProperty()->IsArrayLength()) {
6633 HValue* array = Pop(); 6633 HValue* array = Pop();
6634 AddInstruction(new(zone()) HCheckNonSmi(array)); 6634 AddInstruction(new(zone()) HCheckNonSmi(array));
6635 HInstruction* mapcheck = 6635 HInstruction* mapcheck = NULL;
6636 AddInstruction(HCheckInstanceType::NewIsJSArray(array, zone())); 6636 HType type = HType::Tagged();
6637 instr = new(zone()) HJSArrayLength(array, mapcheck); 6637 if (expr->IsMonomorphic()) {
6638 Handle<Map> map = expr->GetReceiverTypes()->first();
6639 if (IsFastElementsKind(map->elements_kind())) {
6640 // In this case we know that the array length is a SMI and we do a
6641 // map check instead of an IsArray check: this makes so that GVN will
6642 // match this length access with the one used by the bounds check.
6643 mapcheck = new(zone()) HCheckMaps(array, map, zone());
6644 AddInstruction(mapcheck);
6645 type = HType::Smi();
6646 }
6647 }
6648 if (mapcheck == NULL) {
6649 mapcheck =
6650 AddInstruction(HCheckInstanceType::NewIsJSArray(array, zone()));
6651 }
6652 instr = new(zone()) HJSArrayLength(array, mapcheck, type);
6638 } else if (expr->IsStringLength()) { 6653 } else if (expr->IsStringLength()) {
6639 HValue* string = Pop(); 6654 HValue* string = Pop();
6640 AddInstruction(new(zone()) HCheckNonSmi(string)); 6655 AddInstruction(new(zone()) HCheckNonSmi(string));
6641 AddInstruction(HCheckInstanceType::NewIsString(string, zone())); 6656 AddInstruction(HCheckInstanceType::NewIsString(string, zone()));
6642 instr = new(zone()) HStringLength(string); 6657 instr = new(zone()) HStringLength(string);
6643 } else if (expr->IsStringAccess()) { 6658 } else if (expr->IsStringAccess()) {
6644 CHECK_ALIVE(VisitForValue(expr->key())); 6659 CHECK_ALIVE(VisitForValue(expr->key()));
6645 HValue* index = Pop(); 6660 HValue* index = Pop();
6646 HValue* string = Pop(); 6661 HValue* string = Pop();
6647 HValue* context = environment()->LookupContext(); 6662 HValue* context = environment()->LookupContext();
(...skipping 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after
9973 } 9988 }
9974 } 9989 }
9975 9990
9976 #ifdef DEBUG 9991 #ifdef DEBUG
9977 if (graph_ != NULL) graph_->Verify(false); // No full verify. 9992 if (graph_ != NULL) graph_->Verify(false); // No full verify.
9978 if (allocator_ != NULL) allocator_->Verify(); 9993 if (allocator_ != NULL) allocator_->Verify();
9979 #endif 9994 #endif
9980 } 9995 }
9981 9996
9982 } } // namespace v8::internal 9997 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698