| Index: src/interpreter/bytecode-register-allocator.h
|
| diff --git a/src/compiler/type-hint-analyzer.h b/src/interpreter/bytecode-register-allocator.h
|
| similarity index 23%
|
| copy from src/compiler/type-hint-analyzer.h
|
| copy to src/interpreter/bytecode-register-allocator.h
|
| index 1a799056335bd5994084affe7e8c858b4884221b..74ab3a42727119c907a05e400b07d1af483a817b 100644
|
| --- a/src/compiler/type-hint-analyzer.h
|
| +++ b/src/interpreter/bytecode-register-allocator.h
|
| @@ -2,50 +2,48 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef V8_COMPILER_TYPE_HINT_ANALYZER_H_
|
| -#define V8_COMPILER_TYPE_HINT_ANALYZER_H_
|
| +#ifndef V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_
|
| +#define V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_
|
|
|
| -#include "src/compiler/type-hints.h"
|
| -#include "src/handles.h"
|
| #include "src/zone-containers.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
| -namespace compiler {
|
| +namespace interpreter {
|
|
|
| -// The result of analyzing type hints.
|
| -class TypeHintAnalysis final : public ZoneObject {
|
| - public:
|
| - typedef ZoneMap<TypeFeedbackId, Handle<Code>> Infos;
|
| -
|
| - explicit TypeHintAnalysis(Infos const& infos) : infos_(infos) {}
|
| +class BytecodeArrayBuilder;
|
| +class Register;
|
|
|
| - bool GetBinaryOperationHints(TypeFeedbackId id,
|
| - BinaryOperationHints* hints) const;
|
| - bool GetToBooleanHints(TypeFeedbackId id, ToBooleanHints* hints) const;
|
| -
|
| - private:
|
| - Infos const infos_;
|
| -};
|
| +// A class than allows the instantiator to allocate temporary registers that are
|
| +// cleaned up when scope is closed.
|
| +class BytecodeRegisterAllocator {
|
| + public:
|
| + explicit BytecodeRegisterAllocator(BytecodeArrayBuilder* builder);
|
| + ~BytecodeRegisterAllocator();
|
| + Register NewRegister();
|
|
|
| + void PrepareForConsecutiveAllocations(size_t count);
|
| + Register NextConsecutiveRegister();
|
|
|
| -// The class that performs type hint analysis on the fullcodegen code object.
|
| -class TypeHintAnalyzer final {
|
| - public:
|
| - explicit TypeHintAnalyzer(Zone* zone) : zone_(zone) {}
|
| + bool RegisterIsAllocatedInThisScope(Register reg) const;
|
|
|
| - TypeHintAnalysis* Analyze(Handle<Code> code);
|
| + bool HasConsecutiveAllocations() const { return next_consecutive_count_ > 0; }
|
|
|
| private:
|
| - Zone* zone() const { return zone_; }
|
| + void* operator new(size_t size);
|
| + void operator delete(void* p);
|
|
|
| - Zone* const zone_;
|
| + BytecodeArrayBuilder* builder_;
|
| + ZoneVector<int> allocated_;
|
| + int next_consecutive_register_;
|
| + int next_consecutive_count_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(TypeHintAnalyzer);
|
| + DISALLOW_COPY_AND_ASSIGN(BytecodeRegisterAllocator);
|
| };
|
|
|
| -} // namespace compiler
|
| +} // namespace interpreter
|
| } // namespace internal
|
| } // namespace v8
|
|
|
| -#endif // V8_COMPILER_TYPE_HINT_ANALYZER_H_
|
| +
|
| +#endif // V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_
|
|
|