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

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

Issue 1546683002: [Interpreter] Add support for jumps using constants with wide operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate comments on patchset 13. Created 4 years, 11 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
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 "test/unittests/test-utils.h" 9 #include "test/unittests/test-utils.h"
10 10
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 factory->NewStringFromStaticChars("function_b"), MaybeHandle<Code>(), 245 factory->NewStringFromStaticChars("function_b"), MaybeHandle<Code>(),
246 false); 246 false);
247 builder.CreateClosure(shared_info2, NOT_TENURED); 247 builder.CreateClosure(shared_info2, NOT_TENURED);
248 248
249 // Emit wide variant of literal creation operations. 249 // Emit wide variant of literal creation operations.
250 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"), 250 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"),
251 0, 0) 251 0, 0)
252 .CreateArrayLiteral(factory->NewFixedArray(2), 0, 0) 252 .CreateArrayLiteral(factory->NewFixedArray(2), 0, 0)
253 .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0); 253 .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0);
254 254
255 // Longer jumps requiring ConstantWide operand
256 builder.Jump(&start).JumpIfNull(&start).JumpIfUndefined(&start);
257 // Perform an operation that returns boolean value to
258 // generate JumpIfTrue/False
259 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
260 .JumpIfTrue(&start)
261 .CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
262 .JumpIfFalse(&start);
263 // Perform an operation that returns a non-boolean operation to
264 // generate JumpIfToBooleanTrue/False.
265 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
266 .JumpIfTrue(&start)
267 .BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
268 .JumpIfFalse(&start);
269
255 builder.Return(); 270 builder.Return();
256 271
257 // Generate BytecodeArray. 272 // Generate BytecodeArray.
258 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); 273 Handle<BytecodeArray> the_array = builder.ToBytecodeArray();
259 CHECK_EQ(the_array->frame_size(), 274 CHECK_EQ(the_array->frame_size(),
260 builder.fixed_register_count() * kPointerSize); 275 builder.fixed_register_count() * kPointerSize);
261 276
262 // Build scorecard of bytecodes encountered in the BytecodeArray. 277 // Build scorecard of bytecodes encountered in the BytecodeArray.
263 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); 278 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1);
264 Bytecode final_bytecode = Bytecode::kLdaZero; 279 Bytecode final_bytecode = Bytecode::kLdaZero;
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 iterator.Advance(); 693 iterator.Advance();
679 CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); 694 CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump);
680 CHECK_EQ(iterator.GetImmediateOperand(0), -2); 695 CHECK_EQ(iterator.GetImmediateOperand(0), -2);
681 iterator.Advance(); 696 iterator.Advance();
682 } 697 }
683 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 698 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
684 iterator.Advance(); 699 iterator.Advance();
685 CHECK(iterator.done()); 700 CHECK(iterator.done());
686 } 701 }
687 702
703
688 } // namespace interpreter 704 } // namespace interpreter
689 } // namespace internal 705 } // namespace internal
690 } // namespace v8 706 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | test/unittests/interpreter/constant-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698