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

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

Issue 2523953002: [turbofan] Remove type feedback from AstGraphBuilder pipeline. (Closed)
Patch Set: Created 4 years, 1 month 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/flag-definitions.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
deleted file mode 100644
index 6b66374a11ed92cbb893cfe5b8096b5ac579599e..0000000000000000000000000000000000000000
--- a/src/compiler/type-hint-analyzer.cc
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2015 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/compiler/type-hint-analyzer.h"
-
-#include "src/assembler.h"
-#include "src/code-stubs.h"
-#include "src/ic/ic-state.h"
-#include "src/type-hints.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-namespace {
-
-BinaryOperationHint ToBinaryOperationHint(Token::Value op,
- BinaryOpICState::Kind kind) {
- switch (kind) {
- case BinaryOpICState::NONE:
- return BinaryOperationHint::kNone;
- case BinaryOpICState::SMI:
- return BinaryOperationHint::kSignedSmall;
- case BinaryOpICState::INT32:
- return (Token::IsTruncatingBinaryOp(op) && SmiValuesAre31Bits())
- ? BinaryOperationHint::kNumberOrOddball
- : BinaryOperationHint::kSigned32;
- case BinaryOpICState::NUMBER:
- return BinaryOperationHint::kNumberOrOddball;
- case BinaryOpICState::STRING:
- return BinaryOperationHint::kString;
- case BinaryOpICState::GENERIC:
- return BinaryOperationHint::kAny;
- }
- UNREACHABLE();
- return BinaryOperationHint::kNone;
-}
-
-CompareOperationHint ToCompareOperationHint(Token::Value op,
- CompareICState::State state) {
- switch (state) {
- case CompareICState::UNINITIALIZED:
- return CompareOperationHint::kNone;
- case CompareICState::SMI:
- return CompareOperationHint::kSignedSmall;
- case CompareICState::NUMBER:
- return Token::IsOrderedRelationalCompareOp(op)
- ? CompareOperationHint::kNumberOrOddball
- : CompareOperationHint::kNumber;
- case CompareICState::STRING:
- case CompareICState::INTERNALIZED_STRING:
- return CompareOperationHint::kString;
- case CompareICState::UNIQUE_NAME:
- case CompareICState::RECEIVER:
- case CompareICState::KNOWN_RECEIVER:
- case CompareICState::BOOLEAN:
- case CompareICState::GENERIC:
- return CompareOperationHint::kAny;
- }
- UNREACHABLE();
- return CompareOperationHint::kNone;
-}
-
-} // namespace
-
-bool TypeHintAnalysis::GetBinaryOperationHint(TypeFeedbackId id,
- BinaryOperationHint* hint) const {
- auto i = infos_.find(id);
- if (i == infos_.end()) return false;
- Handle<Code> code = i->second;
- DCHECK_EQ(Code::BINARY_OP_IC, code->kind());
- BinaryOpICState state(code->GetIsolate(), code->extra_ic_state());
- *hint = ToBinaryOperationHint(state.op(), state.kind());
- return true;
-}
-
-bool TypeHintAnalysis::GetCompareOperationHint(
- TypeFeedbackId id, CompareOperationHint* hint) const {
- auto i = infos_.find(id);
- if (i == infos_.end()) return false;
- Handle<Code> code = i->second;
- DCHECK_EQ(Code::COMPARE_IC, code->kind());
- CompareICStub stub(code->stub_key(), code->GetIsolate());
- *hint = ToCompareOperationHint(stub.op(), stub.state());
- return true;
-}
-
-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());
- ToBooleanICStub stub(code->GetIsolate(), code->extra_ic_state());
- *hints = stub.hints();
- return true;
-}
-
-TypeHintAnalysis* TypeHintAnalyzer::Analyze(Handle<Code> code) {
- DisallowHeapAllocation no_gc;
- TypeHintAnalysis::Infos infos(zone());
- Isolate* const isolate = code->GetIsolate();
- int const mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID);
- for (RelocIterator it(*code, mask); !it.done(); it.next()) {
- RelocInfo* rinfo = it.rinfo();
- Address target_address = rinfo->target_address();
- Code* target = Code::GetCodeFromTargetAddress(target_address);
- switch (target->kind()) {
- case Code::BINARY_OP_IC:
- case Code::COMPARE_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;
- }
- }
- return new (zone()) TypeHintAnalysis(infos, zone());
-}
-
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
« no previous file with comments | « src/compiler/type-hint-analyzer.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698