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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 | 29 |
30 #include "v8.h" | 30 #include "v8.h" |
31 #include "cctest.h" | 31 #include "cctest.h" |
32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
33 | 33 |
34 | 34 |
35 using namespace v8::internal; | 35 using namespace v8::internal; |
36 | 36 |
37 #define Types CompareNilICStub::Types | 37 typedef CompareNilICStub::State State; |
38 | 38 |
39 TEST(TypeConstructors) { | 39 TEST(StateConstructors) { |
40 Types types; | 40 State state; |
41 types.Add(CompareNilICStub::MONOMORPHIC_MAP); | 41 state.Add(CompareNilICStub::MONOMORPHIC_MAP); |
42 Types types2(types); | 42 State state2(state); |
43 CHECK_EQ(types.ToIntegral(), types2.ToIntegral()); | 43 CHECK_EQ(state.ToIntegral(), state2.ToIntegral()); |
44 } | 44 } |
45 | 45 |
46 TEST(ExternalICStateParsing) { | 46 TEST(ExternalICStateParsing) { |
47 Types types; | 47 State state; |
48 types.Add(CompareNilICStub::UNDEFINED); | 48 state.Add(CompareNilICStub::UNDEFINED); |
49 CompareNilICStub stub(kUndefinedValue, types); | 49 CompareNilICStub stub(kUndefinedValue, state); |
50 CompareNilICStub stub2(stub.GetExtraICState()); | 50 CompareNilICStub stub2(stub.GetExtraICState()); |
51 CHECK_EQ(stub.GetNilValue(), stub2.GetNilValue()); | 51 CHECK_EQ(stub.GetNilValue(), stub2.GetNilValue()); |
52 CHECK_EQ(stub.GetTypes().ToIntegral(), stub2.GetTypes().ToIntegral()); | 52 CHECK_EQ(stub.GetState().ToIntegral(), stub2.GetState().ToIntegral()); |
53 } | 53 } |
54 | 54 |
55 TEST(SettingTypes) { | 55 TEST(SettingState) { |
56 Types state; | 56 State state; |
57 CHECK(state.IsEmpty()); | 57 CHECK(state.IsEmpty()); |
58 state.Add(CompareNilICStub::NULL_TYPE); | 58 state.Add(CompareNilICStub::NULL_TYPE); |
59 CHECK(!state.IsEmpty()); | 59 CHECK(!state.IsEmpty()); |
60 CHECK(state.Contains(CompareNilICStub::NULL_TYPE)); | 60 CHECK(state.Contains(CompareNilICStub::NULL_TYPE)); |
61 CHECK(!state.Contains(CompareNilICStub::UNDEFINED)); | 61 CHECK(!state.Contains(CompareNilICStub::UNDEFINED)); |
62 CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE)); | 62 CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE)); |
63 state.Add(CompareNilICStub::UNDEFINED); | 63 state.Add(CompareNilICStub::UNDEFINED); |
64 CHECK(state.Contains(CompareNilICStub::UNDEFINED)); | 64 CHECK(state.Contains(CompareNilICStub::UNDEFINED)); |
65 CHECK(state.Contains(CompareNilICStub::NULL_TYPE)); | 65 CHECK(state.Contains(CompareNilICStub::NULL_TYPE)); |
66 CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE)); | 66 CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE)); |
67 } | 67 } |
68 | 68 |
69 TEST(ClearTypes) { | 69 TEST(ClearState) { |
70 Types state; | 70 State state; |
71 state.Add(CompareNilICStub::NULL_TYPE); | 71 state.Add(CompareNilICStub::NULL_TYPE); |
72 state.RemoveAll(); | 72 state.RemoveAll(); |
73 CHECK(state.IsEmpty()); | 73 CHECK(state.IsEmpty()); |
74 } | 74 } |
75 | 75 |
76 TEST(FullCompare) { | 76 TEST(Generic) { |
77 Types state; | 77 State state; |
78 CHECK(Types::FullCompare() != state); | 78 CHECK(State::Generic() != state); |
79 state.Add(CompareNilICStub::UNDEFINED); | 79 state.Add(CompareNilICStub::UNDEFINED); |
80 CHECK(state != Types::FullCompare()); | 80 CHECK(state != State::Generic()); |
81 state.Add(CompareNilICStub::NULL_TYPE); | 81 state.Add(CompareNilICStub::NULL_TYPE); |
82 CHECK(state != Types::FullCompare()); | 82 CHECK(state != State::Generic()); |
83 state.Add(CompareNilICStub::UNDETECTABLE); | 83 state.Add(CompareNilICStub::UNDETECTABLE); |
84 CHECK(state == Types::FullCompare()); | 84 CHECK(state != State::Generic()); |
| 85 state.Add(CompareNilICStub::GENERIC); |
| 86 CHECK(state == State::Generic()); |
85 } | 87 } |
OLD | NEW |