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

Side by Side Diff: src/hydrogen.cc

Issue 1221713003: Distinguish slow from fast sloppy arguments (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « src/elements-kind.cc ('k') | src/ia32/code-stubs-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 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 7124 matching lines...) Expand 10 before | Expand all | Expand 10 after
7135 LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map); 7135 LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map);
7136 return BuildUncheckedMonomorphicElementAccess( 7136 return BuildUncheckedMonomorphicElementAccess(
7137 checked_object, key, val, 7137 checked_object, key, val,
7138 map->instance_type() == JS_ARRAY_TYPE, 7138 map->instance_type() == JS_ARRAY_TYPE,
7139 map->elements_kind(), access_type, 7139 map->elements_kind(), access_type,
7140 load_mode, store_mode); 7140 load_mode, store_mode);
7141 } 7141 }
7142 7142
7143 7143
7144 static bool CanInlineElementAccess(Handle<Map> map) { 7144 static bool CanInlineElementAccess(Handle<Map> map) {
7145 return map->IsJSObjectMap() && !map->has_slow_elements_kind() && 7145 return map->IsJSObjectMap() && !map->has_dictionary_elements() &&
7146 !map->has_sloppy_arguments_elements() &&
7146 !map->has_indexed_interceptor() && !map->is_access_check_needed(); 7147 !map->has_indexed_interceptor() && !map->is_access_check_needed();
7147 } 7148 }
7148 7149
7149 7150
7150 HInstruction* HOptimizedGraphBuilder::TryBuildConsolidatedElementLoad( 7151 HInstruction* HOptimizedGraphBuilder::TryBuildConsolidatedElementLoad(
7151 HValue* object, 7152 HValue* object,
7152 HValue* key, 7153 HValue* key,
7153 HValue* val, 7154 HValue* val,
7154 SmallMapList* maps) { 7155 SmallMapList* maps) {
7155 // For polymorphic loads of similar elements kinds (i.e. all tagged or all 7156 // For polymorphic loads of similar elements kinds (i.e. all tagged or all
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
7241 for (int i = 0; i < maps->length(); ++i) { 7242 for (int i = 0; i < maps->length(); ++i) {
7242 Handle<Map> map = maps->at(i); 7243 Handle<Map> map = maps->at(i);
7243 // Loads from strings or loads with a mix of string and non-string maps 7244 // Loads from strings or loads with a mix of string and non-string maps
7244 // shouldn't be handled polymorphically. 7245 // shouldn't be handled polymorphically.
7245 DCHECK(access_type != LOAD || !map->IsStringMap()); 7246 DCHECK(access_type != LOAD || !map->IsStringMap());
7246 ElementsKind elements_kind = map->elements_kind(); 7247 ElementsKind elements_kind = map->elements_kind();
7247 if (CanInlineElementAccess(map) && IsFastElementsKind(elements_kind) && 7248 if (CanInlineElementAccess(map) && IsFastElementsKind(elements_kind) &&
7248 elements_kind != GetInitialFastElementsKind()) { 7249 elements_kind != GetInitialFastElementsKind()) {
7249 possible_transitioned_maps.Add(map); 7250 possible_transitioned_maps.Add(map);
7250 } 7251 }
7251 if (elements_kind == SLOPPY_ARGUMENTS_ELEMENTS) { 7252 if (IsSloppyArgumentsElements(elements_kind)) {
7252 HInstruction* result = BuildKeyedGeneric(access_type, expr, object, key, 7253 HInstruction* result = BuildKeyedGeneric(access_type, expr, object, key,
7253 val); 7254 val);
7254 *has_side_effects = result->HasObservableSideEffects(); 7255 *has_side_effects = result->HasObservableSideEffects();
7255 return AddInstruction(result); 7256 return AddInstruction(result);
7256 } 7257 }
7257 } 7258 }
7258 // Get transition target for each map (NULL == no transition). 7259 // Get transition target for each map (NULL == no transition).
7259 for (int i = 0; i < maps->length(); ++i) { 7260 for (int i = 0; i < maps->length(); ++i) {
7260 Handle<Map> map = maps->at(i); 7261 Handle<Map> map = maps->at(i);
7261 Handle<Map> transitioned_map = 7262 Handle<Map> transitioned_map =
7262 map->FindTransitionedMap(&possible_transitioned_maps); 7263 Map::FindTransitionedMap(map, &possible_transitioned_maps);
7263 transition_target.Add(transitioned_map); 7264 transition_target.Add(transitioned_map);
7264 } 7265 }
7265 7266
7266 MapHandleList untransitionable_maps(maps->length()); 7267 MapHandleList untransitionable_maps(maps->length());
7267 HTransitionElementsKind* transition = NULL; 7268 HTransitionElementsKind* transition = NULL;
7268 for (int i = 0; i < maps->length(); ++i) { 7269 for (int i = 0; i < maps->length(); ++i) {
7269 Handle<Map> map = maps->at(i); 7270 Handle<Map> map = maps->at(i);
7270 DCHECK(map->IsMap()); 7271 DCHECK(map->IsMap());
7271 if (!transition_target.at(i).is_null()) { 7272 if (!transition_target.at(i).is_null()) {
7272 DCHECK(Map::IsValidElementsTransition( 7273 DCHECK(Map::IsValidElementsTransition(
(...skipping 5936 matching lines...) Expand 10 before | Expand all | Expand 10 after
13209 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13210 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13210 } 13211 }
13211 13212
13212 #ifdef DEBUG 13213 #ifdef DEBUG
13213 graph_->Verify(false); // No full verify. 13214 graph_->Verify(false); // No full verify.
13214 #endif 13215 #endif
13215 } 13216 }
13216 13217
13217 } // namespace internal 13218 } // namespace internal
13218 } // namespace v8 13219 } // namespace v8
OLDNEW
« no previous file with comments | « src/elements-kind.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698