Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "src/interpreter/bytecodes.h" | 5 #include "src/interpreter/bytecodes.h" |
| 6 | 6 |
| 7 #include "src/frames.h" | 7 #include "src/frames.h" |
| 8 #include "src/interpreter/bytecode-traits.h" | 8 #include "src/interpreter/bytecode-traits.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 bytecode == Bytecode::kJumpIfFalseConstant || | 176 bytecode == Bytecode::kJumpIfFalseConstant || |
| 177 bytecode == Bytecode::kJumpIfToBooleanTrueConstant || | 177 bytecode == Bytecode::kJumpIfToBooleanTrueConstant || |
| 178 bytecode == Bytecode::kJumpIfToBooleanFalseConstant || | 178 bytecode == Bytecode::kJumpIfToBooleanFalseConstant || |
| 179 bytecode == Bytecode::kJumpIfNull || | 179 bytecode == Bytecode::kJumpIfNull || |
| 180 bytecode == Bytecode::kJumpIfUndefinedConstant; | 180 bytecode == Bytecode::kJumpIfUndefinedConstant; |
| 181 } | 181 } |
| 182 | 182 |
| 183 | 183 |
| 184 // static | 184 // static |
| 185 uint16_t Bytecodes::ShortOperandFromBytes(const uint8_t* bytes) { | 185 uint16_t Bytecodes::ShortOperandFromBytes(const uint8_t* bytes) { |
| 186 return *reinterpret_cast<const uint16_t*>(bytes); | 186 return ReadShortValue(bytes); |
|
rmcilroy
2015/11/05 18:12:01
Could you call this ReadUnalignedUInt16 and get ri
akos.palfi.imgtec
2015/11/05 23:18:00
Done.
| |
| 187 } | 187 } |
| 188 | 188 |
| 189 | 189 |
| 190 // static | 190 // static |
| 191 void Bytecodes::ShortOperandToBytes(uint16_t operand, uint8_t* bytes_out) { | 191 void Bytecodes::ShortOperandToBytes(uint16_t operand, uint8_t* bytes_out) { |
| 192 *reinterpret_cast<uint16_t*>(bytes_out) = operand; | 192 WriteShortValue(bytes_out, operand); |
| 193 } | 193 } |
| 194 | 194 |
| 195 | 195 |
| 196 // static | 196 // static |
| 197 std::ostream& Bytecodes::Decode(std::ostream& os, const uint8_t* bytecode_start, | 197 std::ostream& Bytecodes::Decode(std::ostream& os, const uint8_t* bytecode_start, |
| 198 int parameter_count) { | 198 int parameter_count) { |
| 199 Vector<char> buf = Vector<char>::New(50); | 199 Vector<char> buf = Vector<char>::New(50); |
| 200 | 200 |
| 201 Bytecode bytecode = Bytecodes::FromByte(bytecode_start[0]); | 201 Bytecode bytecode = Bytecodes::FromByte(bytecode_start[0]); |
| 202 int bytecode_size = Bytecodes::Size(bytecode); | 202 int bytecode_size = Bytecodes::Size(bytecode); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 } | 351 } |
| 352 if (reg5.is_valid() && reg4.index() + 1 != reg5.index()) { | 352 if (reg5.is_valid() && reg4.index() + 1 != reg5.index()) { |
| 353 return false; | 353 return false; |
| 354 } | 354 } |
| 355 return true; | 355 return true; |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace interpreter | 358 } // namespace interpreter |
| 359 } // namespace internal | 359 } // namespace internal |
| 360 } // namespace v8 | 360 } // namespace v8 |
| OLD | NEW |