v8/test/unittests/compiler/js-native-context-specialization-unittest.cc
Yang Guo 7bbd0bfe51 Move number related files to src/numbers
R=bmeurer@chromium.org, clemensh@chromium.org, jkummerow@chromium.org, sigurds@chromium.org, ulan@chromium.org, verwaest@chromium.org

Bug: v8:9247
Change-Id: I153a6bbfc55989fe7a86c052f95c5cb8ee61e841
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1613244
Commit-Queue: Yang Guo <yangguo@chromium.org>
Auto-Submit: Yang Guo <yangguo@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61557}
2019-05-15 19:34:44 +00:00

51 lines
1.6 KiB
C++

// 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/numbers/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(broker(), str_node),
str_len);
Node* const num_node = graph()->NewNode(common()->NumberConstant(10.0 / 3));
EXPECT_EQ(
JSNativeContextSpecialization::GetMaxStringLength(broker(), num_node),
num_len);
}
} // namespace js_native_context_specialization_unittest
} // namespace compiler
} // namespace internal
} // namespace v8