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

Unified Diff: src/compiler/type-hint-analyzer.cc

Issue 1494973002: [turbofan] Introduce ToBooleanHints on ToBoolean operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/compiler/type-hint-analyzer.h ('k') | src/compiler/type-hints.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/type-hint-analyzer.cc
diff --git a/src/compiler/type-hint-analyzer.cc b/src/compiler/type-hint-analyzer.cc
index e86f94ab9f531e973437940a878e2bc723190594..42c4627b67bf50c3fbabd1837c13c9b1afef0ed9 100644
--- a/src/compiler/type-hint-analyzer.cc
+++ b/src/compiler/type-hint-analyzer.cc
@@ -5,6 +5,7 @@
#include "src/compiler/type-hint-analyzer.h"
#include "src/assembler.h"
+#include "src/code-stubs.h"
#include "src/compiler/type-hints.h"
#include "src/ic/ic-state.h"
@@ -41,6 +42,32 @@ bool TypeHintAnalysis::GetBinaryOperationHints(
}
+bool TypeHintAnalysis::GetToBooleanHints(TypeFeedbackId id,
+ ToBooleanHints* hints) const {
+ auto i = infos_.find(id);
+ if (i == infos_.end()) return false;
+ Handle<Code> code = i->second;
+ DCHECK_EQ(Code::TO_BOOLEAN_IC, code->kind());
+ ToBooleanStub stub(code->GetIsolate(), code->extra_ic_state());
+// TODO(bmeurer): Replace ToBooleanStub::Types with ToBooleanHints.
+#define ASSERT_COMPATIBLE(NAME, Name) \
+ STATIC_ASSERT(1 << ToBooleanStub::NAME == \
+ static_cast<int>(ToBooleanHint::k##Name))
+ ASSERT_COMPATIBLE(UNDEFINED, Undefined);
+ ASSERT_COMPATIBLE(BOOLEAN, Boolean);
+ ASSERT_COMPATIBLE(NULL_TYPE, Null);
+ ASSERT_COMPATIBLE(SMI, SmallInteger);
+ ASSERT_COMPATIBLE(SPEC_OBJECT, Receiver);
+ ASSERT_COMPATIBLE(STRING, String);
+ ASSERT_COMPATIBLE(SYMBOL, Symbol);
+ ASSERT_COMPATIBLE(HEAP_NUMBER, HeapNumber);
+ ASSERT_COMPATIBLE(SIMD_VALUE, SimdValue);
+#undef ASSERT_COMPATIBLE
+ *hints = ToBooleanHints(stub.types().ToIntegral());
+ return true;
+}
+
+
TypeHintAnalysis* TypeHintAnalyzer::Analyze(Handle<Code> code) {
DisallowHeapAllocation no_gc;
TypeHintAnalysis::Infos infos(zone());
@@ -51,13 +78,13 @@ TypeHintAnalysis* TypeHintAnalyzer::Analyze(Handle<Code> code) {
Address target_address = rinfo->target_address();
Code* target = Code::GetCodeFromTargetAddress(target_address);
switch (target->kind()) {
- case Code::BINARY_OP_IC: {
+ case Code::BINARY_OP_IC:
+ case Code::TO_BOOLEAN_IC: {
// Add this feedback to the {infos}.
TypeFeedbackId id(static_cast<unsigned>(rinfo->data()));
infos.insert(std::make_pair(id, handle(target, isolate)));
break;
}
-
default:
// Ignore the remaining code objects.
break;
« no previous file with comments | « src/compiler/type-hint-analyzer.h ('k') | src/compiler/type-hints.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698