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

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: Address comments 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..a6843115bb27104727e5a926999433b295e0be01 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,21 @@ 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 map_check(this);
+ map_check.IfNot<HCompareObjectEqAndBranch>(expected_map, map);
+ map_check.ThenDeopt("Unknown map");
+ map_check.End();
+ } else {
+ DCHECK(map_embedding == kEmbedMapsDirectly);
+ 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