| OLD | NEW |
| 1 // Copyright 2006-2013 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 typedef CompareNilICStub::State State; | 37 typedef CompareNilICStub::State State; |
| 38 | 38 |
| 39 TEST(StateConstructors) { | 39 TEST(StateConstructors) { |
| 40 State state; | 40 State state; |
| 41 state.Add(CompareNilICStub::MONOMORPHIC_MAP); | 41 state.Add(CompareNilICStub::MONOMORPHIC_MAP); |
| 42 State state2(state); | 42 State state2(state); |
| 43 CHECK_EQ(state.ToIntegral(), state2.ToIntegral()); | 43 CHECK_EQ(state.ToIntegral(), state2.ToIntegral()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 |
| 46 TEST(ExternalICStateParsing) { | 47 TEST(ExternalICStateParsing) { |
| 47 State state; | 48 State state; |
| 48 state.Add(CompareNilICStub::UNDEFINED); | 49 state.Add(CompareNilICStub::UNDEFINED); |
| 49 CompareNilICStub stub(kUndefinedValue, state); | 50 CompareNilICStub stub(kUndefinedValue, state); |
| 50 CompareNilICStub stub2(stub.GetExtraICState()); | 51 CompareNilICStub stub2(stub.GetExtraICState()); |
| 51 CHECK_EQ(stub.GetNilValue(), stub2.GetNilValue()); | 52 CHECK_EQ(stub.GetNilValue(), stub2.GetNilValue()); |
| 52 CHECK_EQ(stub.GetState().ToIntegral(), stub2.GetState().ToIntegral()); | 53 CHECK_EQ(stub.GetState().ToIntegral(), stub2.GetState().ToIntegral()); |
| 53 } | 54 } |
| 54 | 55 |
| 56 |
| 55 TEST(SettingState) { | 57 TEST(SettingState) { |
| 56 State state; | 58 State state; |
| 57 CHECK(state.IsEmpty()); | 59 CHECK(state.IsEmpty()); |
| 58 state.Add(CompareNilICStub::NULL_TYPE); | 60 state.Add(CompareNilICStub::NULL_TYPE); |
| 59 CHECK(!state.IsEmpty()); | 61 CHECK(!state.IsEmpty()); |
| 60 CHECK(state.Contains(CompareNilICStub::NULL_TYPE)); | 62 CHECK(state.Contains(CompareNilICStub::NULL_TYPE)); |
| 61 CHECK(!state.Contains(CompareNilICStub::UNDEFINED)); | 63 CHECK(!state.Contains(CompareNilICStub::UNDEFINED)); |
| 62 CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE)); | 64 CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE)); |
| 63 state.Add(CompareNilICStub::UNDEFINED); | 65 state.Add(CompareNilICStub::UNDEFINED); |
| 64 CHECK(state.Contains(CompareNilICStub::UNDEFINED)); | 66 CHECK(state.Contains(CompareNilICStub::UNDEFINED)); |
| 65 CHECK(state.Contains(CompareNilICStub::NULL_TYPE)); | 67 CHECK(state.Contains(CompareNilICStub::NULL_TYPE)); |
| 66 CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE)); | 68 CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE)); |
| 67 } | 69 } |
| 68 | 70 |
| 71 |
| 69 TEST(ClearState) { | 72 TEST(ClearState) { |
| 70 State state; | 73 State state; |
| 71 state.Add(CompareNilICStub::NULL_TYPE); | 74 state.Add(CompareNilICStub::NULL_TYPE); |
| 72 state.RemoveAll(); | 75 state.RemoveAll(); |
| 73 CHECK(state.IsEmpty()); | 76 CHECK(state.IsEmpty()); |
| 74 } | 77 } |
| 75 | 78 |
| 79 |
| 76 TEST(Generic) { | 80 TEST(Generic) { |
| 77 State state; | 81 State state; |
| 78 CHECK(State::Generic() != state); | 82 CHECK(State::Generic() != state); |
| 79 state.Add(CompareNilICStub::UNDEFINED); | 83 state.Add(CompareNilICStub::UNDEFINED); |
| 80 CHECK(state != State::Generic()); | 84 CHECK(state != State::Generic()); |
| 81 state.Add(CompareNilICStub::NULL_TYPE); | 85 state.Add(CompareNilICStub::NULL_TYPE); |
| 82 CHECK(state != State::Generic()); | 86 CHECK(state != State::Generic()); |
| 83 state.Add(CompareNilICStub::UNDETECTABLE); | 87 state.Add(CompareNilICStub::UNDETECTABLE); |
| 84 CHECK(state != State::Generic()); | 88 CHECK(state != State::Generic()); |
| 85 state.Add(CompareNilICStub::GENERIC); | 89 state.Add(CompareNilICStub::GENERIC); |
| 86 CHECK(state == State::Generic()); | 90 CHECK(state == State::Generic()); |
| 87 } | 91 } |
| OLD | NEW |