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

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

Issue 1362383002: [Interpreter] Add CallRuntime support to the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm32 debug build check errors. Created 5 years, 2 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 | « test/unittests/interpreter/bytecode-array-builder-unittest.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 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/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 "test/unittests/test-utils.h" 9 #include "test/unittests/test-utils.h"
10 10
(...skipping 19 matching lines...) Expand all
30 Handle<HeapObject> heap_num_0 = factory->NewHeapNumber(2.718); 30 Handle<HeapObject> heap_num_0 = factory->NewHeapNumber(2.718);
31 Handle<HeapObject> heap_num_1 = factory->NewHeapNumber(2147483647); 31 Handle<HeapObject> heap_num_1 = factory->NewHeapNumber(2147483647);
32 Smi* zero = Smi::FromInt(0); 32 Smi* zero = Smi::FromInt(0);
33 Smi* smi_0 = Smi::FromInt(64); 33 Smi* smi_0 = Smi::FromInt(64);
34 Smi* smi_1 = Smi::FromInt(-65536); 34 Smi* smi_1 = Smi::FromInt(-65536);
35 Register reg_0(0); 35 Register reg_0(0);
36 Register reg_1(1); 36 Register reg_1(1);
37 Register reg_2 = Register::FromParameterIndex(2, builder.parameter_count()); 37 Register reg_2 = Register::FromParameterIndex(2, builder.parameter_count());
38 int feedback_slot = 97; 38 int feedback_slot = 97;
39 39
40 // TODO(rmcilroy): Add a test for a bytecode with a short operand when
41 // the CallRuntime bytecode is landed.
42
43 builder.LoadLiteral(heap_num_0) 40 builder.LoadLiteral(heap_num_0)
44 .LoadLiteral(heap_num_1) 41 .LoadLiteral(heap_num_1)
45 .LoadLiteral(zero) 42 .LoadLiteral(zero)
46 .LoadLiteral(smi_0) 43 .LoadLiteral(smi_0)
47 .LoadLiteral(smi_1) 44 .LoadLiteral(smi_1)
48 .LoadAccumulatorWithRegister(reg_0) 45 .LoadAccumulatorWithRegister(reg_0)
49 .LoadNamedProperty(reg_1, feedback_slot, LanguageMode::SLOPPY) 46 .LoadNamedProperty(reg_1, feedback_slot, LanguageMode::SLOPPY)
50 .StoreAccumulatorInRegister(reg_2) 47 .StoreAccumulatorInRegister(reg_2)
48 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1)
51 .Return(); 49 .Return();
52 50
53 // Test iterator sees the expected output from the builder. 51 // Test iterator sees the expected output from the builder.
54 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); 52 BytecodeArrayIterator iterator(builder.ToBytecodeArray());
55 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); 53 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
56 CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0)); 54 CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0));
57 CHECK(!iterator.done()); 55 CHECK(!iterator.done());
58 iterator.Advance(); 56 iterator.Advance();
59 57
60 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); 58 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
(...skipping 24 matching lines...) Expand all
85 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); 83 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
86 CHECK_EQ(iterator.GetIndexOperand(1), feedback_slot); 84 CHECK_EQ(iterator.GetIndexOperand(1), feedback_slot);
87 CHECK(!iterator.done()); 85 CHECK(!iterator.done());
88 iterator.Advance(); 86 iterator.Advance();
89 87
90 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); 88 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
91 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_2.index()); 89 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_2.index());
92 CHECK(!iterator.done()); 90 CHECK(!iterator.done());
93 iterator.Advance(); 91 iterator.Advance();
94 92
93 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime);
94 CHECK_EQ(static_cast<Runtime::FunctionId>(iterator.GetIndexOperand(0)),
95 Runtime::kLoadIC_Miss);
96 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index());
97 CHECK_EQ(iterator.GetCountOperand(2), 1);
98 CHECK(!iterator.done());
99 iterator.Advance();
100
95 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 101 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
96 CHECK(!iterator.done()); 102 CHECK(!iterator.done());
97 iterator.Advance(); 103 iterator.Advance();
98 CHECK(iterator.done()); 104 CHECK(iterator.done());
99 } 105 }
100 106
101 } // namespace interpreter 107 } // namespace interpreter
102 } // namespace internal 108 } // namespace internal
103 } // namespace v8 109 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/interpreter/bytecode-array-builder-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698