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

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

Issue 2581683003: Introduce {ConstantElementsPair} struct for type safety. (Closed)
Patch Set: Re-cemment bytecode tests. Created 4 years 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
OLDNEW
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-label.h" 9 #include "src/interpreter/bytecode-label.h"
10 #include "src/interpreter/bytecode-register-allocator.h" 10 #include "src/interpreter/bytecode-register-allocator.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 builder.CreateClosure(0, NOT_TENURED); 118 builder.CreateClosure(0, NOT_TENURED);
119 119
120 // Emit create context operation. 120 // Emit create context operation.
121 builder.CreateBlockContext(factory->NewScopeInfo(1)); 121 builder.CreateBlockContext(factory->NewScopeInfo(1));
122 builder.CreateCatchContext(reg, name, factory->NewScopeInfo(1)); 122 builder.CreateCatchContext(reg, name, factory->NewScopeInfo(1));
123 builder.CreateFunctionContext(1); 123 builder.CreateFunctionContext(1);
124 builder.CreateWithContext(reg, factory->NewScopeInfo(1)); 124 builder.CreateWithContext(reg, factory->NewScopeInfo(1));
125 125
126 // Emit literal creation operations. 126 // Emit literal creation operations.
127 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("a"), 0, 0) 127 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("a"), 0, 0)
128 .CreateArrayLiteral(factory->NewFixedArray(1), 0, 0) 128 .CreateArrayLiteral(factory->NewConstantElementsPair(
129 FAST_ELEMENTS, factory->empty_fixed_array()),
130 0, 0)
129 .CreateObjectLiteral(factory->NewFixedArray(1), 0, 0, reg); 131 .CreateObjectLiteral(factory->NewFixedArray(1), 0, 0, reg);
130 132
131 // Call operations. 133 // Call operations.
132 builder.Call(reg, reg_list, 1, Call::GLOBAL_CALL) 134 builder.Call(reg, reg_list, 1, Call::GLOBAL_CALL)
133 .Call(reg, reg_list, 1, Call::NAMED_PROPERTY_CALL, 135 .Call(reg, reg_list, 1, Call::NAMED_PROPERTY_CALL,
134 TailCallMode::kDisallow) 136 TailCallMode::kDisallow)
135 .Call(reg, reg_list, 1, Call::GLOBAL_CALL, TailCallMode::kAllow) 137 .Call(reg, reg_list, 1, Call::GLOBAL_CALL, TailCallMode::kAllow)
136 .CallRuntime(Runtime::kIsArray, reg) 138 .CallRuntime(Runtime::kIsArray, reg)
137 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg_list, pair) 139 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg_list, pair)
138 .CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, reg_list) 140 .CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, reg_list)
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // Emit wide load / store lookup slots. 324 // Emit wide load / store lookup slots.
323 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF) 325 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF)
324 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF) 326 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF)
325 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY) 327 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY)
326 .StoreLookupSlot(wide_name, LanguageMode::STRICT); 328 .StoreLookupSlot(wide_name, LanguageMode::STRICT);
327 329
328 // CreateClosureWide 330 // CreateClosureWide
329 builder.CreateClosure(1000, NOT_TENURED); 331 builder.CreateClosure(1000, NOT_TENURED);
330 332
331 // Emit wide variant of literal creation operations. 333 // Emit wide variant of literal creation operations.
332 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"), 334 builder
333 0, 0) 335 .CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"), 0,
334 .CreateArrayLiteral(factory->NewFixedArray(2), 0, 0) 336 0)
337 .CreateArrayLiteral(factory->NewConstantElementsPair(
338 FAST_ELEMENTS, factory->empty_fixed_array()),
339 0, 0)
335 .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0, reg); 340 .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0, reg);
336 341
337 // Emit load and store operations for module variables. 342 // Emit load and store operations for module variables.
338 builder.LoadModuleVariable(-1, 42) 343 builder.LoadModuleVariable(-1, 42)
339 .LoadModuleVariable(0, 42) 344 .LoadModuleVariable(0, 42)
340 .LoadModuleVariable(1, 42) 345 .LoadModuleVariable(1, 42)
341 .StoreModuleVariable(-1, 42) 346 .StoreModuleVariable(-1, 42)
342 .StoreModuleVariable(0, 42) 347 .StoreModuleVariable(0, 42)
343 .StoreModuleVariable(1, 42); 348 .StoreModuleVariable(1, 42);
344 349
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 iterator.Advance(); 748 iterator.Advance();
744 } 749 }
745 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 750 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
746 iterator.Advance(); 751 iterator.Advance();
747 CHECK(iterator.done()); 752 CHECK(iterator.done());
748 } 753 }
749 754
750 } // namespace interpreter 755 } // namespace interpreter
751 } // namespace internal 756 } // namespace internal
752 } // namespace v8 757 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698