summaryrefslogtreecommitdiff
path: root/deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-12-04 08:20:37 +0100
committerMichaël Zasso <targos@protonmail.com>2018-12-06 15:23:33 +0100
commit9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3 (patch)
tree2b0c843168dafb939d8df8a15b2aa72b76dee51d /deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc
parentb8fbe69db1292307adb2c2b2e0d5ef48c4ab2faf (diff)
downloadandroid-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.tar.gz
android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.tar.bz2
android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.zip
deps: update V8 to 7.1.302.28
PR-URL: https://github.com/nodejs/node/pull/23423 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc')
-rw-r--r--deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc b/deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc
new file mode 100644
index 0000000000..fdc87904c4
--- /dev/null
+++ b/deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc
@@ -0,0 +1,50 @@
+// 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 "test/unittests/compiler/graph-unittest.h"
+
+#include "src/compiler/js-native-context-specialization.h"
+#include "src/compiler/js-operator.h"
+#include "src/compiler/machine-operator.h"
+#include "src/compiler/simplified-operator.h"
+#include "src/dtoa.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+namespace js_native_context_specialization_unittest {
+
+class JSNativeContextSpecializationTest : public GraphTest {
+ public:
+ explicit JSNativeContextSpecializationTest(int num_parameters = 1)
+ : GraphTest(num_parameters), javascript_(zone()) {}
+ ~JSNativeContextSpecializationTest() override {}
+
+ protected:
+ JSOperatorBuilder* javascript() { return &javascript_; }
+
+ private:
+ JSOperatorBuilder javascript_;
+};
+
+TEST_F(JSNativeContextSpecializationTest, GetMaxStringLengthOfString) {
+ const size_t str_len = 3;
+ const size_t num_len = kBase10MaximalLength + 1;
+
+ Node* const str_node = graph()->NewNode(
+ common()->HeapConstant(factory()->InternalizeUtf8String("str")));
+ EXPECT_EQ(JSNativeContextSpecialization::GetMaxStringLength(js_heap_broker(),
+ str_node),
+ str_len);
+
+ Node* const num_node = graph()->NewNode(common()->NumberConstant(10.0 / 3));
+ EXPECT_EQ(JSNativeContextSpecialization::GetMaxStringLength(js_heap_broker(),
+ num_node),
+ num_len);
+}
+
+} // namespace js_native_context_specialization_unittest
+} // namespace compiler
+} // namespace internal
+} // namespace v8