| Index: test/unittests/compiler/js-typed-lowering-unittest.cc
|
| diff --git a/test/unittests/compiler/js-typed-lowering-unittest.cc b/test/unittests/compiler/js-typed-lowering-unittest.cc
|
| index acf2d678bee45d76af65786680079fc35fe36f25..31abcfeabd5ebc90741aef56c9607dd0f20b7875 100644
|
| --- a/test/unittests/compiler/js-typed-lowering-unittest.cc
|
| +++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
|
| @@ -92,18 +92,6 @@ class JSTypedLoweringTest : public TypedGraphTest {
|
| return reducer.Reduce(node);
|
| }
|
|
|
| - Node* FrameState(Handle<SharedFunctionInfo> shared, Node* outer_frame_state) {
|
| - Node* state_values = graph()->NewNode(common()->StateValues(0));
|
| - return graph()->NewNode(
|
| - common()->FrameState(BailoutId::None(),
|
| - OutputFrameStateCombine::Ignore(),
|
| - common()->CreateFrameStateFunctionInfo(
|
| - FrameStateType::kJavaScriptFunction, 1, 0,
|
| - shared, CALL_MAINTAINS_NATIVE_CONTEXT)),
|
| - state_values, state_values, state_values, NumberConstant(0),
|
| - UndefinedConstant(), outer_frame_state);
|
| - }
|
| -
|
| Handle<JSArrayBuffer> NewArrayBuffer(void* bytes, size_t byte_length) {
|
| Handle<JSArrayBuffer> buffer = factory()->NewJSArrayBuffer();
|
| JSArrayBuffer::Setup(buffer, isolate(), true, bytes, byte_length);
|
| @@ -908,196 +896,6 @@ TEST_F(JSTypedLoweringTest, JSAddWithString) {
|
|
|
|
|
| // -----------------------------------------------------------------------------
|
| -// JSCreate
|
| -
|
| -
|
| -TEST_F(JSTypedLoweringTest, JSCreate) {
|
| - Handle<JSFunction> function = isolate()->object_function();
|
| - Node* const target = Parameter(Type::Constant(function, graph()->zone()));
|
| - Node* const context = Parameter(Type::Any());
|
| - Node* const effect = graph()->start();
|
| - Reduction r = Reduce(graph()->NewNode(javascript()->Create(), target, target,
|
| - context, EmptyFrameState(), effect));
|
| - ASSERT_TRUE(r.Changed());
|
| - EXPECT_THAT(
|
| - r.replacement(),
|
| - IsFinishRegion(
|
| - IsAllocate(IsNumberConstant(function->initial_map()->instance_size()),
|
| - IsBeginRegion(effect), _),
|
| - _));
|
| -}
|
| -
|
| -
|
| -// -----------------------------------------------------------------------------
|
| -// JSCreateArguments
|
| -
|
| -
|
| -TEST_F(JSTypedLoweringTest, JSCreateArgumentsViaStub) {
|
| - Node* const closure = Parameter(Type::Any());
|
| - Node* const context = UndefinedConstant();
|
| - Node* const effect = graph()->start();
|
| - Node* const control = graph()->start();
|
| - Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
|
| - Node* const frame_state = FrameState(shared, graph()->start());
|
| - Reduction r = Reduce(
|
| - graph()->NewNode(javascript()->CreateArguments(
|
| - CreateArgumentsType::kMappedArguments),
|
| - closure, context, frame_state, effect, control));
|
| - ASSERT_TRUE(r.Changed());
|
| - EXPECT_THAT(r.replacement(),
|
| - IsCall(_, IsHeapConstant(CodeFactory::ArgumentsAccess(
|
| - isolate(), false, false)
|
| - .code()),
|
| - closure, IsNumberConstant(0), _, effect, control));
|
| -}
|
| -
|
| -
|
| -TEST_F(JSTypedLoweringTest, JSCreateArgumentsRestParameterViaStub) {
|
| - Node* const closure = Parameter(Type::Any());
|
| - Node* const context = UndefinedConstant();
|
| - Node* const effect = graph()->start();
|
| - Node* const control = graph()->start();
|
| - Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
|
| - Node* const frame_state = FrameState(shared, graph()->start());
|
| - Reduction r = Reduce(graph()->NewNode(
|
| - javascript()->CreateArguments(CreateArgumentsType::kRestParameter),
|
| - closure, context, frame_state, effect, control));
|
| - ASSERT_TRUE(r.Changed());
|
| - EXPECT_THAT(
|
| - r.replacement(),
|
| - IsCall(_, IsHeapConstant(
|
| - CodeFactory::FastNewRestParameter(isolate()).code()),
|
| - closure, context, frame_state, effect, control));
|
| -}
|
| -
|
| -
|
| -TEST_F(JSTypedLoweringTest, JSCreateArgumentsInlinedMapped) {
|
| - Node* const closure = Parameter(Type::Any());
|
| - Node* const context = UndefinedConstant();
|
| - Node* const effect = graph()->start();
|
| - Node* const control = graph()->start();
|
| - Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
|
| - Node* const frame_state_outer = FrameState(shared, graph()->start());
|
| - Node* const frame_state_inner = FrameState(shared, frame_state_outer);
|
| - Reduction r = Reduce(
|
| - graph()->NewNode(javascript()->CreateArguments(
|
| - CreateArgumentsType::kMappedArguments),
|
| - closure, context, frame_state_inner, effect, control));
|
| - ASSERT_TRUE(r.Changed());
|
| - EXPECT_THAT(r.replacement(),
|
| - IsFinishRegion(
|
| - IsAllocate(IsNumberConstant(Heap::kSloppyArgumentsObjectSize),
|
| - _, control),
|
| - _));
|
| -}
|
| -
|
| -
|
| -TEST_F(JSTypedLoweringTest, JSCreateArgumentsInlinedUnmapped) {
|
| - Node* const closure = Parameter(Type::Any());
|
| - Node* const context = UndefinedConstant();
|
| - Node* const effect = graph()->start();
|
| - Node* const control = graph()->start();
|
| - Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
|
| - Node* const frame_state_outer = FrameState(shared, graph()->start());
|
| - Node* const frame_state_inner = FrameState(shared, frame_state_outer);
|
| - Reduction r = Reduce(
|
| - graph()->NewNode(javascript()->CreateArguments(
|
| - CreateArgumentsType::kUnmappedArguments),
|
| - closure, context, frame_state_inner, effect, control));
|
| - ASSERT_TRUE(r.Changed());
|
| - EXPECT_THAT(r.replacement(),
|
| - IsFinishRegion(
|
| - IsAllocate(IsNumberConstant(Heap::kStrictArgumentsObjectSize),
|
| - _, control),
|
| - _));
|
| -}
|
| -
|
| -
|
| -TEST_F(JSTypedLoweringTest, JSCreateArgumentsInlinedRestArray) {
|
| - Node* const closure = Parameter(Type::Any());
|
| - Node* const context = UndefinedConstant();
|
| - Node* const effect = graph()->start();
|
| - Node* const control = graph()->start();
|
| - Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
|
| - Node* const frame_state_outer = FrameState(shared, graph()->start());
|
| - Node* const frame_state_inner = FrameState(shared, frame_state_outer);
|
| - Reduction r = Reduce(graph()->NewNode(
|
| - javascript()->CreateArguments(CreateArgumentsType::kRestParameter),
|
| - closure, context, frame_state_inner, effect, control));
|
| - ASSERT_TRUE(r.Changed());
|
| - EXPECT_THAT(r.replacement(),
|
| - IsFinishRegion(
|
| - IsAllocate(IsNumberConstant(JSArray::kSize), _, control), _));
|
| -}
|
| -
|
| -
|
| -// -----------------------------------------------------------------------------
|
| -// JSCreateFunctionContext
|
| -
|
| -
|
| -TEST_F(JSTypedLoweringTest, JSCreateFunctionContextViaInlinedAllocation) {
|
| - Node* const closure = Parameter(Type::Any());
|
| - Node* const context = Parameter(Type::Any());
|
| - Node* const effect = graph()->start();
|
| - Node* const control = graph()->start();
|
| - Reduction const r =
|
| - Reduce(graph()->NewNode(javascript()->CreateFunctionContext(8), closure,
|
| - context, effect, control));
|
| - ASSERT_TRUE(r.Changed());
|
| - EXPECT_THAT(r.replacement(),
|
| - IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor(
|
| - 8 + Context::MIN_CONTEXT_SLOTS)),
|
| - IsBeginRegion(_), control),
|
| - _));
|
| -}
|
| -
|
| -
|
| -// -----------------------------------------------------------------------------
|
| -// JSCreateWithContext
|
| -
|
| -
|
| -TEST_F(JSTypedLoweringTest, JSCreateWithContext) {
|
| - Node* const object = Parameter(Type::Receiver());
|
| - Node* const closure = Parameter(Type::Function());
|
| - Node* const context = Parameter(Type::Any());
|
| - Node* const effect = graph()->start();
|
| - Node* const control = graph()->start();
|
| - Reduction r =
|
| - Reduce(graph()->NewNode(javascript()->CreateWithContext(), object,
|
| - closure, context, effect, control));
|
| - ASSERT_TRUE(r.Changed());
|
| - EXPECT_THAT(r.replacement(),
|
| - IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor(
|
| - Context::MIN_CONTEXT_SLOTS)),
|
| - IsBeginRegion(_), control),
|
| - _));
|
| -}
|
| -
|
| -
|
| -// -----------------------------------------------------------------------------
|
| -// JSCreateCatchContext
|
| -
|
| -
|
| -TEST_F(JSTypedLoweringTest, JSCreateCatchContext) {
|
| - Handle<String> name = factory()->length_string();
|
| - Node* const exception = Parameter(Type::Receiver());
|
| - Node* const closure = Parameter(Type::Function());
|
| - Node* const context = Parameter(Type::Any());
|
| - Node* const effect = graph()->start();
|
| - Node* const control = graph()->start();
|
| - Reduction r =
|
| - Reduce(graph()->NewNode(javascript()->CreateCatchContext(name), exception,
|
| - closure, context, effect, control));
|
| - ASSERT_TRUE(r.Changed());
|
| - EXPECT_THAT(r.replacement(),
|
| - IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor(
|
| - Context::MIN_CONTEXT_SLOTS + 1)),
|
| - IsBeginRegion(_), control),
|
| - _));
|
| -}
|
| -
|
| -
|
| -// -----------------------------------------------------------------------------
|
| // JSInstanceOf
|
| // Test that instanceOf is reduced if and only if the right-hand side is a
|
| // function constant. Functional correctness is ensured elsewhere.
|
|
|