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

Unified Diff: src/hydrogen.cc

Issue 812353002: Use weak cell to embed map in CompareNil IC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
}
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698