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

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

Issue 1419003002: [Interpreter] Unify global and unallocated variable access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix unallocated variable error 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 18 matching lines...) Expand all
29 29
30 Factory* factory = isolate()->factory(); 30 Factory* factory = isolate()->factory();
31 Handle<HeapObject> heap_num_0 = factory->NewHeapNumber(2.718); 31 Handle<HeapObject> heap_num_0 = factory->NewHeapNumber(2.718);
32 Handle<HeapObject> heap_num_1 = factory->NewHeapNumber(2147483647); 32 Handle<HeapObject> heap_num_1 = factory->NewHeapNumber(2147483647);
33 Smi* zero = Smi::FromInt(0); 33 Smi* zero = Smi::FromInt(0);
34 Smi* smi_0 = Smi::FromInt(64); 34 Smi* smi_0 = Smi::FromInt(64);
35 Smi* smi_1 = Smi::FromInt(-65536); 35 Smi* smi_1 = Smi::FromInt(-65536);
36 Register reg_0(0); 36 Register reg_0(0);
37 Register reg_1(1); 37 Register reg_1(1);
38 Register reg_2 = Register::FromParameterIndex(2, builder.parameter_count()); 38 Register reg_2 = Register::FromParameterIndex(2, builder.parameter_count());
39 int name_index = 21;
39 int feedback_slot = 97; 40 int feedback_slot = 97;
40 41
41 builder.LoadLiteral(heap_num_0) 42 builder.LoadLiteral(heap_num_0)
42 .LoadLiteral(heap_num_1) 43 .LoadLiteral(heap_num_1)
43 .LoadLiteral(zero) 44 .LoadLiteral(zero)
44 .LoadLiteral(smi_0) 45 .LoadLiteral(smi_0)
45 .LoadLiteral(smi_1) 46 .LoadLiteral(smi_1)
46 .LoadAccumulatorWithRegister(reg_0) 47 .LoadAccumulatorWithRegister(reg_0)
47 .LoadNamedProperty(reg_1, feedback_slot, LanguageMode::SLOPPY) 48 .LoadNamedProperty(reg_1, name_index, feedback_slot, LanguageMode::SLOPPY)
48 .StoreAccumulatorInRegister(reg_2) 49 .StoreAccumulatorInRegister(reg_2)
49 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) 50 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1)
50 .Return(); 51 .Return();
51 52
52 // Test iterator sees the expected output from the builder. 53 // Test iterator sees the expected output from the builder.
53 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); 54 BytecodeArrayIterator iterator(builder.ToBytecodeArray());
54 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); 55 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
55 CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0)); 56 CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0));
56 CHECK(!iterator.done()); 57 CHECK(!iterator.done());
57 iterator.Advance(); 58 iterator.Advance();
(...skipping 17 matching lines...) Expand all
75 CHECK(!iterator.done()); 76 CHECK(!iterator.done());
76 iterator.Advance(); 77 iterator.Advance();
77 78
78 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar); 79 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar);
79 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); 80 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
80 CHECK(!iterator.done()); 81 CHECK(!iterator.done());
81 iterator.Advance(); 82 iterator.Advance();
82 83
83 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLoadICSloppy); 84 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLoadICSloppy);
84 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); 85 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
85 CHECK_EQ(iterator.GetIndexOperand(1), feedback_slot); 86 CHECK_EQ(iterator.GetIndexOperand(1), name_index);
87 CHECK_EQ(iterator.GetIndexOperand(2), feedback_slot);
86 CHECK(!iterator.done()); 88 CHECK(!iterator.done());
87 iterator.Advance(); 89 iterator.Advance();
88 90
89 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); 91 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
90 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_2.index()); 92 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_2.index());
91 CHECK(!iterator.done()); 93 CHECK(!iterator.done());
92 iterator.Advance(); 94 iterator.Advance();
93 95
94 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime); 96 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime);
95 CHECK_EQ(static_cast<Runtime::FunctionId>(iterator.GetIndexOperand(0)), 97 CHECK_EQ(static_cast<Runtime::FunctionId>(iterator.GetIndexOperand(0)),
96 Runtime::kLoadIC_Miss); 98 Runtime::kLoadIC_Miss);
97 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index()); 99 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index());
98 CHECK_EQ(iterator.GetCountOperand(2), 1); 100 CHECK_EQ(iterator.GetCountOperand(2), 1);
99 CHECK(!iterator.done()); 101 CHECK(!iterator.done());
100 iterator.Advance(); 102 iterator.Advance();
101 103
102 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 104 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
103 CHECK(!iterator.done()); 105 CHECK(!iterator.done());
104 iterator.Advance(); 106 iterator.Advance();
105 CHECK(iterator.done()); 107 CHECK(iterator.done());
106 } 108 }
107 109
108 } // namespace interpreter 110 } // namespace interpreter
109 } // namespace internal 111 } // namespace internal
110 } // namespace v8 112 } // 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