Removed the dependency of the test RunComputedCodeObject from RawMachineAssemblerTester.

R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1423923003

Cr-Commit-Position: refs/heads/master@{#31586}
This commit is contained in:
ahaas 2015-10-26 17:37:27 -07:00 committed by Commit bot
parent fa4f555373
commit 0abac748cd
2 changed files with 17 additions and 9 deletions

View File

@ -229,6 +229,11 @@ class GraphBuilderTester : public HandleAndZoneScope,
return MakeNode(op, value_input_count, value_inputs);
}
Handle<Code> GetCode() {
Generate();
return code_.ToHandleChecked();
}
protected:
Node* MakeNode(const Operator* op, int value_input_count,
Node** value_inputs) {

View File

@ -1,6 +1,6 @@
// 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.
// 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 <cmath>
#include <functional>
@ -11,6 +11,7 @@
#include "src/codegen.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/codegen-tester.h"
#include "test/cctest/compiler/graph-builder-tester.h"
#include "test/cctest/compiler/value-helper.h"
using namespace v8::base;
@ -5524,13 +5525,15 @@ TEST(RunBitcastInt32ToFloat32) {
TEST(RunComputedCodeObject) {
RawMachineAssemblerTester<int32_t> a;
GraphBuilderTester<int32_t> a;
a.Return(a.Int32Constant(33));
CHECK_EQ(33, a.Call());
a.End();
Handle<Code> code_a = a.GetCode();
RawMachineAssemblerTester<int32_t> b;
GraphBuilderTester<int32_t> b;
b.Return(b.Int32Constant(44));
CHECK_EQ(44, b.Call());
b.End();
Handle<Code> code_b = b.GetCode();
RawMachineAssemblerTester<int32_t> r(kMachInt32);
RawMachineAssembler::Label tlabel;
@ -5538,10 +5541,10 @@ TEST(RunComputedCodeObject) {
RawMachineAssembler::Label merge;
r.Branch(r.Parameter(0), &tlabel, &flabel);
r.Bind(&tlabel);
Node* fa = r.HeapConstant(a.GetCode());
Node* fa = r.HeapConstant(code_a);
r.Goto(&merge);
r.Bind(&flabel);
Node* fb = r.HeapConstant(b.GetCode());
Node* fb = r.HeapConstant(code_b);
r.Goto(&merge);
r.Bind(&merge);
Node* phi = r.Phi(kMachInt32, fa, fb);