OLD | NEW |
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 "src/interpreter/bytecode-array-iterator.h" | 8 #include "src/interpreter/bytecode-array-iterator.h" |
9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
10 #include "test/unittests/test-utils.h" | 10 #include "test/unittests/test-utils.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 int total_registers = locals + contexts + temps; | 357 int total_registers = locals + contexts + temps; |
358 CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize); | 358 CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize); |
359 } | 359 } |
360 } | 360 } |
361 } | 361 } |
362 } | 362 } |
363 | 363 |
364 | 364 |
365 TEST_F(BytecodeArrayBuilderTest, RegisterValues) { | 365 TEST_F(BytecodeArrayBuilderTest, RegisterValues) { |
366 int index = 1; | 366 int index = 1; |
367 int32_t operand = -index; | |
368 | 367 |
369 Register the_register(index); | 368 Register the_register(index); |
370 CHECK_EQ(the_register.index(), index); | 369 CHECK_EQ(the_register.index(), index); |
371 | 370 |
372 int actual_operand = the_register.ToOperand(); | 371 int actual_operand = the_register.ToOperand(); |
373 CHECK_EQ(actual_operand, operand); | |
374 | |
375 int actual_index = Register::FromOperand(actual_operand).index(); | 372 int actual_index = Register::FromOperand(actual_operand).index(); |
376 CHECK_EQ(actual_index, index); | 373 CHECK_EQ(actual_index, index); |
377 } | 374 } |
378 | 375 |
379 | 376 |
380 TEST_F(BytecodeArrayBuilderTest, Parameters) { | 377 TEST_F(BytecodeArrayBuilderTest, Parameters) { |
381 BytecodeArrayBuilder builder(isolate(), zone(), 10, 0, 0); | 378 BytecodeArrayBuilder builder(isolate(), zone(), 10, 0, 0); |
382 Register param0(builder.Parameter(0)); | 379 Register param0(builder.Parameter(0)); |
383 Register param9(builder.Parameter(9)); | 380 Register param9(builder.Parameter(9)); |
384 CHECK_EQ(param9.index() - param0.index(), 9); | 381 CHECK_EQ(param9.index() - param0.index(), 9); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 static_cast<size_t>(kMaxUInt16)) == OperandSize::kShort); | 778 static_cast<size_t>(kMaxUInt16)) == OperandSize::kShort); |
782 CHECK(BytecodeArrayBuilder::SizeForUnsignedOperand( | 779 CHECK(BytecodeArrayBuilder::SizeForUnsignedOperand( |
783 static_cast<size_t>(kMaxUInt16 + 1)) == OperandSize::kQuad); | 780 static_cast<size_t>(kMaxUInt16 + 1)) == OperandSize::kQuad); |
784 CHECK(BytecodeArrayBuilder::SizeForUnsignedOperand( | 781 CHECK(BytecodeArrayBuilder::SizeForUnsignedOperand( |
785 static_cast<size_t>(kMaxUInt32)) == OperandSize::kQuad); | 782 static_cast<size_t>(kMaxUInt32)) == OperandSize::kQuad); |
786 } | 783 } |
787 | 784 |
788 } // namespace interpreter | 785 } // namespace interpreter |
789 } // namespace internal | 786 } // namespace internal |
790 } // namespace v8 | 787 } // namespace v8 |
OLD | NEW |