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

Side by Side Diff: src/hydrogen.cc

Issue 667923004: Go generic on polymorphic KeyedLoads with string+other maps (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-425519.js » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 7015 matching lines...) Expand 10 before | Expand all | Expand 10 after
7026 return consolidated_load; 7026 return consolidated_load;
7027 } 7027 }
7028 } 7028 }
7029 7029
7030 // Elements_kind transition support. 7030 // Elements_kind transition support.
7031 MapHandleList transition_target(maps->length()); 7031 MapHandleList transition_target(maps->length());
7032 // Collect possible transition targets. 7032 // Collect possible transition targets.
7033 MapHandleList possible_transitioned_maps(maps->length()); 7033 MapHandleList possible_transitioned_maps(maps->length());
7034 for (int i = 0; i < maps->length(); ++i) { 7034 for (int i = 0; i < maps->length(); ++i) {
7035 Handle<Map> map = maps->at(i); 7035 Handle<Map> map = maps->at(i);
7036 DCHECK(!map->IsStringMap());
7036 ElementsKind elements_kind = map->elements_kind(); 7037 ElementsKind elements_kind = map->elements_kind();
7037 if (IsFastElementsKind(elements_kind) && 7038 if (IsFastElementsKind(elements_kind) &&
7038 elements_kind != GetInitialFastElementsKind()) { 7039 elements_kind != GetInitialFastElementsKind()) {
7039 possible_transitioned_maps.Add(map); 7040 possible_transitioned_maps.Add(map);
7040 } 7041 }
7041 if (elements_kind == SLOPPY_ARGUMENTS_ELEMENTS) { 7042 if (elements_kind == SLOPPY_ARGUMENTS_ELEMENTS) {
7042 HInstruction* result = BuildKeyedGeneric(access_type, expr, object, key, 7043 HInstruction* result = BuildKeyedGeneric(access_type, expr, object, key,
7043 val); 7044 val);
7044 *has_side_effects = result->HasObservableSideEffects(); 7045 *has_side_effects = result->HasObservableSideEffects();
7045 return AddInstruction(result); 7046 return AddInstruction(result);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
7189 // should be left to normal mono/poly behavior (the other maps may benefit 7190 // should be left to normal mono/poly behavior (the other maps may benefit
7190 // from highly optimized stores). 7191 // from highly optimized stores).
7191 for (int i = 0; i < types->length(); i++) { 7192 for (int i = 0; i < types->length(); i++) {
7192 Handle<Map> current_map = types->at(i); 7193 Handle<Map> current_map = types->at(i);
7193 if (current_map->DictionaryElementsInPrototypeChainOnly()) { 7194 if (current_map->DictionaryElementsInPrototypeChainOnly()) {
7194 force_generic = true; 7195 force_generic = true;
7195 monomorphic = false; 7196 monomorphic = false;
7196 break; 7197 break;
7197 } 7198 }
7198 } 7199 }
7200 } else if (access_type == LOAD && !monomorphic &&
7201 (types != NULL && !types->is_empty())) {
7202 // Polymorphic loads have to go generic if any of the maps are strings.
7203 // If some, but not all of the maps are strings, we should go generic
7204 // because polymorphic access wants to key on ElementsKind and isn't
7205 // compatible with strings.
7206 for (int i = 0; i < types->length(); i++) {
7207 Handle<Map> current_map = types->at(i);
7208 if (current_map->IsStringMap()) {
7209 force_generic = true;
7210 break;
7211 }
7212 }
7199 } 7213 }
7200 7214
7201 if (monomorphic) { 7215 if (monomorphic) {
7202 Handle<Map> map = types->first(); 7216 Handle<Map> map = types->first();
7203 if (map->has_slow_elements_kind() || !map->IsJSObjectMap()) { 7217 if (map->has_slow_elements_kind() || !map->IsJSObjectMap()) {
7204 instr = AddInstruction(BuildKeyedGeneric(access_type, expr, obj, key, 7218 instr = AddInstruction(BuildKeyedGeneric(access_type, expr, obj, key,
7205 val)); 7219 val));
7206 } else { 7220 } else {
7207 BuildCheckHeapObject(obj); 7221 BuildCheckHeapObject(obj);
7208 instr = BuildMonomorphicElementAccess( 7222 instr = BuildMonomorphicElementAccess(
(...skipping 5444 matching lines...) Expand 10 before | Expand all | Expand 10 after
12653 if (ShouldProduceTraceOutput()) { 12667 if (ShouldProduceTraceOutput()) {
12654 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12668 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12655 } 12669 }
12656 12670
12657 #ifdef DEBUG 12671 #ifdef DEBUG
12658 graph_->Verify(false); // No full verify. 12672 graph_->Verify(false); // No full verify.
12659 #endif 12673 #endif
12660 } 12674 }
12661 12675
12662 } } // namespace v8::internal 12676 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-425519.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698