Commit 42b2eb0e authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[parser] Move newly added cctest/test-parsing/LazyFunctionLength to unittests.

BUG=v8:5516

Change-Id: Ie2e41ffa82c63788e285641232a5d555155b0d13
Reviewed-on: https://chromium-review.googlesource.com/480239
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarJochen Eisinger <jochen@chromium.org>
Reviewed-by: 's avatarDaniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44689}
parent 245ab01a
......@@ -9,6 +9,8 @@
#include "src/globals.h"
#include "src/isolate.h"
#include "src/messages.h"
#include "src/objects/descriptor-array.h"
#include "src/objects/dictionary.h"
#include "src/objects/scope-info.h"
namespace v8 {
......
......@@ -6441,8 +6441,7 @@ class SharedFunctionInfo: public HeapObject {
class DisabledOptimizationReasonBits : public BitField<int, 22, 8> {};
private:
// For test-parsing.cc
friend class SharedFunctionInfoTestHelper;
FRIEND_TEST(PreParserTest, LazyFunctionLength);
inline int length() const;
......
......@@ -10161,40 +10161,3 @@ TEST(AsyncGeneratorErrors) {
RunParserSyncTest(context_data, statement_data, kError, NULL, 0, always_flags,
arraysize(always_flags));
}
namespace v8 {
namespace internal {
class SharedFunctionInfoTestHelper {
public:
static int length(Handle<SharedFunctionInfo> shared) {
return shared->length();
}
};
} // namespace internal
} // namespace v8
TEST(SharedFunctionInfoLength) {
i::Isolate* isolate = CcTest::i_isolate();
v8::Isolate* v8_isolate = CcTest::isolate();
i::HandleScope scope(isolate);
LocalContext env;
const char* script_source = "function lazy(a, b, c) { } lazy";
v8::Local<v8::Value> lazy = CompileRunChecked(v8_isolate, script_source);
i::Handle<i::Object> lazy_object = v8::Utils::OpenHandle(*lazy);
i::Handle<i::SharedFunctionInfo> shared(
i::Handle<i::JSFunction>::cast(lazy_object)->shared(), isolate);
CHECK_EQ(i::SharedFunctionInfoTestHelper::length(shared),
i::SharedFunctionInfo::kInvalidLength);
const char* get_length_source = "lazy.length";
v8::Local<v8::Value> length =
CompileRunChecked(v8_isolate, get_length_source);
CHECK(length->IsInt32());
CHECK_EQ(3, length->Int32Value(v8_isolate->GetCurrentContext()).FromJust());
}
......@@ -35,8 +35,6 @@ v8_executable("unittests") {
"base/utils/random-number-generator-unittest.cc",
"cancelable-tasks-unittest.cc",
"char-predicates-unittest.cc",
"compiler-dispatcher/compiler-dispatcher-helper.cc",
"compiler-dispatcher/compiler-dispatcher-helper.h",
"compiler-dispatcher/compiler-dispatcher-job-unittest.cc",
"compiler-dispatcher/compiler-dispatcher-tracer-unittest.cc",
"compiler-dispatcher/compiler-dispatcher-unittest.cc",
......@@ -131,9 +129,12 @@ v8_executable("unittests") {
"libplatform/worker-thread-unittest.cc",
"locked-queue-unittest.cc",
"object-unittest.cc",
"parser/preparser-unittest.cc",
"register-configuration-unittest.cc",
"run-all-unittests.cc",
"source-position-table-unittest.cc",
"test-helpers.cc",
"test-helpers.h",
"test-utils.cc",
"test-utils.h",
"unicode-unittest.cc",
......
......@@ -15,7 +15,7 @@
#include "src/isolate-inl.h"
#include "src/parsing/parse-info.h"
#include "src/v8.h"
#include "test/unittests/compiler-dispatcher/compiler-dispatcher-helper.h"
#include "test/unittests/test-helpers.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -18,7 +18,7 @@
#include "src/parsing/parse-info.h"
#include "src/parsing/parsing.h"
#include "src/v8.h"
#include "test/unittests/compiler-dispatcher/compiler-dispatcher-helper.h"
#include "test/unittests/test-helpers.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -12,7 +12,7 @@
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/parsing/parse-info.h"
#include "test/unittests/compiler-dispatcher/compiler-dispatcher-helper.h"
#include "test/unittests/test-helpers.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
......
// Copyright 2017 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/api.h"
#include "src/objects-inl.h"
#include "test/unittests/test-helpers.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 {
namespace internal {
class PreParserTest : public TestWithContext {
public:
PreParserTest() {}
private:
DISALLOW_COPY_AND_ASSIGN(PreParserTest);
};
TEST_F(PreParserTest, LazyFunctionLength) {
const char* script_source = "function lazy(a, b, c) { } lazy";
Handle<Object> lazy_object = test::RunJS(isolate(), script_source);
Handle<SharedFunctionInfo> shared(
Handle<JSFunction>::cast(lazy_object)->shared(), i_isolate());
CHECK_EQ(shared->length(), SharedFunctionInfo::kInvalidLength);
const char* get_length_source = "lazy.length";
Handle<Object> length = test::RunJS(isolate(), get_length_source);
CHECK(length->IsSmi());
int32_t value;
CHECK(length->ToInt32(&value));
CHECK_EQ(3, value);
}
} // namespace internal
} // namespace v8
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "test/unittests/compiler-dispatcher/compiler-dispatcher-helper.h"
#include "test/unittests/test-helpers.h"
#include "include/v8.h"
#include "src/api.h"
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_UNITTESTS_COMPILER_DISPATCHER_COMPILER_DISPATCHER_HELPER_H_
#define V8_UNITTESTS_COMPILER_DISPATCHER_COMPILER_DISPATCHER_HELPER_H_
#ifndef V8_UNITTESTS_TEST_HELPERS_H_
#define V8_UNITTESTS_TEST_HELPERS_H_
#include <memory>
......@@ -63,4 +63,4 @@ Handle<SharedFunctionInfo> CreateSharedFunctionInfo(
} // namespace internal
} // namespace v8
#endif // V8_UNITTESTS_COMPILER_DISPATCHER_COMPILER_DISPATCHER_HELPER_H_
#endif // V8_UNITTESTS_TEST_HELPERS_H_
......@@ -89,8 +89,6 @@
'compiler/typer-unittest.cc',
'compiler/value-numbering-reducer-unittest.cc',
'compiler/zone-stats-unittest.cc',
'compiler-dispatcher/compiler-dispatcher-helper.cc',
'compiler-dispatcher/compiler-dispatcher-helper.h',
'compiler-dispatcher/compiler-dispatcher-job-unittest.cc',
'compiler-dispatcher/compiler-dispatcher-tracer-unittest.cc',
'compiler-dispatcher/compiler-dispatcher-unittest.cc',
......@@ -98,6 +96,17 @@
'counters-unittest.cc',
'eh-frame-iterator-unittest.cc',
'eh-frame-writer-unittest.cc',
'heap/bitmap-unittest.cc',
'heap/embedder-tracing-unittest.cc',
'heap/gc-idle-time-handler-unittest.cc',
'heap/gc-tracer-unittest.cc',
'heap/marking-unittest.cc',
'heap/memory-reducer-unittest.cc',
'heap/heap-unittest.cc',
'heap/scavenge-job-unittest.cc',
'heap/slot-set-unittest.cc',
'heap/spaces-unittest.cc',
'heap/unmapper-unittest.cc',
'interpreter/bytecodes-unittest.cc',
'interpreter/bytecode-array-builder-unittest.cc',
'interpreter/bytecode-array-iterator-unittest.cc',
......@@ -116,22 +125,14 @@
'libplatform/default-platform-unittest.cc',
'libplatform/task-queue-unittest.cc',
'libplatform/worker-thread-unittest.cc',
'heap/bitmap-unittest.cc',
'heap/embedder-tracing-unittest.cc',
'heap/gc-idle-time-handler-unittest.cc',
'heap/gc-tracer-unittest.cc',
'heap/marking-unittest.cc',
'heap/memory-reducer-unittest.cc',
'heap/heap-unittest.cc',
'heap/scavenge-job-unittest.cc',
'heap/slot-set-unittest.cc',
'heap/spaces-unittest.cc',
'heap/unmapper-unittest.cc',
'locked-queue-unittest.cc',
'object-unittest.cc',
'parser/preparser-unittest.cc',
'register-configuration-unittest.cc',
'run-all-unittests.cc',
'source-position-table-unittest.cc',
'test-helpers.cc',
'test-helpers.h',
'test-utils.h',
'test-utils.cc',
'unicode-unittest.cc',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment