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

Unified Diff: src/compiler/source-position.cc

Issue 2451853002: Uniform and precise source positions for inlining (Closed)
Patch Set: fixed gcmole issue 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
Index: src/compiler/source-position.cc
diff --git a/src/compiler/source-position.cc b/src/compiler/source-position.cc
deleted file mode 100644
index 80f180076dd5fada191122d11e649adb4cc7ed0e..0000000000000000000000000000000000000000
--- a/src/compiler/source-position.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2014 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/source-position.h"
-#include "src/compiler/graph.h"
-#include "src/compiler/node-aux-data.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-class SourcePositionTable::Decorator final : public GraphDecorator {
- public:
- explicit Decorator(SourcePositionTable* source_positions)
- : source_positions_(source_positions) {}
-
- void Decorate(Node* node) final {
- source_positions_->SetSourcePosition(node,
- source_positions_->current_position_);
- }
-
- private:
- SourcePositionTable* source_positions_;
-};
-
-
-SourcePositionTable::SourcePositionTable(Graph* graph)
- : graph_(graph),
- decorator_(nullptr),
- current_position_(SourcePosition::Unknown()),
- table_(graph->zone()) {}
-
-
-void SourcePositionTable::AddDecorator() {
- DCHECK_NULL(decorator_);
- decorator_ = new (graph_->zone()) Decorator(this);
- graph_->AddDecorator(decorator_);
-}
-
-
-void SourcePositionTable::RemoveDecorator() {
- DCHECK_NOT_NULL(decorator_);
- graph_->RemoveDecorator(decorator_);
- decorator_ = nullptr;
-}
-
-
-SourcePosition SourcePositionTable::GetSourcePosition(Node* node) const {
- return table_.Get(node);
-}
-
-void SourcePositionTable::SetSourcePosition(Node* node,
- SourcePosition position) {
- table_.Set(node, position);
-}
-
-void SourcePositionTable::Print(std::ostream& os) const {
- os << "{";
- bool needs_comma = false;
- for (auto i : table_) {
- SourcePosition pos = i.second;
- if (pos.IsKnown()) {
- if (needs_comma) {
- os << ",";
- }
- os << "\"" << i.first << "\""
- << ":" << pos.raw();
- needs_comma = true;
- }
- }
- os << "}";
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698