Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
FPIIM-449
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/test/unittests/interpreter/bytecode-register-allocator-unittest.cc b/test/unittests/interpreter/bytecode-register-allocator-unittest.cc
new file mode 100644
index 0000000..0620322
--- /dev/null
+++ b/test/unittests/interpreter/bytecode-register-allocator-unittest.cc
@@ -0,0 +1,67 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/v8.h"
+
+#include "src/interpreter/bytecode-array-builder.h"
+#include "src/interpreter/bytecode-register-allocator.h"
+#include "test/unittests/test-utils.h"
+
+namespace v8 {
+namespace internal {
+namespace interpreter {
+
+class BytecodeRegisterAllocatorTest : public TestWithIsolateAndZone {
+ public:
+ BytecodeRegisterAllocatorTest() {}
+ ~BytecodeRegisterAllocatorTest() override {}
+};
+
+
+TEST_F(BytecodeRegisterAllocatorTest, TemporariesRecycled) {
+ BytecodeArrayBuilder builder(isolate(), zone());
+ builder.set_parameter_count(0);
+ builder.set_locals_count(0);
+ builder.set_context_count(0);
+
+ int first;
+ {
+ BytecodeRegisterAllocator temporaries(&builder);
+ first = temporaries.NewRegister().index();
+ temporaries.NewRegister();
+ temporaries.NewRegister();
+ temporaries.NewRegister();
+ }
+
+ int second;
+ {
+ BytecodeRegisterAllocator temporaries(&builder);
+ second = temporaries.NewRegister().index();
+ }
+
+ CHECK_EQ(first, second);
+}
+
+
+TEST_F(BytecodeRegisterAllocatorTest, ConsecutiveRegisters) {
+ BytecodeArrayBuilder builder(isolate(), zone());
+ builder.set_parameter_count(0);
+ builder.set_locals_count(0);
+ builder.set_context_count(0);
+
+ BytecodeRegisterAllocator temporaries(&builder);
+ temporaries.PrepareForConsecutiveAllocations(4);
+ Register reg0 = temporaries.NextConsecutiveRegister();
+ Register other = temporaries.NewRegister();
+ Register reg1 = temporaries.NextConsecutiveRegister();
+ Register reg2 = temporaries.NextConsecutiveRegister();
+ Register reg3 = temporaries.NextConsecutiveRegister();
+ USE(other);
+
+ CHECK(Register::AreContiguous(reg0, reg1, reg2, reg3));
+}
+
+} // namespace interpreter
+} // namespace internal
+} // namespace v8