| 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 Factory* factory = isolate()->factory(); | 387 Factory* factory = isolate()->factory(); |
| 388 Handle<HeapObject> heap_num_1 = factory->NewHeapNumber(3.14); | 388 Handle<HeapObject> heap_num_1 = factory->NewHeapNumber(3.14); |
| 389 Handle<HeapObject> heap_num_2 = factory->NewHeapNumber(5.2); | 389 Handle<HeapObject> heap_num_2 = factory->NewHeapNumber(5.2); |
| 390 Handle<Object> large_smi(Smi::FromInt(0x12345678), isolate()); | 390 Handle<Object> large_smi(Smi::FromInt(0x12345678), isolate()); |
| 391 Handle<HeapObject> heap_num_2_copy(*heap_num_2); | 391 Handle<HeapObject> heap_num_2_copy(*heap_num_2); |
| 392 builder.LoadLiteral(heap_num_1) | 392 builder.LoadLiteral(heap_num_1) |
| 393 .LoadLiteral(heap_num_2) | 393 .LoadLiteral(heap_num_2) |
| 394 .LoadLiteral(large_smi) | 394 .LoadLiteral(large_smi) |
| 395 .LoadLiteral(heap_num_1) | 395 .LoadLiteral(heap_num_1) |
| 396 .LoadLiteral(heap_num_1) | 396 .LoadLiteral(heap_num_1) |
| 397 .LoadLiteral(heap_num_2_copy); | 397 .LoadLiteral(heap_num_2_copy) |
| 398 .Return(); |
| 398 | 399 |
| 399 Handle<BytecodeArray> array = builder.ToBytecodeArray(); | 400 Handle<BytecodeArray> array = builder.ToBytecodeArray(); |
| 400 // Should only have one entry for each identical constant. | 401 // Should only have one entry for each identical constant. |
| 401 CHECK_EQ(array->constant_pool()->length(), 3); | 402 CHECK_EQ(array->constant_pool()->length(), 3); |
| 402 } | 403 } |
| 403 | 404 |
| 404 | 405 |
| 405 TEST_F(BytecodeArrayBuilderTest, ForwardJumps) { | 406 TEST_F(BytecodeArrayBuilderTest, ForwardJumps) { |
| 406 static const int kFarJumpDistance = 256; | 407 static const int kFarJumpDistance = 256; |
| 407 | 408 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 iterator.Advance(); | 660 iterator.Advance(); |
| 660 } | 661 } |
| 661 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 662 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
| 662 iterator.Advance(); | 663 iterator.Advance(); |
| 663 CHECK(iterator.done()); | 664 CHECK(iterator.done()); |
| 664 } | 665 } |
| 665 | 666 |
| 666 } // namespace interpreter | 667 } // namespace interpreter |
| 667 } // namespace internal | 668 } // namespace internal |
| 668 } // namespace v8 | 669 } // namespace v8 |
| OLD | NEW |