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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_COMPILER_TYPE_HINT_ANALYZER_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_
6 #define V8_COMPILER_TYPE_HINT_ANALYZER_H_ 6 #define V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_
7 7
8 #include "src/compiler/type-hints.h"
9 #include "src/handles.h"
10 #include "src/zone-containers.h" 8 #include "src/zone-containers.h"
11 9
12 namespace v8 { 10 namespace v8 {
13 namespace internal { 11 namespace internal {
14 namespace compiler { 12 namespace interpreter {
15 13
16 // The result of analyzing type hints. 14 class BytecodeArrayBuilder;
17 class TypeHintAnalysis final : public ZoneObject { 15 class Register;
16
17 // A class than allows the instantiator to allocate temporary registers that are
18 // cleaned up when scope is closed.
19 class BytecodeRegisterAllocator {
18 public: 20 public:
19 typedef ZoneMap<TypeFeedbackId, Handle<Code>> Infos; 21 explicit BytecodeRegisterAllocator(BytecodeArrayBuilder* builder);
22 ~BytecodeRegisterAllocator();
23 Register NewRegister();
20 24
21 explicit TypeHintAnalysis(Infos const& infos) : infos_(infos) {} 25 void PrepareForConsecutiveAllocations(size_t count);
26 Register NextConsecutiveRegister();
22 27
23 bool GetBinaryOperationHints(TypeFeedbackId id, 28 bool RegisterIsAllocatedInThisScope(Register reg) const;
24 BinaryOperationHints* hints) const; 29
25 bool GetToBooleanHints(TypeFeedbackId id, ToBooleanHints* hints) const; 30 bool HasConsecutiveAllocations() const { return next_consecutive_count_ > 0; }
26 31
27 private: 32 private:
28 Infos const infos_; 33 void* operator new(size_t size);
34 void operator delete(void* p);
35
36 BytecodeArrayBuilder* builder_;
37 ZoneVector<int> allocated_;
38 int next_consecutive_register_;
39 int next_consecutive_count_;
40
41 DISALLOW_COPY_AND_ASSIGN(BytecodeRegisterAllocator);
29 }; 42 };
30 43
31 44 } // namespace interpreter
32 // The class that performs type hint analysis on the fullcodegen code object.
33 class TypeHintAnalyzer final {
34 public:
35 explicit TypeHintAnalyzer(Zone* zone) : zone_(zone) {}
36
37 TypeHintAnalysis* Analyze(Handle<Code> code);
38
39 private:
40 Zone* zone() const { return zone_; }
41
42 Zone* const zone_;
43
44 DISALLOW_COPY_AND_ASSIGN(TypeHintAnalyzer);
45 };
46
47 } // namespace compiler
48 } // namespace internal 45 } // namespace internal
49 } // namespace v8 46 } // namespace v8
50 47
51 #endif // V8_COMPILER_TYPE_HINT_ANALYZER_H_ 48
49 #endif // V8_INTERPRETER_BYTECODE_REGISTER_ALLOCATOR_H_
OLDNEW
« 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