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

Side by Side Diff: test/cctest/interpreter/generate-bytecode-expectations.cc

Issue 1684113002: [Interpreter] Handle negative ints in generate-bytecode-expectations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move IsImmediateOperandType. Created 4 years, 10 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/bytecodes.cc ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 <fstream> 5 #include <fstream>
6 #include <iostream> 6 #include <iostream>
7 7
8 #include "include/libplatform/libplatform.h" 8 #include "include/libplatform/libplatform.h"
9 #include "include/v8.h" 9 #include "include/v8.h"
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 UNREACHABLE(); 139 UNREACHABLE();
140 return; 140 return;
141 } 141 }
142 142
143 if (Bytecodes::IsRegisterOperandType(op_type)) { 143 if (Bytecodes::IsRegisterOperandType(op_type)) {
144 Register register_value = bytecode_iter.GetRegisterOperand(op_index); 144 Register register_value = bytecode_iter.GetRegisterOperand(op_index);
145 stream << 'R'; 145 stream << 'R';
146 if (op_size != OperandSize::kByte) stream << size_tag; 146 if (op_size != OperandSize::kByte) stream << size_tag;
147 stream << '(' << register_value.index() << ')'; 147 stream << '(' << register_value.index() << ')';
148 } else { 148 } else {
149 uint32_t raw_value = bytecode_iter.GetRawOperand(op_index, op_type); 149 stream << 'U' << size_tag << '(';
150 stream << 'U' << size_tag << '(' << raw_value << ')'; 150
151 if (Bytecodes::IsImmediateOperandType(op_type)) {
152 // We need a cast, otherwise the result is printed as char.
153 stream << static_cast<int>(bytecode_iter.GetImmediateOperand(op_index));
154 } else if (Bytecodes::IsRegisterCountOperandType(op_type)) {
155 stream << bytecode_iter.GetCountOperand(op_index);
156 } else if (Bytecodes::IsIndexOperandType(op_type)) {
157 stream << bytecode_iter.GetIndexOperand(op_index);
158 } else {
159 UNREACHABLE();
160 }
161
162 stream << ')';
151 } 163 }
152 } 164 }
153 165
154 void PrintBytecode(std::ostream& stream, 166 void PrintBytecode(std::ostream& stream,
155 const BytecodeArrayIterator& bytecode_iter) { 167 const BytecodeArrayIterator& bytecode_iter) {
156 Bytecode bytecode = bytecode_iter.current_bytecode(); 168 Bytecode bytecode = bytecode_iter.current_bytecode();
157 169
158 stream << "B(" << Bytecodes::ToString(bytecode) << ')'; 170 stream << "B(" << Bytecodes::ToString(bytecode) << ')';
159 171
160 int operands_count = Bytecodes::NumberOfOperands(bytecode); 172 int operands_count = Bytecodes::NumberOfOperands(bytecode);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 297
286 std::string source_code = WrapCodeInFunction(wrapper_function_name, body); 298 std::string source_code = WrapCodeInFunction(wrapper_function_name, body);
287 CompileAndRun(platform.isolate(), context, source_code.c_str()); 299 CompileAndRun(platform.isolate(), context, source_code.c_str());
288 300
289 i::Handle<i::BytecodeArray> bytecode_array = GetBytecodeArrayForGlobal( 301 i::Handle<i::BytecodeArray> bytecode_array = GetBytecodeArrayForGlobal(
290 platform.isolate(), context, wrapper_function_name); 302 platform.isolate(), context, wrapper_function_name);
291 303
292 PrintBytecodeArray(std::cout, bytecode_array, body); 304 PrintBytecodeArray(std::cout, bytecode_array, body);
293 } 305 }
294 } 306 }
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698