OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
11 #include "src/execution.h" | 11 #include "src/execution.h" |
12 #include "src/factory.h" | 12 #include "src/factory.h" |
13 #include "src/field-type.h" | 13 #include "src/field-type.h" |
14 #include "src/global-handles.h" | 14 #include "src/global-handles.h" |
15 // FIXME(mstarzinger, marja): This is weird, but required because of the missing | 15 // FIXME(mstarzinger, marja): This is weird, but required because of the missing |
16 // (disallowed) include: src/field-type.h -> src/objects-inl.h | 16 // (disallowed) include: src/field-type.h -> src/objects-inl.h |
17 #include "src/objects-inl.h" | 17 #include "src/objects-inl.h" |
18 #include "src/transitions.h" | 18 #include "src/transitions.h" |
19 #include "test/cctest/cctest.h" | 19 #include "test/cctest/cctest.h" |
20 | 20 |
21 using namespace v8::internal; | 21 using namespace v8::internal; |
22 | 22 |
23 | 23 |
24 // | 24 // |
25 // Helper functions. | 25 // Helper functions. |
26 // | 26 // |
27 | 27 |
28 static void CheckPropertyDetailsFieldsConsistency(PropertyType type, | |
29 PropertyKind kind, | |
30 PropertyLocation location) { | |
31 int type_value = PropertyDetails::TypeField::encode(type); | |
32 int kind_location_value = PropertyDetails::KindField::encode(kind) | | |
33 PropertyDetails::LocationField::encode(location); | |
34 CHECK_EQ(type_value, kind_location_value); | |
35 } | |
36 | |
37 | |
38 TEST(PropertyDetailsFieldsConsistency) { | |
39 CheckPropertyDetailsFieldsConsistency(DATA, kData, kField); | |
40 CheckPropertyDetailsFieldsConsistency(DATA_CONSTANT, kData, kDescriptor); | |
41 CheckPropertyDetailsFieldsConsistency(ACCESSOR, kAccessor, kField); | |
42 CheckPropertyDetailsFieldsConsistency(ACCESSOR_CONSTANT, kAccessor, | |
43 kDescriptor); | |
44 } | |
45 | |
46 | |
47 TEST(TransitionArray_SimpleFieldTransitions) { | 28 TEST(TransitionArray_SimpleFieldTransitions) { |
48 CcTest::InitializeVM(); | 29 CcTest::InitializeVM(); |
49 v8::HandleScope scope(CcTest::isolate()); | 30 v8::HandleScope scope(CcTest::isolate()); |
50 Isolate* isolate = CcTest::i_isolate(); | 31 Isolate* isolate = CcTest::i_isolate(); |
51 Factory* factory = isolate->factory(); | 32 Factory* factory = isolate->factory(); |
52 | 33 |
53 Handle<String> name1 = factory->InternalizeUtf8String("foo"); | 34 Handle<String> name1 = factory->InternalizeUtf8String("foo"); |
54 Handle<String> name2 = factory->InternalizeUtf8String("bar"); | 35 Handle<String> name2 = factory->InternalizeUtf8String("bar"); |
55 PropertyAttributes attributes = NONE; | 36 PropertyAttributes attributes = NONE; |
56 | 37 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 break; | 290 break; |
310 } | 291 } |
311 } | 292 } |
312 } | 293 } |
313 } | 294 } |
314 | 295 |
315 #ifdef DEBUG | 296 #ifdef DEBUG |
316 CHECK(TransitionArray::IsSortedNoDuplicates(*map0)); | 297 CHECK(TransitionArray::IsSortedNoDuplicates(*map0)); |
317 #endif | 298 #endif |
318 } | 299 } |
OLD | NEW |