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

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: Rebase. 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 factory->NewStringFromStaticChars("function_b"), MaybeHandle<Code>(), 238 factory->NewStringFromStaticChars("function_b"), MaybeHandle<Code>(),
239 false); 239 false);
240 builder.CreateClosure(shared_info2, NOT_TENURED); 240 builder.CreateClosure(shared_info2, NOT_TENURED);
241 241
242 // Emit wide variant of literal creation operations. 242 // Emit wide variant of literal creation operations.
243 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"), 243 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"),
244 0, 0) 244 0, 0)
245 .CreateArrayLiteral(factory->NewFixedArray(2), 0, 0) 245 .CreateArrayLiteral(factory->NewFixedArray(2), 0, 0)
246 .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0); 246 .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0);
247 247
248 // Longer jumps requiring ConstantWide operand
249 builder.Jump(&start).JumpIfNull(&start).JumpIfUndefined(&start);
250 // Perform an operation that returns boolean value to
251 // generate JumpIfTrue/False
252 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
253 .JumpIfTrue(&start)
254 .CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
255 .JumpIfFalse(&start);
256 // Perform an operation that returns a non-boolean operation to
257 // generate JumpIfToBooleanTrue/False.
258 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
259 .JumpIfTrue(&start)
260 .BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
261 .JumpIfFalse(&start);
262
248 builder.Return(); 263 builder.Return();
249 264
250 // Generate BytecodeArray. 265 // Generate BytecodeArray.
251 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); 266 Handle<BytecodeArray> the_array = builder.ToBytecodeArray();
252 CHECK_EQ(the_array->frame_size(), 267 CHECK_EQ(the_array->frame_size(),
253 builder.fixed_register_count() * kPointerSize); 268 builder.fixed_register_count() * kPointerSize);
254 269
255 // Build scorecard of bytecodes encountered in the BytecodeArray. 270 // Build scorecard of bytecodes encountered in the BytecodeArray.
256 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); 271 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1);
257 Bytecode final_bytecode = Bytecode::kLdaZero; 272 Bytecode final_bytecode = Bytecode::kLdaZero;
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 iterator.Advance(); 686 iterator.Advance();
672 CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); 687 CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump);
673 CHECK_EQ(iterator.GetImmediateOperand(0), -2); 688 CHECK_EQ(iterator.GetImmediateOperand(0), -2);
674 iterator.Advance(); 689 iterator.Advance();
675 } 690 }
676 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 691 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
677 iterator.Advance(); 692 iterator.Advance();
678 CHECK(iterator.done()); 693 CHECK(iterator.done());
679 } 694 }
680 695
696
681 } // namespace interpreter 697 } // namespace interpreter
682 } // namespace internal 698 } // namespace internal
683 } // namespace v8 699 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698