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

Side by Side Diff: src/interpreter/bytecode-array-builder.h

Issue 1294523002: [Interpreter] Register conversion fix and test. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | test/unittests/interpreter/bytecode-array-builder-unittest.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_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "src/ast.h" 10 #include "src/ast.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 class Register { 77 class Register {
78 public: 78 public:
79 static const int kMaxRegisterIndex = 128; 79 static const int kMaxRegisterIndex = 128;
80 80
81 explicit Register(int index) : index_(index) { 81 explicit Register(int index) : index_(index) {
82 DCHECK_LE(index_, kMaxRegisterIndex); 82 DCHECK_LE(index_, kMaxRegisterIndex);
83 } 83 }
84 84
85 int index() { return index_; } 85 int index() { return index_; }
86 uint8_t ToOperand() { return static_cast<uint8_t>(-index_); } 86 uint8_t ToOperand() { return static_cast<uint8_t>(-index_); }
87 static Register FromOperand(uint8_t operand) { return Register(-operand); } 87 static Register FromOperand(uint8_t operand) {
88 return Register(-static_cast<int8_t>(operand));
89 }
88 90
89 private: 91 private:
90 void* operator new(size_t size); 92 void* operator new(size_t size);
91 void operator delete(void* p); 93 void operator delete(void* p);
92 94
93 int index_; 95 int index_;
94 }; 96 };
95 97
96 // A stack-allocated class than allows the instantiator to allocate 98 // A stack-allocated class than allows the instantiator to allocate
97 // temporary registers that are cleaned up when scope is closed. 99 // temporary registers that are cleaned up when scope is closed.
(...skipping 13 matching lines...) Expand all
111 113
112 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); 114 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope);
113 }; 115 };
114 116
115 117
116 } // namespace interpreter 118 } // namespace interpreter
117 } // namespace internal 119 } // namespace internal
118 } // namespace v8 120 } // namespace v8
119 121
120 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 122 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698