// Copyright 2016 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. #ifndef V8_CODEGEN_SOURCE_POSITION_H_ #define V8_CODEGEN_SOURCE_POSITION_H_ #include <iosfwd> #include "src/base/bit-field.h" #include "src/common/globals.h" #include "src/flags/flags.h" #include "src/handles/handles.h" namespace v8 { namespace internal { class InstructionStream; class OptimizedCompilationInfo; class Script; class SharedFunctionInfo; struct SourcePositionInfo; // SourcePosition stores // - is_external (1 bit true/false) // // - if is_external is true: // - external_line (20 bits, non-negative int) // - external_file_id (10 bits, non-negative int) // // - if is_external is false: // - script_offset (30 bit non-negative int or kNoSourcePosition) // // - In both cases, there is an inlining_id. // - inlining_id (16 bit non-negative int or kNotInlined). // // An "external" SourcePosition is one given by a file_id and a line, // suitable for embedding references to .cc or .tq files. // Otherwise, a SourcePosition contains an offset into a JavaScript // file. // // A defined inlining_id refers to positions in // OptimizedCompilationInfo::inlined_functions or // DeoptimizationData::InliningPositions, depending on the compilation stage. class SourcePosition final { … }; inline bool operator==(const SourcePosition& lhs, const SourcePosition& rhs) { … } inline bool operator!=(const SourcePosition& lhs, const SourcePosition& rhs) { … } struct InliningPosition { … }; struct WasmInliningPosition { … }; struct SourcePositionInfo { … }; std::ostream& operator<<(std::ostream& out, const SourcePosition& pos); std::ostream& operator<<(std::ostream& out, const SourcePositionInfo& pos); std::ostream& operator<<(std::ostream& out, const std::vector<SourcePositionInfo>& stack); } // namespace internal } // namespace v8 #endif // V8_CODEGEN_SOURCE_POSITION_H_