mirror of https://github.com/lukechilds/node.git
Browse Source
The 3.28.73 update was technically unstable code. This reverts the code to the latest 3.28 stable release. Reviewed-By: Trevor Norris <trev.norris@gmail.com> PR-URL: https://github.com/joyent/node/pull/18206v0.12.3-release
committed by
Julien Gilli
94 changed files with 3530 additions and 2018 deletions
@ -1,260 +0,0 @@ |
|||
// 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 "src/compiler/change-lowering.h" |
|||
|
|||
#include "src/compiler/common-node-cache.h" |
|||
#include "src/compiler/graph.h" |
|||
|
|||
namespace v8 { |
|||
namespace internal { |
|||
namespace compiler { |
|||
|
|||
ChangeLoweringBase::ChangeLoweringBase(Graph* graph, Linkage* linkage, |
|||
CommonNodeCache* cache) |
|||
: graph_(graph), |
|||
isolate_(graph->zone()->isolate()), |
|||
linkage_(linkage), |
|||
cache_(cache), |
|||
common_(graph->zone()), |
|||
machine_(graph->zone()) {} |
|||
|
|||
|
|||
ChangeLoweringBase::~ChangeLoweringBase() {} |
|||
|
|||
|
|||
Node* ChangeLoweringBase::ExternalConstant(ExternalReference reference) { |
|||
Node** loc = cache()->FindExternalConstant(reference); |
|||
if (*loc == NULL) { |
|||
*loc = graph()->NewNode(common()->ExternalConstant(reference)); |
|||
} |
|||
return *loc; |
|||
} |
|||
|
|||
|
|||
Node* ChangeLoweringBase::HeapConstant(PrintableUnique<HeapObject> value) { |
|||
// TODO(bmeurer): Use common node cache.
|
|||
return graph()->NewNode(common()->HeapConstant(value)); |
|||
} |
|||
|
|||
|
|||
Node* ChangeLoweringBase::ImmovableHeapConstant(Handle<HeapObject> value) { |
|||
return HeapConstant( |
|||
PrintableUnique<HeapObject>::CreateImmovable(graph()->zone(), value)); |
|||
} |
|||
|
|||
|
|||
Node* ChangeLoweringBase::Int32Constant(int32_t value) { |
|||
Node** loc = cache()->FindInt32Constant(value); |
|||
if (*loc == NULL) { |
|||
*loc = graph()->NewNode(common()->Int32Constant(value)); |
|||
} |
|||
return *loc; |
|||
} |
|||
|
|||
|
|||
Node* ChangeLoweringBase::NumberConstant(double value) { |
|||
Node** loc = cache()->FindNumberConstant(value); |
|||
if (*loc == NULL) { |
|||
*loc = graph()->NewNode(common()->NumberConstant(value)); |
|||
} |
|||
return *loc; |
|||
} |
|||
|
|||
|
|||
Node* ChangeLoweringBase::CEntryStubConstant() { |
|||
if (!c_entry_stub_constant_.is_set()) { |
|||
c_entry_stub_constant_.set( |
|||
ImmovableHeapConstant(CEntryStub(isolate(), 1).GetCode())); |
|||
} |
|||
return c_entry_stub_constant_.get(); |
|||
} |
|||
|
|||
|
|||
Node* ChangeLoweringBase::TrueConstant() { |
|||
if (!true_constant_.is_set()) { |
|||
true_constant_.set( |
|||
ImmovableHeapConstant(isolate()->factory()->true_value())); |
|||
} |
|||
return true_constant_.get(); |
|||
} |
|||
|
|||
|
|||
Node* ChangeLoweringBase::FalseConstant() { |
|||
if (!false_constant_.is_set()) { |
|||
false_constant_.set( |
|||
ImmovableHeapConstant(isolate()->factory()->false_value())); |
|||
} |
|||
return false_constant_.get(); |
|||
} |
|||
|
|||
|
|||
Reduction ChangeLoweringBase::ChangeBitToBool(Node* val, Node* control) { |
|||
Node* branch = graph()->NewNode(common()->Branch(), val, control); |
|||
|
|||
Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
|||
Node* true_value = TrueConstant(); |
|||
|
|||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
|||
Node* false_value = FalseConstant(); |
|||
|
|||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); |
|||
Node* phi = |
|||
graph()->NewNode(common()->Phi(2), true_value, false_value, merge); |
|||
|
|||
return Replace(phi); |
|||
} |
|||
|
|||
|
|||
template <size_t kPointerSize> |
|||
ChangeLowering<kPointerSize>::ChangeLowering(Graph* graph, Linkage* linkage) |
|||
: ChangeLoweringBase(graph, linkage, |
|||
new (graph->zone()) CommonNodeCache(graph->zone())) {} |
|||
|
|||
|
|||
template <size_t kPointerSize> |
|||
Reduction ChangeLowering<kPointerSize>::Reduce(Node* node) { |
|||
Node* control = graph()->start(); |
|||
Node* effect = control; |
|||
switch (node->opcode()) { |
|||
case IrOpcode::kChangeBitToBool: |
|||
return ChangeBitToBool(node->InputAt(0), control); |
|||
case IrOpcode::kChangeBoolToBit: |
|||
return ChangeBoolToBit(node->InputAt(0)); |
|||
case IrOpcode::kChangeInt32ToTagged: |
|||
return ChangeInt32ToTagged(node->InputAt(0), effect, control); |
|||
case IrOpcode::kChangeTaggedToFloat64: |
|||
return ChangeTaggedToFloat64(node->InputAt(0), effect, control); |
|||
default: |
|||
return NoChange(); |
|||
} |
|||
UNREACHABLE(); |
|||
return NoChange(); |
|||
} |
|||
|
|||
|
|||
template <> |
|||
Reduction ChangeLowering<4>::ChangeBoolToBit(Node* val) { |
|||
return Replace( |
|||
graph()->NewNode(machine()->Word32Equal(), val, TrueConstant())); |
|||
} |
|||
|
|||
|
|||
template <> |
|||
Reduction ChangeLowering<8>::ChangeBoolToBit(Node* val) { |
|||
return Replace( |
|||
graph()->NewNode(machine()->Word64Equal(), val, TrueConstant())); |
|||
} |
|||
|
|||
|
|||
template <> |
|||
Reduction ChangeLowering<4>::ChangeInt32ToTagged(Node* val, Node* effect, |
|||
Node* control) { |
|||
Node* context = NumberConstant(0); |
|||
|
|||
Node* add = graph()->NewNode(machine()->Int32AddWithOverflow(), val, val); |
|||
Node* ovf = graph()->NewNode(common()->Projection(1), add); |
|||
|
|||
Node* branch = graph()->NewNode(common()->Branch(), ovf, control); |
|||
|
|||
Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
|||
Node* number = graph()->NewNode(machine()->ChangeInt32ToFloat64(), val); |
|||
|
|||
// TODO(bmeurer): Inline allocation if possible.
|
|||
const Runtime::Function* fn = |
|||
Runtime::FunctionForId(Runtime::kAllocateHeapNumber); |
|||
DCHECK_EQ(0, fn->nargs); |
|||
CallDescriptor* desc = linkage()->GetRuntimeCallDescriptor( |
|||
fn->function_id, 0, Operator::kNoProperties); |
|||
Node* heap_number = |
|||
graph()->NewNode(common()->Call(desc), CEntryStubConstant(), |
|||
ExternalConstant(ExternalReference(fn, isolate())), |
|||
Int32Constant(0), context, effect, if_true); |
|||
|
|||
Node* store = graph()->NewNode( |
|||
machine()->Store(kMachineFloat64, kNoWriteBarrier), heap_number, |
|||
Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), number, effect, |
|||
heap_number); |
|||
|
|||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
|||
Node* smi = graph()->NewNode(common()->Projection(0), add); |
|||
|
|||
Node* merge = graph()->NewNode(common()->Merge(2), store, if_false); |
|||
Node* phi = graph()->NewNode(common()->Phi(2), heap_number, smi, merge); |
|||
|
|||
return Replace(phi); |
|||
} |
|||
|
|||
|
|||
template <> |
|||
Reduction ChangeLowering<8>::ChangeInt32ToTagged(Node* val, Node* effect, |
|||
Node* control) { |
|||
return Replace(graph()->NewNode( |
|||
machine()->Word64Shl(), val, |
|||
Int32Constant(SmiTagging<8>::kSmiShiftSize + kSmiTagSize))); |
|||
} |
|||
|
|||
|
|||
template <> |
|||
Reduction ChangeLowering<4>::ChangeTaggedToFloat64(Node* val, Node* effect, |
|||
Node* control) { |
|||
Node* branch = graph()->NewNode( |
|||
common()->Branch(), |
|||
graph()->NewNode(machine()->Word32And(), val, Int32Constant(kSmiTagMask)), |
|||
control); |
|||
|
|||
Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
|||
Node* load = graph()->NewNode( |
|||
machine()->Load(kMachineFloat64), val, |
|||
Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), if_true); |
|||
|
|||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
|||
Node* number = graph()->NewNode( |
|||
machine()->ChangeInt32ToFloat64(), |
|||
graph()->NewNode( |
|||
machine()->Word32Sar(), val, |
|||
Int32Constant(SmiTagging<4>::kSmiShiftSize + kSmiTagSize))); |
|||
|
|||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); |
|||
Node* phi = graph()->NewNode(common()->Phi(2), load, number, merge); |
|||
|
|||
return Replace(phi); |
|||
} |
|||
|
|||
|
|||
template <> |
|||
Reduction ChangeLowering<8>::ChangeTaggedToFloat64(Node* val, Node* effect, |
|||
Node* control) { |
|||
Node* branch = graph()->NewNode( |
|||
common()->Branch(), |
|||
graph()->NewNode(machine()->Word64And(), val, Int32Constant(kSmiTagMask)), |
|||
control); |
|||
|
|||
Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
|||
Node* load = graph()->NewNode( |
|||
machine()->Load(kMachineFloat64), val, |
|||
Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), if_true); |
|||
|
|||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
|||
Node* number = graph()->NewNode( |
|||
machine()->ChangeInt32ToFloat64(), |
|||
graph()->NewNode( |
|||
machine()->ConvertInt64ToInt32(), |
|||
graph()->NewNode( |
|||
machine()->Word64Sar(), val, |
|||
Int32Constant(SmiTagging<8>::kSmiShiftSize + kSmiTagSize)))); |
|||
|
|||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); |
|||
Node* phi = graph()->NewNode(common()->Phi(2), load, number, merge); |
|||
|
|||
return Replace(phi); |
|||
} |
|||
|
|||
|
|||
template class ChangeLowering<4>; |
|||
template class ChangeLowering<8>; |
|||
|
|||
} // namespace compiler
|
|||
} // namespace internal
|
|||
} // namespace v8
|
@ -1,79 +0,0 @@ |
|||
// 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.
|
|||
|
|||
#ifndef V8_COMPILER_CHANGE_LOWERING_H_ |
|||
#define V8_COMPILER_CHANGE_LOWERING_H_ |
|||
|
|||
#include "include/v8.h" |
|||
#include "src/compiler/common-operator.h" |
|||
#include "src/compiler/graph-reducer.h" |
|||
#include "src/compiler/machine-operator.h" |
|||
|
|||
namespace v8 { |
|||
namespace internal { |
|||
namespace compiler { |
|||
|
|||
// Forward declarations.
|
|||
class CommonNodeCache; |
|||
class Linkage; |
|||
|
|||
class ChangeLoweringBase : public Reducer { |
|||
public: |
|||
ChangeLoweringBase(Graph* graph, Linkage* linkage, CommonNodeCache* cache); |
|||
virtual ~ChangeLoweringBase(); |
|||
|
|||
protected: |
|||
Node* ExternalConstant(ExternalReference reference); |
|||
Node* HeapConstant(PrintableUnique<HeapObject> value); |
|||
Node* ImmovableHeapConstant(Handle<HeapObject> value); |
|||
Node* Int32Constant(int32_t value); |
|||
Node* NumberConstant(double value); |
|||
Node* CEntryStubConstant(); |
|||
Node* TrueConstant(); |
|||
Node* FalseConstant(); |
|||
|
|||
Reduction ChangeBitToBool(Node* val, Node* control); |
|||
|
|||
Graph* graph() const { return graph_; } |
|||
Isolate* isolate() const { return isolate_; } |
|||
Linkage* linkage() const { return linkage_; } |
|||
CommonNodeCache* cache() const { return cache_; } |
|||
CommonOperatorBuilder* common() { return &common_; } |
|||
MachineOperatorBuilder* machine() { return &machine_; } |
|||
|
|||
private: |
|||
Graph* graph_; |
|||
Isolate* isolate_; |
|||
Linkage* linkage_; |
|||
CommonNodeCache* cache_; |
|||
CommonOperatorBuilder common_; |
|||
MachineOperatorBuilder machine_; |
|||
|
|||
SetOncePointer<Node> c_entry_stub_constant_; |
|||
SetOncePointer<Node> true_constant_; |
|||
SetOncePointer<Node> false_constant_; |
|||
}; |
|||
|
|||
|
|||
template <size_t kPointerSize = kApiPointerSize> |
|||
class ChangeLowering V8_FINAL : public ChangeLoweringBase { |
|||
public: |
|||
ChangeLowering(Graph* graph, Linkage* linkage); |
|||
ChangeLowering(Graph* graph, Linkage* linkage, CommonNodeCache* cache) |
|||
: ChangeLoweringBase(graph, linkage, cache) {} |
|||
virtual ~ChangeLowering() {} |
|||
|
|||
virtual Reduction Reduce(Node* node) V8_OVERRIDE; |
|||
|
|||
private: |
|||
Reduction ChangeBoolToBit(Node* val); |
|||
Reduction ChangeInt32ToTagged(Node* val, Node* effect, Node* control); |
|||
Reduction ChangeTaggedToFloat64(Node* val, Node* effect, Node* control); |
|||
}; |
|||
|
|||
} // namespace compiler
|
|||
} // namespace internal
|
|||
} // namespace v8
|
|||
|
|||
#endif // V8_COMPILER_CHANGE_LOWERING_H_
|
@ -1,6 +1,5 @@ |
|||
include_rules = [ |
|||
"+src", |
|||
"+testing/gtest", |
|||
"+testing/gtest-type-names.h", |
|||
"+testing/gmock", |
|||
"+testing/gtest", |
|||
] |
|||
|
@ -1,257 +0,0 @@ |
|||
// 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 "src/compiler/change-lowering.h" |
|||
#include "src/compiler/common-operator.h" |
|||
#include "src/compiler/graph.h" |
|||
#include "src/compiler/node-properties-inl.h" |
|||
#include "src/compiler/simplified-operator.h" |
|||
#include "src/factory.h" |
|||
#include "test/compiler-unittests/compiler-unittests.h" |
|||
#include "test/compiler-unittests/node-matchers.h" |
|||
#include "testing/gtest-type-names.h" |
|||
|
|||
using testing::_; |
|||
|
|||
namespace v8 { |
|||
namespace internal { |
|||
namespace compiler { |
|||
|
|||
template <typename T> |
|||
class ChangeLoweringTest : public CompilerTest { |
|||
public: |
|||
static const size_t kPointerSize = sizeof(T); |
|||
|
|||
explicit ChangeLoweringTest(int num_parameters = 1) |
|||
: graph_(zone()), common_(zone()), simplified_(zone()) { |
|||
graph()->SetStart(graph()->NewNode(common()->Start(num_parameters))); |
|||
} |
|||
virtual ~ChangeLoweringTest() {} |
|||
|
|||
protected: |
|||
Node* Parameter(int32_t index = 0) { |
|||
return graph()->NewNode(common()->Parameter(index), graph()->start()); |
|||
} |
|||
|
|||
Reduction Reduce(Node* node) { |
|||
CompilationInfo info(isolate(), zone()); |
|||
Linkage linkage(&info); |
|||
ChangeLowering<kPointerSize> reducer(graph(), &linkage); |
|||
return reducer.Reduce(node); |
|||
} |
|||
|
|||
Graph* graph() { return &graph_; } |
|||
Factory* factory() const { return isolate()->factory(); } |
|||
CommonOperatorBuilder* common() { return &common_; } |
|||
SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
|||
|
|||
PrintableUnique<HeapObject> true_unique() { |
|||
return PrintableUnique<HeapObject>::CreateImmovable( |
|||
zone(), factory()->true_value()); |
|||
} |
|||
PrintableUnique<HeapObject> false_unique() { |
|||
return PrintableUnique<HeapObject>::CreateImmovable( |
|||
zone(), factory()->false_value()); |
|||
} |
|||
|
|||
private: |
|||
Graph graph_; |
|||
CommonOperatorBuilder common_; |
|||
SimplifiedOperatorBuilder simplified_; |
|||
}; |
|||
|
|||
|
|||
typedef ::testing::Types<int32_t, int64_t> ChangeLoweringTypes; |
|||
TYPED_TEST_CASE(ChangeLoweringTest, ChangeLoweringTypes); |
|||
|
|||
|
|||
TARGET_TYPED_TEST(ChangeLoweringTest, ChangeBitToBool) { |
|||
Node* val = this->Parameter(0); |
|||
Node* node = |
|||
this->graph()->NewNode(this->simplified()->ChangeBitToBool(), val); |
|||
Reduction reduction = this->Reduce(node); |
|||
ASSERT_TRUE(reduction.Changed()); |
|||
|
|||
Node* phi = reduction.replacement(); |
|||
EXPECT_THAT(phi, IsPhi(IsHeapConstant(this->true_unique()), |
|||
IsHeapConstant(this->false_unique()), _)); |
|||
|
|||
Node* merge = NodeProperties::GetControlInput(phi); |
|||
ASSERT_EQ(IrOpcode::kMerge, merge->opcode()); |
|||
|
|||
Node* if_true = NodeProperties::GetControlInput(merge, 0); |
|||
ASSERT_EQ(IrOpcode::kIfTrue, if_true->opcode()); |
|||
|
|||
Node* if_false = NodeProperties::GetControlInput(merge, 1); |
|||
ASSERT_EQ(IrOpcode::kIfFalse, if_false->opcode()); |
|||
|
|||
Node* branch = NodeProperties::GetControlInput(if_true); |
|||
EXPECT_EQ(branch, NodeProperties::GetControlInput(if_false)); |
|||
EXPECT_THAT(branch, IsBranch(val, this->graph()->start())); |
|||
} |
|||
|
|||
|
|||
TARGET_TYPED_TEST(ChangeLoweringTest, StringAdd) { |
|||
Node* node = this->graph()->NewNode(this->simplified()->StringAdd(), |
|||
this->Parameter(0), this->Parameter(1)); |
|||
Reduction reduction = this->Reduce(node); |
|||
EXPECT_FALSE(reduction.Changed()); |
|||
} |
|||
|
|||
|
|||
class ChangeLowering32Test : public ChangeLoweringTest<int32_t> { |
|||
public: |
|||
virtual ~ChangeLowering32Test() {} |
|||
}; |
|||
|
|||
|
|||
TARGET_TEST_F(ChangeLowering32Test, ChangeBoolToBit) { |
|||
Node* val = Parameter(0); |
|||
Node* node = graph()->NewNode(simplified()->ChangeBoolToBit(), val); |
|||
Reduction reduction = Reduce(node); |
|||
ASSERT_TRUE(reduction.Changed()); |
|||
|
|||
EXPECT_THAT(reduction.replacement(), |
|||
IsWord32Equal(val, IsHeapConstant(true_unique()))); |
|||
} |
|||
|
|||
|
|||
TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) { |
|||
Node* val = Parameter(0); |
|||
Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val); |
|||
Reduction reduction = Reduce(node); |
|||
ASSERT_TRUE(reduction.Changed()); |
|||
|
|||
Node* phi = reduction.replacement(); |
|||
ASSERT_EQ(IrOpcode::kPhi, phi->opcode()); |
|||
|
|||
Node* smi = NodeProperties::GetValueInput(phi, 1); |
|||
ASSERT_THAT(smi, IsProjection(0, IsInt32AddWithOverflow(val, val))); |
|||
|
|||
Node* heap_number = NodeProperties::GetValueInput(phi, 0); |
|||
ASSERT_EQ(IrOpcode::kCall, heap_number->opcode()); |
|||
|
|||
Node* merge = NodeProperties::GetControlInput(phi); |
|||
ASSERT_EQ(IrOpcode::kMerge, merge->opcode()); |
|||
|
|||
const int32_t kValueOffset = HeapNumber::kValueOffset - kHeapObjectTag; |
|||
EXPECT_THAT(NodeProperties::GetControlInput(merge, 0), |
|||
IsStore(kMachineFloat64, kNoWriteBarrier, heap_number, |
|||
IsInt32Constant(kValueOffset), |
|||
IsChangeInt32ToFloat64(val), _, heap_number)); |
|||
|
|||
Node* if_true = NodeProperties::GetControlInput(heap_number); |
|||
ASSERT_EQ(IrOpcode::kIfTrue, if_true->opcode()); |
|||
|
|||
Node* if_false = NodeProperties::GetControlInput(merge, 1); |
|||
ASSERT_EQ(IrOpcode::kIfFalse, if_false->opcode()); |
|||
|
|||
Node* branch = NodeProperties::GetControlInput(if_true); |
|||
EXPECT_EQ(branch, NodeProperties::GetControlInput(if_false)); |
|||
EXPECT_THAT(branch, |
|||
IsBranch(IsProjection(1, IsInt32AddWithOverflow(val, val)), |
|||
graph()->start())); |
|||
} |
|||
|
|||
|
|||
TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToFloat64) { |
|||
Node* val = Parameter(0); |
|||
Node* node = graph()->NewNode(simplified()->ChangeTaggedToFloat64(), val); |
|||
Reduction reduction = Reduce(node); |
|||
ASSERT_TRUE(reduction.Changed()); |
|||
|
|||
const int32_t kShiftAmount = |
|||
kSmiTagSize + SmiTagging<kPointerSize>::kSmiShiftSize; |
|||
const int32_t kValueOffset = HeapNumber::kValueOffset - kHeapObjectTag; |
|||
Node* phi = reduction.replacement(); |
|||
ASSERT_THAT( |
|||
phi, IsPhi(IsLoad(kMachineFloat64, val, IsInt32Constant(kValueOffset), _), |
|||
IsChangeInt32ToFloat64( |
|||
IsWord32Sar(val, IsInt32Constant(kShiftAmount))), |
|||
_)); |
|||
|
|||
Node* merge = NodeProperties::GetControlInput(phi); |
|||
ASSERT_EQ(IrOpcode::kMerge, merge->opcode()); |
|||
|
|||
Node* if_true = NodeProperties::GetControlInput(merge, 0); |
|||
ASSERT_EQ(IrOpcode::kIfTrue, if_true->opcode()); |
|||
|
|||
Node* if_false = NodeProperties::GetControlInput(merge, 1); |
|||
ASSERT_EQ(IrOpcode::kIfFalse, if_false->opcode()); |
|||
|
|||
Node* branch = NodeProperties::GetControlInput(if_true); |
|||
EXPECT_EQ(branch, NodeProperties::GetControlInput(if_false)); |
|||
STATIC_ASSERT(kSmiTag == 0); |
|||
STATIC_ASSERT(kSmiTagSize == 1); |
|||
EXPECT_THAT(branch, IsBranch(IsWord32And(val, IsInt32Constant(kSmiTagMask)), |
|||
graph()->start())); |
|||
} |
|||
|
|||
|
|||
class ChangeLowering64Test : public ChangeLoweringTest<int64_t> { |
|||
public: |
|||
virtual ~ChangeLowering64Test() {} |
|||
}; |
|||
|
|||
|
|||
TARGET_TEST_F(ChangeLowering64Test, ChangeBoolToBit) { |
|||
Node* val = Parameter(0); |
|||
Node* node = graph()->NewNode(simplified()->ChangeBoolToBit(), val); |
|||
Reduction reduction = Reduce(node); |
|||
ASSERT_TRUE(reduction.Changed()); |
|||
|
|||
EXPECT_THAT(reduction.replacement(), |
|||
IsWord64Equal(val, IsHeapConstant(true_unique()))); |
|||
} |
|||
|
|||
|
|||
TARGET_TEST_F(ChangeLowering64Test, ChangeInt32ToTagged) { |
|||
Node* val = Parameter(0); |
|||
Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val); |
|||
Reduction reduction = Reduce(node); |
|||
ASSERT_TRUE(reduction.Changed()); |
|||
|
|||
const int32_t kShiftAmount = |
|||
kSmiTagSize + SmiTagging<kPointerSize>::kSmiShiftSize; |
|||
EXPECT_THAT(reduction.replacement(), |
|||
IsWord64Shl(val, IsInt32Constant(kShiftAmount))); |
|||
} |
|||
|
|||
|
|||
TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToFloat64) { |
|||
Node* val = Parameter(0); |
|||
Node* node = graph()->NewNode(simplified()->ChangeTaggedToFloat64(), val); |
|||
Reduction reduction = Reduce(node); |
|||
ASSERT_TRUE(reduction.Changed()); |
|||
|
|||
const int32_t kShiftAmount = |
|||
kSmiTagSize + SmiTagging<kPointerSize>::kSmiShiftSize; |
|||
const int32_t kValueOffset = HeapNumber::kValueOffset - kHeapObjectTag; |
|||
Node* phi = reduction.replacement(); |
|||
ASSERT_THAT( |
|||
phi, IsPhi(IsLoad(kMachineFloat64, val, IsInt32Constant(kValueOffset), _), |
|||
IsChangeInt32ToFloat64(IsConvertInt64ToInt32( |
|||
IsWord64Sar(val, IsInt32Constant(kShiftAmount)))), |
|||
_)); |
|||
|
|||
Node* merge = NodeProperties::GetControlInput(phi); |
|||
ASSERT_EQ(IrOpcode::kMerge, merge->opcode()); |
|||
|
|||
Node* if_true = NodeProperties::GetControlInput(merge, 0); |
|||
ASSERT_EQ(IrOpcode::kIfTrue, if_true->opcode()); |
|||
|
|||
Node* if_false = NodeProperties::GetControlInput(merge, 1); |
|||
ASSERT_EQ(IrOpcode::kIfFalse, if_false->opcode()); |
|||
|
|||
Node* branch = NodeProperties::GetControlInput(if_true); |
|||
EXPECT_EQ(branch, NodeProperties::GetControlInput(if_false)); |
|||
STATIC_ASSERT(kSmiTag == 0); |
|||
STATIC_ASSERT(kSmiTagSize == 1); |
|||
EXPECT_THAT(branch, IsBranch(IsWord64And(val, IsInt32Constant(kSmiTagMask)), |
|||
graph()->start())); |
|||
} |
|||
|
|||
} // namespace compiler
|
|||
} // namespace internal
|
|||
} // namespace v8
|
@ -1,454 +0,0 @@ |
|||
// 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/compiler-unittests/node-matchers.h" |
|||
|
|||
#include <ostream> // NOLINT(readability/streams) |
|||
|
|||
#include "src/compiler/node-properties-inl.h" |
|||
|
|||
using testing::MakeMatcher; |
|||
using testing::MatcherInterface; |
|||
using testing::MatchResultListener; |
|||
using testing::StringMatchResultListener; |
|||
|
|||
namespace v8 { |
|||
namespace internal { |
|||
|
|||
// TODO(bmeurer): Find a new home for these functions.
|
|||
template <typename T> |
|||
inline std::ostream& operator<<(std::ostream& os, |
|||
const PrintableUnique<T>& value) { |
|||
return os << value.string(); |
|||
} |
|||
|
|||
namespace compiler { |
|||
|
|||
namespace { |
|||
|
|||
template <typename T> |
|||
bool PrintMatchAndExplain(const T& value, const char* value_name, |
|||
const Matcher<T>& value_matcher, |
|||
MatchResultListener* listener) { |
|||
StringMatchResultListener value_listener; |
|||
if (!value_matcher.MatchAndExplain(value, &value_listener)) { |
|||
*listener << "whose " << value_name << " " << value << " doesn't match"; |
|||
if (value_listener.str() != "") { |
|||
*listener << ", " << value_listener.str(); |
|||
} |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
|
|||
class NodeMatcher : public MatcherInterface<Node*> { |
|||
public: |
|||
explicit NodeMatcher(IrOpcode::Value opcode) : opcode_(opcode) {} |
|||
|
|||
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE { |
|||
*os << "is a " << IrOpcode::Mnemonic(opcode_) << " node"; |
|||
} |
|||
|
|||
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
|||
V8_OVERRIDE { |
|||
if (node == NULL) { |
|||
*listener << "which is NULL"; |
|||
return false; |
|||
} |
|||
if (node->opcode() != opcode_) { |
|||
*listener << "whose opcode is " << IrOpcode::Mnemonic(node->opcode()); |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
private: |
|||
const IrOpcode::Value opcode_; |
|||
}; |
|||
|
|||
|
|||
class IsBranchMatcher V8_FINAL : public NodeMatcher { |
|||
public: |
|||
IsBranchMatcher(const Matcher<Node*>& value_matcher, |
|||
const Matcher<Node*>& control_matcher) |
|||
: NodeMatcher(IrOpcode::kBranch), |
|||
value_matcher_(value_matcher), |
|||
control_matcher_(control_matcher) {} |
|||
|
|||
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE { |
|||
NodeMatcher::DescribeTo(os); |
|||
*os << " whose value ("; |
|||
value_matcher_.DescribeTo(os); |
|||
*os << ") and control ("; |
|||
control_matcher_.DescribeTo(os); |
|||
*os << ")"; |
|||
} |
|||
|
|||
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
|||
V8_OVERRIDE { |
|||
return (NodeMatcher::MatchAndExplain(node, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
|||
"value", value_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
|||
"control", control_matcher_, listener)); |
|||
} |
|||
|
|||
private: |
|||
const Matcher<Node*> value_matcher_; |
|||
const Matcher<Node*> control_matcher_; |
|||
}; |
|||
|
|||
|
|||
template <typename T> |
|||
class IsConstantMatcher V8_FINAL : public NodeMatcher { |
|||
public: |
|||
IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher) |
|||
: NodeMatcher(opcode), value_matcher_(value_matcher) {} |
|||
|
|||
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE { |
|||
NodeMatcher::DescribeTo(os); |
|||
*os << " whose value ("; |
|||
value_matcher_.DescribeTo(os); |
|||
*os << ")"; |
|||
} |
|||
|
|||
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
|||
V8_OVERRIDE { |
|||
return (NodeMatcher::MatchAndExplain(node, listener) && |
|||
PrintMatchAndExplain(OpParameter<T>(node), "value", value_matcher_, |
|||
listener)); |
|||
} |
|||
|
|||
private: |
|||
const Matcher<T> value_matcher_; |
|||
}; |
|||
|
|||
|
|||
class IsPhiMatcher V8_FINAL : public NodeMatcher { |
|||
public: |
|||
IsPhiMatcher(const Matcher<Node*>& value0_matcher, |
|||
const Matcher<Node*>& value1_matcher, |
|||
const Matcher<Node*>& control_matcher) |
|||
: NodeMatcher(IrOpcode::kPhi), |
|||
value0_matcher_(value0_matcher), |
|||
value1_matcher_(value1_matcher), |
|||
control_matcher_(control_matcher) {} |
|||
|
|||
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE { |
|||
NodeMatcher::DescribeTo(os); |
|||
*os << " whose value0 ("; |
|||
value0_matcher_.DescribeTo(os); |
|||
*os << "), value1 ("; |
|||
value1_matcher_.DescribeTo(os); |
|||
*os << ") and control ("; |
|||
control_matcher_.DescribeTo(os); |
|||
*os << ")"; |
|||
} |
|||
|
|||
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
|||
V8_OVERRIDE { |
|||
return (NodeMatcher::MatchAndExplain(node, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
|||
"value0", value0_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
|||
"value1", value1_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
|||
"control", control_matcher_, listener)); |
|||
} |
|||
|
|||
private: |
|||
const Matcher<Node*> value0_matcher_; |
|||
const Matcher<Node*> value1_matcher_; |
|||
const Matcher<Node*> control_matcher_; |
|||
}; |
|||
|
|||
|
|||
class IsProjectionMatcher V8_FINAL : public NodeMatcher { |
|||
public: |
|||
IsProjectionMatcher(const Matcher<int32_t>& index_matcher, |
|||
const Matcher<Node*>& base_matcher) |
|||
: NodeMatcher(IrOpcode::kProjection), |
|||
index_matcher_(index_matcher), |
|||
base_matcher_(base_matcher) {} |
|||
|
|||
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE { |
|||
NodeMatcher::DescribeTo(os); |
|||
*os << " whose index ("; |
|||
index_matcher_.DescribeTo(os); |
|||
*os << ") and base ("; |
|||
base_matcher_.DescribeTo(os); |
|||
*os << ")"; |
|||
} |
|||
|
|||
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
|||
V8_OVERRIDE { |
|||
return (NodeMatcher::MatchAndExplain(node, listener) && |
|||
PrintMatchAndExplain(OpParameter<int32_t>(node), "index", |
|||
index_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
|||
base_matcher_, listener)); |
|||
} |
|||
|
|||
private: |
|||
const Matcher<int32_t> index_matcher_; |
|||
const Matcher<Node*> base_matcher_; |
|||
}; |
|||
|
|||
|
|||
class IsLoadMatcher V8_FINAL : public NodeMatcher { |
|||
public: |
|||
IsLoadMatcher(const Matcher<MachineType>& type_matcher, |
|||
const Matcher<Node*>& base_matcher, |
|||
const Matcher<Node*>& index_matcher, |
|||
const Matcher<Node*>& effect_matcher) |
|||
: NodeMatcher(IrOpcode::kLoad), |
|||
type_matcher_(type_matcher), |
|||
base_matcher_(base_matcher), |
|||
index_matcher_(index_matcher), |
|||
effect_matcher_(effect_matcher) {} |
|||
|
|||
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE { |
|||
NodeMatcher::DescribeTo(os); |
|||
*os << " whose type ("; |
|||
type_matcher_.DescribeTo(os); |
|||
*os << "), base ("; |
|||
base_matcher_.DescribeTo(os); |
|||
*os << "), index ("; |
|||
index_matcher_.DescribeTo(os); |
|||
*os << ") and effect ("; |
|||
effect_matcher_.DescribeTo(os); |
|||
*os << ")"; |
|||
} |
|||
|
|||
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
|||
V8_OVERRIDE { |
|||
return (NodeMatcher::MatchAndExplain(node, listener) && |
|||
PrintMatchAndExplain(OpParameter<MachineType>(node), "type", |
|||
type_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
|||
base_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
|||
"index", index_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
|||
effect_matcher_, listener)); |
|||
} |
|||
|
|||
private: |
|||
const Matcher<MachineType> type_matcher_; |
|||
const Matcher<Node*> base_matcher_; |
|||
const Matcher<Node*> index_matcher_; |
|||
const Matcher<Node*> effect_matcher_; |
|||
}; |
|||
|
|||
|
|||
class IsStoreMatcher V8_FINAL : public NodeMatcher { |
|||
public: |
|||
IsStoreMatcher(const Matcher<MachineType>& type_matcher, |
|||
const Matcher<WriteBarrierKind> write_barrier_matcher, |
|||
const Matcher<Node*>& base_matcher, |
|||
const Matcher<Node*>& index_matcher, |
|||
const Matcher<Node*>& value_matcher, |
|||
const Matcher<Node*>& effect_matcher, |
|||
const Matcher<Node*>& control_matcher) |
|||
: NodeMatcher(IrOpcode::kStore), |
|||
type_matcher_(type_matcher), |
|||
write_barrier_matcher_(write_barrier_matcher), |
|||
base_matcher_(base_matcher), |
|||
index_matcher_(index_matcher), |
|||
value_matcher_(value_matcher), |
|||
effect_matcher_(effect_matcher), |
|||
control_matcher_(control_matcher) {} |
|||
|
|||
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE { |
|||
NodeMatcher::DescribeTo(os); |
|||
*os << " whose type ("; |
|||
type_matcher_.DescribeTo(os); |
|||
*os << "), write barrier ("; |
|||
write_barrier_matcher_.DescribeTo(os); |
|||
*os << "), base ("; |
|||
base_matcher_.DescribeTo(os); |
|||
*os << "), index ("; |
|||
index_matcher_.DescribeTo(os); |
|||
*os << "), value ("; |
|||
value_matcher_.DescribeTo(os); |
|||
*os << "), effect ("; |
|||
effect_matcher_.DescribeTo(os); |
|||
*os << ") and control ("; |
|||
control_matcher_.DescribeTo(os); |
|||
*os << ")"; |
|||
} |
|||
|
|||
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
|||
V8_OVERRIDE { |
|||
return (NodeMatcher::MatchAndExplain(node, listener) && |
|||
PrintMatchAndExplain(OpParameter<StoreRepresentation>(node).rep, |
|||
"type", type_matcher_, listener) && |
|||
PrintMatchAndExplain( |
|||
OpParameter<StoreRepresentation>(node).write_barrier_kind, |
|||
"write barrier", write_barrier_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
|||
base_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
|||
"index", index_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
|||
"value", value_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
|||
effect_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
|||
"control", control_matcher_, listener)); |
|||
} |
|||
|
|||
private: |
|||
const Matcher<MachineType> type_matcher_; |
|||
const Matcher<WriteBarrierKind> write_barrier_matcher_; |
|||
const Matcher<Node*> base_matcher_; |
|||
const Matcher<Node*> index_matcher_; |
|||
const Matcher<Node*> value_matcher_; |
|||
const Matcher<Node*> effect_matcher_; |
|||
const Matcher<Node*> control_matcher_; |
|||
}; |
|||
|
|||
|
|||
class IsBinopMatcher V8_FINAL : public NodeMatcher { |
|||
public: |
|||
IsBinopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& lhs_matcher, |
|||
const Matcher<Node*>& rhs_matcher) |
|||
: NodeMatcher(opcode), |
|||
lhs_matcher_(lhs_matcher), |
|||
rhs_matcher_(rhs_matcher) {} |
|||
|
|||
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE { |
|||
NodeMatcher::DescribeTo(os); |
|||
*os << " whose lhs ("; |
|||
lhs_matcher_.DescribeTo(os); |
|||
*os << ") and rhs ("; |
|||
rhs_matcher_.DescribeTo(os); |
|||
*os << ")"; |
|||
} |
|||
|
|||
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
|||
V8_OVERRIDE { |
|||
return (NodeMatcher::MatchAndExplain(node, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", |
|||
lhs_matcher_, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
|||
rhs_matcher_, listener)); |
|||
} |
|||
|
|||
private: |
|||
const Matcher<Node*> lhs_matcher_; |
|||
const Matcher<Node*> rhs_matcher_; |
|||
}; |
|||
|
|||
|
|||
class IsUnopMatcher V8_FINAL : public NodeMatcher { |
|||
public: |
|||
IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher) |
|||
: NodeMatcher(opcode), input_matcher_(input_matcher) {} |
|||
|
|||
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE { |
|||
NodeMatcher::DescribeTo(os); |
|||
*os << " whose input ("; |
|||
input_matcher_.DescribeTo(os); |
|||
*os << ")"; |
|||
} |
|||
|
|||
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const |
|||
V8_OVERRIDE { |
|||
return (NodeMatcher::MatchAndExplain(node, listener) && |
|||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
|||
"input", input_matcher_, listener)); |
|||
} |
|||
|
|||
private: |
|||
const Matcher<Node*> input_matcher_; |
|||
}; |
|||
|
|||
} |
|||
|
|||
|
|||
Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, |
|||
const Matcher<Node*>& control_matcher) { |
|||
return MakeMatcher(new IsBranchMatcher(value_matcher, control_matcher)); |
|||
} |
|||
|
|||
|
|||
Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher) { |
|||
return MakeMatcher( |
|||
new IsConstantMatcher<int32_t>(IrOpcode::kInt32Constant, value_matcher)); |
|||
} |
|||
|
|||
|
|||
Matcher<Node*> IsHeapConstant( |
|||
const Matcher<PrintableUnique<HeapObject> >& value_matcher) { |
|||
return MakeMatcher(new IsConstantMatcher<PrintableUnique<HeapObject> >( |
|||
IrOpcode::kHeapConstant, value_matcher)); |
|||
} |
|||
|
|||
|
|||
Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher, |
|||
const Matcher<Node*>& value1_matcher, |
|||
const Matcher<Node*>& merge_matcher) { |
|||
return MakeMatcher( |
|||
new IsPhiMatcher(value0_matcher, value1_matcher, merge_matcher)); |
|||
} |
|||
|
|||
|
|||
Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher, |
|||
const Matcher<Node*>& base_matcher) { |
|||
return MakeMatcher(new IsProjectionMatcher(index_matcher, base_matcher)); |
|||
} |
|||
|
|||
|
|||
Matcher<Node*> IsLoad(const Matcher<MachineType>& type_matcher, |
|||
const Matcher<Node*>& base_matcher, |
|||
const Matcher<Node*>& index_matcher, |
|||
const Matcher<Node*>& effect_matcher) { |
|||
return MakeMatcher(new IsLoadMatcher(type_matcher, base_matcher, |
|||
index_matcher, effect_matcher)); |
|||
} |
|||
|
|||
|
|||
Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher, |
|||
const Matcher<WriteBarrierKind>& write_barrier_matcher, |
|||
const Matcher<Node*>& base_matcher, |
|||
const Matcher<Node*>& index_matcher, |
|||
const Matcher<Node*>& value_matcher, |
|||
const Matcher<Node*>& effect_matcher, |
|||
const Matcher<Node*>& control_matcher) { |
|||
return MakeMatcher(new IsStoreMatcher( |
|||
type_matcher, write_barrier_matcher, base_matcher, index_matcher, |
|||
value_matcher, effect_matcher, control_matcher)); |
|||
} |
|||
|
|||
|
|||
#define IS_BINOP_MATCHER(Name) \ |
|||
Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ |
|||
const Matcher<Node*>& rhs_matcher) { \ |
|||
return MakeMatcher( \ |
|||
new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \ |
|||
} |
|||
IS_BINOP_MATCHER(Word32And) |
|||
IS_BINOP_MATCHER(Word32Sar) |
|||
IS_BINOP_MATCHER(Word32Equal) |
|||
IS_BINOP_MATCHER(Word64And) |
|||
IS_BINOP_MATCHER(Word64Sar) |
|||
IS_BINOP_MATCHER(Word64Shl) |
|||
IS_BINOP_MATCHER(Word64Equal) |
|||
IS_BINOP_MATCHER(Int32AddWithOverflow) |
|||
#undef IS_BINOP_MATCHER |
|||
|
|||
|
|||
#define IS_UNOP_MATCHER(Name) \ |
|||
Matcher<Node*> Is##Name(const Matcher<Node*>& input_matcher) { \ |
|||
return MakeMatcher(new IsUnopMatcher(IrOpcode::k##Name, input_matcher)); \ |
|||
} |
|||
IS_UNOP_MATCHER(ConvertInt64ToInt32) |
|||
IS_UNOP_MATCHER(ChangeInt32ToFloat64) |
|||
#undef IS_UNOP_MATCHER |
|||
|
|||
} // namespace compiler
|
|||
} // namespace internal
|
|||
} // namespace v8
|
@ -1,71 +0,0 @@ |
|||
// 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.
|
|||
|
|||
#ifndef V8_COMPILER_UNITTESTS_NODE_MATCHERS_H_ |
|||
#define V8_COMPILER_UNITTESTS_NODE_MATCHERS_H_ |
|||
|
|||
#include "src/compiler/machine-operator.h" |
|||
#include "testing/gmock/include/gmock/gmock.h" |
|||
|
|||
namespace v8 { |
|||
namespace internal { |
|||
|
|||
// Forward declarations.
|
|||
class HeapObject; |
|||
template <class T> |
|||
class PrintableUnique; |
|||
|
|||
namespace compiler { |
|||
|
|||
// Forward declarations.
|
|||
class Node; |
|||
|
|||
using testing::Matcher; |
|||
|
|||
Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, |
|||
const Matcher<Node*>& control_matcher); |
|||
Matcher<Node*> IsHeapConstant( |
|||
const Matcher<PrintableUnique<HeapObject> >& value_matcher); |
|||
Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher); |
|||
Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher, |
|||
const Matcher<Node*>& value1_matcher, |
|||
const Matcher<Node*>& merge_matcher); |
|||
Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher, |
|||
const Matcher<Node*>& base_matcher); |
|||
|
|||
Matcher<Node*> IsLoad(const Matcher<MachineType>& type_matcher, |
|||
const Matcher<Node*>& base_matcher, |
|||
const Matcher<Node*>& index_matcher, |
|||
const Matcher<Node*>& effect_matcher); |
|||
Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher, |
|||
const Matcher<WriteBarrierKind>& write_barrier_matcher, |
|||
const Matcher<Node*>& base_matcher, |
|||
const Matcher<Node*>& index_matcher, |
|||
const Matcher<Node*>& value_matcher, |
|||
const Matcher<Node*>& effect_matcher, |
|||
const Matcher<Node*>& control_matcher); |
|||
Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher, |
|||
const Matcher<Node*>& rhs_matcher); |
|||
Matcher<Node*> IsWord32Sar(const Matcher<Node*>& lhs_matcher, |
|||
const Matcher<Node*>& rhs_matcher); |
|||
Matcher<Node*> IsWord32Equal(const Matcher<Node*>& lhs_matcher, |
|||
const Matcher<Node*>& rhs_matcher); |
|||
Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher, |
|||
const Matcher<Node*>& rhs_matcher); |
|||
Matcher<Node*> IsWord64Shl(const Matcher<Node*>& lhs_matcher, |
|||
const Matcher<Node*>& rhs_matcher); |
|||
Matcher<Node*> IsWord64Sar(const Matcher<Node*>& lhs_matcher, |
|||
const Matcher<Node*>& rhs_matcher); |
|||
Matcher<Node*> IsWord64Equal(const Matcher<Node*>& lhs_matcher, |
|||
const Matcher<Node*>& rhs_matcher); |
|||
Matcher<Node*> IsInt32AddWithOverflow(const Matcher<Node*>& lhs_matcher, |
|||
const Matcher<Node*>& rhs_matcher); |
|||
Matcher<Node*> IsConvertInt64ToInt32(const Matcher<Node*>& input_matcher); |
|||
Matcher<Node*> IsChangeInt32ToFloat64(const Matcher<Node*>& input_matcher); |
|||
|
|||
} // namespace compiler
|
|||
} // namespace internal
|
|||
} // namespace v8
|
|||
|
|||
#endif // V8_COMPILER_UNITTESTS_NODE_MATCHERS_H_
|
@ -1,55 +0,0 @@ |
|||
// 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.
|
|||
//
|
|||
// Flags: --allow-natives-syntax
|
|||
|
|||
var s = %CreatePrivateOwnSymbol("s"); |
|||
var s1 = %CreatePrivateOwnSymbol("s1"); |
|||
|
|||
function TestSimple() { |
|||
var p = {} |
|||
p[s] = "moo"; |
|||
|
|||
var o = Object.create(p); |
|||
|
|||
assertEquals(undefined, o[s]); |
|||
assertEquals("moo", p[s]); |
|||
|
|||
o[s] = "bow-wow"; |
|||
assertEquals("bow-wow", o[s]); |
|||
assertEquals("moo", p[s]); |
|||
} |
|||
|
|||
TestSimple(); |
|||
|
|||
|
|||
function TestICs() { |
|||
var p = {} |
|||
p[s] = "moo"; |
|||
|
|||
|
|||
var o = Object.create(p); |
|||
o[s1] = "bow-wow"; |
|||
function checkNonOwn(o) { |
|||
assertEquals(undefined, o[s]); |
|||
assertEquals("bow-wow", o[s1]); |
|||
} |
|||
|
|||
checkNonOwn(o); |
|||
|
|||
// Test monomorphic/optimized.
|
|||
for (var i = 0; i < 1000; i++) { |
|||
checkNonOwn(o); |
|||
} |
|||
|
|||
// Test non-monomorphic.
|
|||
for (var i = 0; i < 1000; i++) { |
|||
var oNew = Object.create(p); |
|||
oNew["s" + i] = i; |
|||
oNew[s1] = "bow-wow"; |
|||
checkNonOwn(oNew); |
|||
} |
|||
} |
|||
|
|||
TestICs(); |
@ -0,0 +1,314 @@ |
|||
// 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.
|
|||
|
|||
function timezone(tz) { |
|||
var str = (new Date(2014, 0, 10)).toString(); |
|||
if (tz == "CET") { |
|||
return str == "Fri Jan 10 2014 00:00:00 GMT+0100 (CET)"; |
|||
} |
|||
if (tz == "BRT") { |
|||
return str == "Fri Jan 10 2014 00:00:00 GMT-0200 (BRST)"; |
|||
} |
|||
if (tz == "PST") { |
|||
return str == "Fri Jan 10 2014 00:00:00 GMT-0800 (PST)"; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
if (timezone("CET")) { |
|||
assertEquals("Sat Mar 29 2014 22:59:00 GMT+0100 (CET)", |
|||
(new Date(2014, 2, 29, 22, 59)).toString()); |
|||
assertEquals("Sat, 29 Mar 2014 21:59:00 GMT", |
|||
(new Date(2014, 2, 29, 22, 59)).toUTCString()); |
|||
assertEquals("Sat Mar 29 2014 23:00:00 GMT+0100 (CET)", |
|||
(new Date(2014, 2, 29, 23, 0)).toString()); |
|||
assertEquals("Sat, 29 Mar 2014 22:00:00 GMT", |
|||
(new Date(2014, 2, 29, 23, 0)).toUTCString()); |
|||
assertEquals("Sat Mar 29 2014 23:59:00 GMT+0100 (CET)", |
|||
(new Date(2014, 2, 29, 23, 59)).toString()); |
|||
assertEquals("Sat, 29 Mar 2014 22:59:00 GMT", |
|||
(new Date(2014, 2, 29, 23, 59)).toUTCString()); |
|||
assertEquals("Sun Mar 30 2014 00:00:00 GMT+0100 (CET)", |
|||
(new Date(2014, 2, 30, 0, 0)).toString()); |
|||
assertEquals("Sat, 29 Mar 2014 23:00:00 GMT", |
|||
(new Date(2014, 2, 30, 0, 0)).toUTCString()); |
|||
assertEquals("Sun Mar 30 2014 00:59:00 GMT+0100 (CET)", |
|||
(new Date(2014, 2, 30, 0, 59)).toString()); |
|||
assertEquals("Sat, 29 Mar 2014 23:59:00 GMT", |
|||
(new Date(2014, 2, 30, 0, 59)).toUTCString()); |
|||
assertEquals("Sun Mar 30 2014 01:00:00 GMT+0100 (CET)", |
|||
(new Date(2014, 2, 30, 1, 0)).toString()); |
|||
assertEquals("Sun, 30 Mar 2014 00:00:00 GMT", |
|||
(new Date(2014, 2, 30, 1, 0)).toUTCString()); |
|||
assertEquals("Sun Mar 30 2014 01:59:00 GMT+0100 (CET)", |
|||
(new Date(2014, 2, 30, 1, 59)).toString()); |
|||
assertEquals("Sun, 30 Mar 2014 00:59:00 GMT", |
|||
(new Date(2014, 2, 30, 1, 59)).toUTCString()); |
|||
assertEquals("Sun Mar 30 2014 03:00:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 2, 30, 2, 0)).toString()); |
|||
assertEquals("Sun, 30 Mar 2014 01:00:00 GMT", |
|||
(new Date(2014, 2, 30, 2, 0)).toUTCString()); |
|||
assertEquals("Sun Mar 30 2014 03:59:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 2, 30, 2, 59)).toString()); |
|||
assertEquals("Sun, 30 Mar 2014 01:59:00 GMT", |
|||
(new Date(2014, 2, 30, 2, 59)).toUTCString()); |
|||
assertEquals("Sun Mar 30 2014 03:00:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 2, 30, 3, 0)).toString()); |
|||
assertEquals("Sun, 30 Mar 2014 01:00:00 GMT", |
|||
(new Date(2014, 2, 30, 3, 0)).toUTCString()); |
|||
assertEquals("Sun Mar 30 2014 03:59:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 2, 30, 3, 59)).toString()); |
|||
assertEquals("Sun, 30 Mar 2014 01:59:00 GMT", |
|||
(new Date(2014, 2, 30, 3, 59)).toUTCString()); |
|||
assertEquals("Sun Mar 30 2014 04:00:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 2, 30, 4, 0)).toString()); |
|||
assertEquals("Sun, 30 Mar 2014 02:00:00 GMT", |
|||
(new Date(2014, 2, 30, 4, 0)).toUTCString()); |
|||
assertEquals("Sat Oct 25 2014 22:59:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 9, 25, 22, 59)).toString()); |
|||
assertEquals("Sat, 25 Oct 2014 20:59:00 GMT", |
|||
(new Date(2014, 9, 25, 22, 59)).toUTCString()); |
|||
assertEquals("Sat Oct 25 2014 23:00:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 9, 25, 23, 0)).toString()); |
|||
assertEquals("Sat, 25 Oct 2014 21:00:00 GMT", |
|||
(new Date(2014, 9, 25, 23, 0)).toUTCString()); |
|||
assertEquals("Sat Oct 25 2014 23:59:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 9, 25, 23, 59)).toString()); |
|||
assertEquals("Sat, 25 Oct 2014 21:59:00 GMT", |
|||
(new Date(2014, 9, 25, 23, 59)).toUTCString()); |
|||
assertEquals("Sun Oct 26 2014 00:00:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 9, 26, 0, 0)).toString()); |
|||
assertEquals("Sat, 25 Oct 2014 22:00:00 GMT", |
|||
(new Date(2014, 9, 26, 0, 0)).toUTCString()); |
|||
assertEquals("Sun Oct 26 2014 00:59:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 9, 26, 0, 59)).toString()); |
|||
assertEquals("Sat, 25 Oct 2014 22:59:00 GMT", |
|||
(new Date(2014, 9, 26, 0, 59)).toUTCString()); |
|||
assertEquals("Sun Oct 26 2014 01:00:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 9, 26, 1, 0)).toString()); |
|||
assertEquals("Sat, 25 Oct 2014 23:00:00 GMT", |
|||
(new Date(2014, 9, 26, 1, 0)).toUTCString()); |
|||
assertEquals("Sun Oct 26 2014 01:59:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 9, 26, 1, 59)).toString()); |
|||
assertEquals("Sat, 25 Oct 2014 23:59:00 GMT", |
|||
(new Date(2014, 9, 26, 1, 59)).toUTCString()); |
|||
assertEquals("Sun Oct 26 2014 02:00:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 9, 26, 2, 0)).toString()); |
|||
assertEquals("Sun, 26 Oct 2014 00:00:00 GMT", |
|||
(new Date(2014, 9, 26, 2, 0)).toUTCString()); |
|||
assertEquals("Sun Oct 26 2014 02:59:00 GMT+0200 (CEST)", |
|||
(new Date(2014, 9, 26, 2, 59)).toString()); |
|||
assertEquals("Sun, 26 Oct 2014 00:59:00 GMT", |
|||
(new Date(2014, 9, 26, 2, 59)).toUTCString()); |
|||
assertEquals("Sun Oct 26 2014 03:00:00 GMT+0100 (CET)", |
|||
(new Date(2014, 9, 26, 3, 0)).toString()); |
|||
assertEquals("Sun, 26 Oct 2014 02:00:00 GMT", |
|||
(new Date(2014, 9, 26, 3, 0)).toUTCString()); |
|||
assertEquals("Sun Oct 26 2014 03:59:00 GMT+0100 (CET)", |
|||
(new Date(2014, 9, 26, 3, 59)).toString()); |
|||
assertEquals("Sun, 26 Oct 2014 02:59:00 GMT", |
|||
(new Date(2014, 9, 26, 3, 59)).toUTCString()); |
|||
assertEquals("Sun Oct 26 2014 04:00:00 GMT+0100 (CET)", |
|||
(new Date(2014, 9, 26, 4, 0)).toString()); |
|||
assertEquals("Sun, 26 Oct 2014 03:00:00 GMT", |
|||
(new Date(2014, 9, 26, 4, 0)).toUTCString()); |
|||
} |
|||
|
|||
if (timezone("BRT")) { |
|||
assertEquals("Sat Oct 18 2014 22:59:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 9, 18, 22, 59)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 01:59:00 GMT", |
|||
(new Date(2014, 9, 18, 22, 59)).toUTCString()); |
|||
assertEquals("Sat Oct 18 2014 23:00:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 9, 18, 23, 0)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 02:00:00 GMT", |
|||
(new Date(2014, 9, 18, 23, 0)).toUTCString()); |
|||
assertEquals("Sat Oct 18 2014 23:59:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 9, 18, 23, 59)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 02:59:00 GMT", |
|||
(new Date(2014, 9, 18, 23, 59)).toUTCString()); |
|||
assertEquals("Sun Oct 19 2014 01:00:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 9, 19, 0, 0)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 03:00:00 GMT", |
|||
(new Date(2014, 9, 19, 0, 0)).toUTCString()); |
|||
assertEquals("Sun Oct 19 2014 01:59:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 9, 19, 0, 59)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 03:59:00 GMT", |
|||
(new Date(2014, 9, 19, 0, 59)).toUTCString()); |
|||
assertEquals("Sun Oct 19 2014 01:00:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 9, 19, 1, 0)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 03:00:00 GMT", |
|||
(new Date(2014, 9, 19, 1, 0)).toUTCString()); |
|||
assertEquals("Sun Oct 19 2014 01:59:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 9, 19, 1, 59)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 03:59:00 GMT", |
|||
(new Date(2014, 9, 19, 1, 59)).toUTCString()); |
|||
assertEquals("Sun Oct 19 2014 02:00:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 9, 19, 2, 0)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 04:00:00 GMT", |
|||
(new Date(2014, 9, 19, 2, 0)).toUTCString()); |
|||
assertEquals("Sun Oct 19 2014 02:59:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 9, 19, 2, 59)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 04:59:00 GMT", |
|||
(new Date(2014, 9, 19, 2, 59)).toUTCString()); |
|||
assertEquals("Sun Oct 19 2014 03:00:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 9, 19, 3, 0)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 05:00:00 GMT", |
|||
(new Date(2014, 9, 19, 3, 0)).toUTCString()); |
|||
assertEquals("Sun Oct 19 2014 03:59:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 9, 19, 3, 59)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 05:59:00 GMT", |
|||
(new Date(2014, 9, 19, 3, 59)).toUTCString()); |
|||
assertEquals("Sun Oct 19 2014 04:00:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 9, 19, 4, 0)).toString()); |
|||
assertEquals("Sun, 19 Oct 2014 06:00:00 GMT", |
|||
(new Date(2014, 9, 19, 4, 0)).toUTCString()); |
|||
assertEquals("Sat Feb 15 2014 22:59:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 1, 15, 22, 59)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 00:59:00 GMT", |
|||
(new Date(2014, 1, 15, 22, 59)).toUTCString()); |
|||
assertEquals("Sat Feb 15 2014 23:00:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 1, 15, 23, 0)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 01:00:00 GMT", |
|||
(new Date(2014, 1, 15, 23, 0)).toUTCString()); |
|||
assertEquals("Sat Feb 15 2014 23:59:00 GMT-0200 (BRST)", |
|||
(new Date(2014, 1, 15, 23, 59)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 01:59:00 GMT", |
|||
(new Date(2014, 1, 15, 23, 59)).toUTCString()); |
|||
assertEquals("Sun Feb 16 2014 00:00:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 1, 16, 0, 0)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 03:00:00 GMT", |
|||
(new Date(2014, 1, 16, 0, 0)).toUTCString()); |
|||
assertEquals("Sun Feb 16 2014 00:59:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 1, 16, 0, 59)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 03:59:00 GMT", |
|||
(new Date(2014, 1, 16, 0, 59)).toUTCString()); |
|||
assertEquals("Sun Feb 16 2014 01:00:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 1, 16, 1, 0)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 04:00:00 GMT", |
|||
(new Date(2014, 1, 16, 1, 0)).toUTCString()); |
|||
assertEquals("Sun Feb 16 2014 01:59:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 1, 16, 1, 59)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 04:59:00 GMT", |
|||
(new Date(2014, 1, 16, 1, 59)).toUTCString()); |
|||
assertEquals("Sun Feb 16 2014 02:00:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 1, 16, 2, 0)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 05:00:00 GMT", |
|||
(new Date(2014, 1, 16, 2, 0)).toUTCString()); |
|||
assertEquals("Sun Feb 16 2014 02:59:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 1, 16, 2, 59)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 05:59:00 GMT", |
|||
(new Date(2014, 1, 16, 2, 59)).toUTCString()); |
|||
assertEquals("Sun Feb 16 2014 03:00:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 1, 16, 3, 0)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 06:00:00 GMT", |
|||
(new Date(2014, 1, 16, 3, 0)).toUTCString()); |
|||
assertEquals("Sun Feb 16 2014 03:59:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 1, 16, 3, 59)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 06:59:00 GMT", |
|||
(new Date(2014, 1, 16, 3, 59)).toUTCString()); |
|||
assertEquals("Sun Feb 16 2014 04:00:00 GMT-0300 (BRT)", |
|||
(new Date(2014, 1, 16, 4, 0)).toString()); |
|||
assertEquals("Sun, 16 Feb 2014 07:00:00 GMT", |
|||
(new Date(2014, 1, 16, 4, 0)).toUTCString()); |
|||
} |
|||
|
|||
if (timezone("PST")) { |
|||
assertEquals("Sat Mar 08 2014 22:59:00 GMT-0800 (PST)", |
|||
(new Date(2014, 2, 8, 22, 59)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 06:59:00 GMT", |
|||
(new Date(2014, 2, 8, 22, 59)).toUTCString()); |
|||
assertEquals("Sat Mar 08 2014 23:00:00 GMT-0800 (PST)", |
|||
(new Date(2014, 2, 8, 23, 0)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 07:00:00 GMT", |
|||
(new Date(2014, 2, 8, 23, 0)).toUTCString()); |
|||
assertEquals("Sat Mar 08 2014 23:59:00 GMT-0800 (PST)", |
|||
(new Date(2014, 2, 8, 23, 59)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 07:59:00 GMT", |
|||
(new Date(2014, 2, 8, 23, 59)).toUTCString()); |
|||
assertEquals("Sun Mar 09 2014 00:00:00 GMT-0800 (PST)", |
|||
(new Date(2014, 2, 9, 0, 0)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 08:00:00 GMT", |
|||
(new Date(2014, 2, 9, 0, 0)).toUTCString()); |
|||
assertEquals("Sun Mar 09 2014 00:59:00 GMT-0800 (PST)", |
|||
(new Date(2014, 2, 9, 0, 59)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 08:59:00 GMT", |
|||
(new Date(2014, 2, 9, 0, 59)).toUTCString()); |
|||
assertEquals("Sun Mar 09 2014 01:00:00 GMT-0800 (PST)", |
|||
(new Date(2014, 2, 9, 1, 0)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 09:00:00 GMT", |
|||
(new Date(2014, 2, 9, 1, 0)).toUTCString()); |
|||
assertEquals("Sun Mar 09 2014 01:59:00 GMT-0800 (PST)", |
|||
(new Date(2014, 2, 9, 1, 59)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 09:59:00 GMT", |
|||
(new Date(2014, 2, 9, 1, 59)).toUTCString()); |
|||
assertEquals("Sun Mar 09 2014 03:00:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 2, 9, 2, 0)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 10:00:00 GMT", |
|||
(new Date(2014, 2, 9, 2, 0)).toUTCString()); |
|||
assertEquals("Sun Mar 09 2014 03:59:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 2, 9, 2, 59)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 10:59:00 GMT", |
|||
(new Date(2014, 2, 9, 2, 59)).toUTCString()); |
|||
assertEquals("Sun Mar 09 2014 03:00:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 2, 9, 3, 0)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 10:00:00 GMT", |
|||
(new Date(2014, 2, 9, 3, 0)).toUTCString()); |
|||
assertEquals("Sun Mar 09 2014 03:59:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 2, 9, 3, 59)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 10:59:00 GMT", |
|||
(new Date(2014, 2, 9, 3, 59)).toUTCString()); |
|||
assertEquals("Sun Mar 09 2014 04:00:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 2, 9, 4, 0)).toString()); |
|||
assertEquals("Sun, 09 Mar 2014 11:00:00 GMT", |
|||
(new Date(2014, 2, 9, 4, 0)).toUTCString()); |
|||
assertEquals("Sat Nov 01 2014 22:59:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 10, 1, 22, 59)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 05:59:00 GMT", |
|||
(new Date(2014, 10, 1, 22, 59)).toUTCString()); |
|||
assertEquals("Sat Nov 01 2014 23:00:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 10, 1, 23, 0)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 06:00:00 GMT", |
|||
(new Date(2014, 10, 1, 23, 0)).toUTCString()); |
|||
assertEquals("Sat Nov 01 2014 23:59:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 10, 1, 23, 59)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 06:59:00 GMT", |
|||
(new Date(2014, 10, 1, 23, 59)).toUTCString()); |
|||
assertEquals("Sun Nov 02 2014 00:00:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 10, 2, 0, 0)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 07:00:00 GMT", |
|||
(new Date(2014, 10, 2, 0, 0)).toUTCString()); |
|||
assertEquals("Sun Nov 02 2014 00:59:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 10, 2, 0, 59)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 07:59:00 GMT", |
|||
(new Date(2014, 10, 2, 0, 59)).toUTCString()); |
|||
assertEquals("Sun Nov 02 2014 01:00:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 10, 2, 1, 0)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 08:00:00 GMT", |
|||
(new Date(2014, 10, 2, 1, 0)).toUTCString()); |
|||
assertEquals("Sun Nov 02 2014 01:59:00 GMT-0700 (PDT)", |
|||
(new Date(2014, 10, 2, 1, 59)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 08:59:00 GMT", |
|||
(new Date(2014, 10, 2, 1, 59)).toUTCString()); |
|||
assertEquals("Sun Nov 02 2014 02:00:00 GMT-0800 (PST)", |
|||
(new Date(2014, 10, 2, 2, 0)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 10:00:00 GMT", |
|||
(new Date(2014, 10, 2, 2, 0)).toUTCString()); |
|||
assertEquals("Sun Nov 02 2014 02:59:00 GMT-0800 (PST)", |
|||
(new Date(2014, 10, 2, 2, 59)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 10:59:00 GMT", |
|||
(new Date(2014, 10, 2, 2, 59)).toUTCString()); |
|||
assertEquals("Sun Nov 02 2014 03:00:00 GMT-0800 (PST)", |
|||
(new Date(2014, 10, 2, 3, 0)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 11:00:00 GMT", |
|||
(new Date(2014, 10, 2, 3, 0)).toUTCString()); |
|||
assertEquals("Sun Nov 02 2014 03:59:00 GMT-0800 (PST)", |
|||
(new Date(2014, 10, 2, 3, 59)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 11:59:00 GMT", |
|||
(new Date(2014, 10, 2, 3, 59)).toUTCString()); |
|||
assertEquals("Sun Nov 02 2014 04:00:00 GMT-0800 (PST)", |
|||
(new Date(2014, 10, 2, 4, 0)).toString()); |
|||
assertEquals("Sun, 02 Nov 2014 12:00:00 GMT", |
|||
(new Date(2014, 10, 2, 4, 0)).toUTCString()); |
|||
} |
@ -0,0 +1,22 @@ |
|||
// 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.
|
|||
|
|||
// Flags: --allow-natives-syntax --gc-interval=439 --random-seed=-423594851
|
|||
|
|||
var __v_3; |
|||
function __f_2() { |
|||
var __v_1 = new Array(3); |
|||
__v_1[0] = 10; |
|||
__v_1[1] = 15.5; |
|||
__v_3 = __f_2(); |
|||
__v_1[2] = 20; |
|||
return __v_1; |
|||
} |
|||
|
|||
try { |
|||
for (var __v_2 = 0; __v_2 < 3; ++__v_2) { |
|||
__v_3 = __f_2(); |
|||
} |
|||
} |
|||
catch (e) { } |
@ -0,0 +1,18 @@ |
|||
// 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.
|
|||
|
|||
Array.prototype[0] = 777; |
|||
var kElements = 10; |
|||
|
|||
var input_array = []; |
|||
for (var i = 1; i < kElements; i++) { |
|||
input_array[i] = 0.5; |
|||
} |
|||
var output_array = input_array.concat(0.5); |
|||
|
|||
assertEquals(kElements + 1, output_array.length); |
|||
assertEquals(777, output_array[0]); |
|||
for (var j = 1; j < kElements; j++) { |
|||
assertEquals(0.5, output_array[j]); |
|||
} |
@ -0,0 +1,12 @@ |
|||
// 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.
|
|||
|
|||
// Flags: --allow-natives-syntax
|
|||
|
|||
function f(n) { return [0].indexOf((n - n) + 0); } |
|||
|
|||
assertEquals(0, f(.1)); |
|||
assertEquals(0, f(.1)); |
|||
%OptimizeFunctionOnNextCall(f); |
|||
assertEquals(0, f(.1)); |
@ -0,0 +1,10 @@ |
|||
// 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.
|
|||
|
|||
// Flags: --allow-natives-syntax
|
|||
|
|||
var json = '{"a":{"c":2.1,"d":0},"b":{"c":7,"1024":8}}'; |
|||
var data = JSON.parse(json); |
|||
|
|||
data.b.c++; |
@ -0,0 +1,18 @@ |
|||
// 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.
|
|||
|
|||
// Flags: --allow-natives-syntax
|
|||
|
|||
// Test push double as tagged.
|
|||
var a = [{}]; |
|||
function f(a) { |
|||
a.push(Infinity); |
|||
} |
|||
|
|||
f(a); |
|||
f(a); |
|||
f(a); |
|||
%OptimizeFunctionOnNextCall(f); |
|||
f(a); |
|||
assertEquals([{}, Infinity, Infinity, Infinity, Infinity], a); |
@ -0,0 +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.
|
|||
|
|||
var o = JSON.parse('{"\\u0030":100}'); |
|||
assertEquals(100, o[0]); |
@ -0,0 +1,14 @@ |
|||
// 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.
|
|||
|
|||
var a = []; |
|||
a[10000] = 1; |
|||
a.length = 0; |
|||
a[1] = 1; |
|||
a.length = 0; |
|||
assertEquals(undefined, a[1]); |
|||
|
|||
var o = {}; |
|||
Object.freeze(o); |
|||
assertEquals(undefined, o[1]); |
@ -1,5 +0,0 @@ |
|||
// Copyright 2014 the V8 project authors. All rights reserved.
|
|||
// AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY
|
|||
// Flags: --allow-natives-syntax --harmony --harmony-proxies
|
|||
var arg0 = "foo"; |
|||
%CreatePrivateOwnSymbol(arg0); |
File diff suppressed because it is too large
@ -0,0 +1,11 @@ |
|||
shared-library,"shell",0x08048000,0x081ee000 |
|||
shared-library,"/lib32/libm-2.7.so",0xf7db6000,0xf7dd9000 |
|||
shared-library,"ffffe000-fffff000",0xffffe000,0xfffff000 |
|||
profiler,"begin",1 |
|||
code-creation,Stub,0,0x424260,348,"CompareStub_GE" |
|||
code-creation,LazyCompile,0,0x2a8100,18535,"DrawQube 3d-cube.js:188",0xf43abcac, |
|||
code-creation,LazyCompile,0,0x480100,3908,"DrawLine 3d-cube.js:17",0xf43abc50, |
|||
tick,0x424284,0,0,0x480600,0,0x2aaaa5 |
|||
tick,0x42429f,0,0,0x480600,0,0x2aacb4 |
|||
tick,0x48063d,0,0,0x2d0f7c,0,0x2aaec6 |
|||
profiler,"end" |
@ -0,0 +1,25 @@ |
|||
shared-library,"shell",0x08048000,0x081ee000 |
|||
shared-library,"/lib32/libm-2.7.so",0xf7db6000,0xf7dd9000 |
|||
shared-library,"ffffe000-fffff000",0xffffe000,0xfffff000 |
|||
profiler,"begin",1 |
|||
code-creation,Stub,0,0xf540a100,474,"CEntryStub" |
|||
code-creation,Script,0,0xf541cd80,736,"exp.js" |
|||
code-creation,Stub,0,0xf541d0e0,47,"RuntimeStub_Math_exp" |
|||
code-creation,LazyCompile,0,0xf541d120,145,"exp native math.js:41" |
|||
function-creation,0xf441d280,0xf541d120 |
|||
code-creation,LoadIC,0,0xf541d280,117,"j" |
|||
code-creation,LoadIC,0,0xf541d360,63,"i" |
|||
tick,0x80f82d1,0,0,0,0,0xf541ce5c |
|||
tick,0x80f89a1,0,0,0,0,0xf541ce5c |
|||
tick,0x8123b5c,0,0,0,0,0xf541d1a1,0xf541ceea |
|||
tick,0x8123b65,0,0,0,0,0xf541d1a1,0xf541ceea |
|||
tick,0xf541d2be,0,0,0,0 |
|||
tick,0xf541d320,0,0,0,0 |
|||
tick,0xf541d384,0,0,0,0 |
|||
tick,0xf7db94da,0,0,0,0,0xf541d1a1,0xf541ceea |
|||
tick,0xf7db951c,0,0,0,0,0xf541d1a1,0xf541ceea |
|||
tick,0xf7dbc508,0,0,0,0,0xf541d1a1,0xf541ceea |
|||
tick,0xf7dbff21,0,0,0,0,0xf541d1a1,0xf541ceea |
|||
tick,0xf7edec90,0,0,0,0,0xf541d1a1,0xf541ceea |
|||
tick,0xffffe402,0,0,0,0 |
|||
profiler,"end" |
@ -1,34 +0,0 @@ |
|||
// 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.
|
|||
|
|||
#ifndef V8_TESTING_GTEST_TYPE_NAMES_H_ |
|||
#define V8_TESTING_GTEST_TYPE_NAMES_H_ |
|||
|
|||
#include "include/v8stdint.h" |
|||
#include "testing/gtest/include/gtest/gtest.h" |
|||
|
|||
namespace testing { |
|||
namespace internal { |
|||
|
|||
#define GET_TYPE_NAME(type) \ |
|||
template <> \ |
|||
std::string GetTypeName<type>() { \ |
|||
return #type; \ |
|||
} |
|||
GET_TYPE_NAME(int8_t) |
|||
GET_TYPE_NAME(uint8_t) |
|||
GET_TYPE_NAME(int16_t) |
|||
GET_TYPE_NAME(uint16_t) |
|||
GET_TYPE_NAME(int32_t) |
|||
GET_TYPE_NAME(uint32_t) |
|||
GET_TYPE_NAME(int64_t) |
|||
GET_TYPE_NAME(uint64_t) |
|||
GET_TYPE_NAME(float) |
|||
GET_TYPE_NAME(double) |
|||
#undef GET_TYPE_NAME |
|||
|
|||
} // namespace internal
|
|||
} // namespace testing
|
|||
|
|||
#endif // V8_TESTING_GTEST_TYPE_NAMES_H_
|
@ -0,0 +1,11 @@ |
|||
The Xcode project for V8 has been retired. If an Xcode project |
|||
is needed for building on a Mac there is the option of using GYP to |
|||
generate it. Please look in the build directory in the root of the |
|||
V8 project. It contains the required infrastructure and a README.txt |
|||
file explaining how to get started. |
|||
|
|||
Generating Xcode projects using GYP is how the Chromium |
|||
project integrated V8 into the Mac build. |
|||
|
|||
The main build system for V8 is still SCons, see |
|||
http://code.google.com/apis/v8/build.html for details. |
Loading…
Reference in new issue