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

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

Issue 1379933003: Revert of [Interpreter] Add CallRuntime support to the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
40 builder.LoadLiteral(heap_num_0) 43 builder.LoadLiteral(heap_num_0)
41 .LoadLiteral(heap_num_1) 44 .LoadLiteral(heap_num_1)
42 .LoadLiteral(zero) 45 .LoadLiteral(zero)
43 .LoadLiteral(smi_0) 46 .LoadLiteral(smi_0)
44 .LoadLiteral(smi_1) 47 .LoadLiteral(smi_1)
45 .LoadAccumulatorWithRegister(reg_0) 48 .LoadAccumulatorWithRegister(reg_0)
46 .LoadNamedProperty(reg_1, feedback_slot, LanguageMode::SLOPPY) 49 .LoadNamedProperty(reg_1, feedback_slot, LanguageMode::SLOPPY)
47 .StoreAccumulatorInRegister(reg_2) 50 .StoreAccumulatorInRegister(reg_2)
48 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1)
49 .Return(); 51 .Return();
50 52
51 // Test iterator sees the expected output from the builder. 53 // Test iterator sees the expected output from the builder.
52 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); 54 BytecodeArrayIterator iterator(builder.ToBytecodeArray());
53 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); 55 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
54 CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0)); 56 CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0));
55 CHECK(!iterator.done()); 57 CHECK(!iterator.done());
56 iterator.Advance(); 58 iterator.Advance();
57 59
58 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); 60 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
(...skipping 24 matching lines...) Expand all
83 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); 85 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
84 CHECK_EQ(iterator.GetIndexOperand(1), feedback_slot); 86 CHECK_EQ(iterator.GetIndexOperand(1), feedback_slot);
85 CHECK(!iterator.done()); 87 CHECK(!iterator.done());
86 iterator.Advance(); 88 iterator.Advance();
87 89
88 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); 90 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
89 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_2.index()); 91 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_2.index());
90 CHECK(!iterator.done()); 92 CHECK(!iterator.done());
91 iterator.Advance(); 93 iterator.Advance();
92 94
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
101 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 95 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
102 CHECK(!iterator.done()); 96 CHECK(!iterator.done());
103 iterator.Advance(); 97 iterator.Advance();
104 CHECK(iterator.done()); 98 CHECK(iterator.done());
105 } 99 }
106 100
107 } // namespace interpreter 101 } // namespace interpreter
108 } // namespace internal 102 } // namespace internal
109 } // namespace v8 103 } // 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