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

Side by Side Diff: test/unittests/interpreter/bytecode-array-builder-unittest.cc

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 | « src/interpreter/bytecode-array-builder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/interpreter/bytecode-array-builder.h" 7 #include "src/interpreter/bytecode-array-builder.h"
8 #include "test/unittests/test-utils.h" 8 #include "test/unittests/test-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 int second; 111 int second;
112 { 112 {
113 TemporaryRegisterScope temporaries(&builder); 113 TemporaryRegisterScope temporaries(&builder);
114 second = temporaries.NewRegister().index(); 114 second = temporaries.NewRegister().index();
115 } 115 }
116 116
117 CHECK_EQ(first, second); 117 CHECK_EQ(first, second);
118 } 118 }
119 119
120
121 TEST_F(BytecodeArrayBuilderTest, RegisterValues) {
122 int index = 1;
123 uint8_t operand = static_cast<uint8_t>(-index);
124
125 Register the_register(index);
126 CHECK_EQ(the_register.index(), index);
127
128 int actual_operand = the_register.ToOperand();
129 CHECK_EQ(actual_operand, operand);
130
131 int actual_index = Register::FromOperand(actual_operand).index();
132 CHECK_EQ(actual_index, index);
133 }
134
120 } // namespace interpreter 135 } // namespace interpreter
121 } // namespace internal 136 } // namespace internal
122 } // namespace v8 137 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698