Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index 987d60b334115809200ccec79c35c489da3ffaa6..74463fde98e95546abde7618dff75f2e372eef1e 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -3016,10 +3016,9 @@ HValue* HGraphBuilder::BuildCloneShallowArrayNonEmpty(HValue* boilerplate, |
| } |
| -void HGraphBuilder::BuildCompareNil( |
| - HValue* value, |
| - Type* type, |
| - HIfContinuation* continuation) { |
| +void HGraphBuilder::BuildCompareNil(HValue* value, Type* type, |
| + HIfContinuation* continuation, |
| + MapEmbedding map_embedding) { |
| IfBuilder if_nil(this); |
| bool some_case_handled = false; |
| bool some_case_missing = false; |
| @@ -3058,7 +3057,22 @@ void HGraphBuilder::BuildCompareNil( |
| // the monomorphic map when the code is used as a template to generate a |
| // new IC. For optimized functions, there is no sentinel map, the map |
| // emitted below is the actual monomorphic map. |
| - Add<HCheckMaps>(value, type->Classes().Current()); |
| + if (map_embedding == kEmbedMapsViaWeakCells) { |
| + HValue* cell = |
| + Add<HConstant>(Map::WeakCellForMap(type->Classes().Current())); |
| + HValue* expected_map = Add<HLoadNamedField>( |
| + cell, nullptr, HObjectAccess::ForWeakCellValue()); |
| + HValue* map = |
| + Add<HLoadNamedField>(value, nullptr, HObjectAccess::ForMap()); |
| + IfBuilder builder(this); |
| + builder.If<HCompareObjectEqAndBranch>(expected_map, map); |
|
Jakob Kummerow
2014/12/18 15:21:07
nit: When several IfBuilders are at play, I like n
ulan
2014/12/18 15:41:24
Done. Thanks, this is much better.
|
| + builder.Then(); |
| + builder.Else(); |
| + Add<HDeoptimize>("Unknown map", Deoptimizer::EAGER); |
| + builder.End(); |
| + } else { |
|
Jakob Kummerow
2014/12/18 15:21:07
nit: add a DCHECK(map_embedding == kEmbedMapsDirec
ulan
2014/12/18 15:41:24
Done.
|
| + Add<HCheckMaps>(value, type->Classes().Current()); |
| + } |
| } else { |
| if_nil.Deopt("Too many undetectable types"); |
| } |