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

Unified Diff: src/interpreter/bytecode-register-allocator.h

Issue 1587033002: [Interpreter] Ensure we always have an outer register allocation scope. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_mythri
Patch Set: Similarity 20 Created 4 years, 11 months 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/interpreter/bytecode-generator.cc ('k') | src/interpreter/bytecode-register-allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/interpreter/bytecode-register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698