Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index 7b623b50877d80d371dd2d2dad35d9e9faa38fe9..ec989929b4b635671d2aa682c92325927b04c881 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -4005,7 +4005,9 @@ void HOptimizedGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) { |
| static bool CanInlinePropertyAccess(Map* type) { |
| - return !type->is_dictionary_map() && !type->has_named_interceptor(); |
| + return type->IsJSObjectMap() && |
| + !type->is_dictionary_map() && |
| + !type->has_named_interceptor(); |
| } |
| @@ -4620,6 +4622,7 @@ HInstruction* HOptimizedGraphBuilder::TryLoadPolymorphicAsMonomorphic( |
| Handle<Map> holder_map(holder->map()); |
| HValue* checked_holder = BuildCheckPrototypeMaps( |
| Handle<JSObject>::cast(prototype), holder); |
| + ASSERT(holder_map->IsJSObjectMap()); |
|
Michael Starzinger
2013/09/12 21:41:38
This is virtually guaranteed, as we are loading th
|
| return BuildLoadNamedField(checked_holder, |
| HObjectAccess::ForField(holder_map, &lookup, name)); |
| } |
| @@ -5381,6 +5384,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic( |
| map->LookupDescriptor(NULL, *name, &lookup); |
| if (lookup.IsField()) { |
| HCheckMaps* checked_object = AddCheckMap(object, map); |
| + ASSERT(map->IsJSObjectMap()); |
| return BuildLoadNamedField( |
| checked_object, HObjectAccess::ForField(map, &lookup, name)); |
| } |
| @@ -5392,6 +5396,12 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic( |
| return New<HConstant>(constant); |
| } |
| + if (lookup.IsFound()) { |
| + // Cannot handle the property, do a generic load instead. |
| + HValue* context = environment()->context(); |
| + return new(zone()) HLoadNamedGeneric(context, object, name); |
| + } |
| + |
| // Handle a load from a known field somewhere in the prototype chain. |
| LookupInPrototypes(map, name, &lookup); |
| if (lookup.IsField()) { |
| @@ -5400,6 +5410,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic( |
| Handle<Map> holder_map(holder->map()); |
| AddCheckMap(object, map); |
| HValue* checked_holder = BuildCheckPrototypeMaps(prototype, holder); |
| + ASSERT(holder_map->IsJSObjectMap()); |
|
Michael Starzinger
2013/09/12 21:41:38
Likewise.
|
| return BuildLoadNamedField( |
| checked_holder, HObjectAccess::ForField(holder_map, &lookup, name)); |
| } |
| @@ -5484,6 +5495,7 @@ HInstruction* HOptimizedGraphBuilder::TryBuildConsolidatedElementLoad( |
| Handle<Map> most_general_consolidated_map; |
| for (int i = 0; i < maps->length(); ++i) { |
| Handle<Map> map = maps->at(i); |
| + if (!map->IsJSObjectMap()) return NULL; |
| // Don't allow mixing of JSArrays with JSObjects. |
| if (map->instance_type() == JS_ARRAY_TYPE) { |
| if (has_non_js_array_access) return NULL; |
| @@ -5536,7 +5548,7 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( |
| HValue* object, |
| HValue* key, |
| HValue* val, |
| - Expression* prop, |
| + SmallMapList* maps, |
| BailoutId ast_id, |
| int position, |
| bool is_store, |
| @@ -5544,7 +5556,6 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( |
| bool* has_side_effects) { |
| *has_side_effects = false; |
| BuildCheckHeapObject(object); |
| - SmallMapList* maps = prop->GetReceiverTypes(); |
| if (!is_store) { |
| HInstruction* consolidated_load = |
| @@ -5600,7 +5611,8 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( |
| if (untransitionable_maps.length() == 1) { |
| Handle<Map> untransitionable_map = untransitionable_maps[0]; |
| HInstruction* instr = NULL; |
| - if (untransitionable_map->has_slow_elements_kind()) { |
| + if (untransitionable_map->has_slow_elements_kind() || |
| + !untransitionable_map->IsJSObjectMap()) { |
| instr = AddInstruction(is_store ? BuildStoreKeyedGeneric(object, key, val) |
| : BuildLoadKeyedGeneric(object, key)); |
| } else { |
| @@ -5617,6 +5629,7 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( |
| for (int i = 0; i < untransitionable_maps.length(); ++i) { |
| Handle<Map> map = untransitionable_maps[i]; |
| + if (!map->IsJSObjectMap()) continue; |
| ElementsKind elements_kind = map->elements_kind(); |
| HBasicBlock* this_map = graph()->CreateBasicBlock(); |
| HBasicBlock* other_map = graph()->CreateBasicBlock(); |
| @@ -5689,10 +5702,9 @@ HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( |
| instr = BuildMonomorphicElementAccess( |
| obj, key, val, NULL, map, is_store, expr->GetStoreMode()); |
| } |
| - } else if (expr->GetReceiverTypes() != NULL && |
| - !expr->GetReceiverTypes()->is_empty()) { |
| + } else if (types != NULL && !types->is_empty()) { |
| return HandlePolymorphicElementAccess( |
| - obj, key, val, expr, ast_id, position, is_store, |
| + obj, key, val, types, ast_id, position, is_store, |
| expr->GetStoreMode(), has_side_effects); |
| } else { |
| if (is_store) { |