OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/bootstrap_natives.h" | 8 #include "vm/bootstrap_natives.h" |
9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
11 #include "vm/native_entry.h" | 11 #include "vm/native_entry.h" |
12 #include "vm/object.h" | 12 #include "vm/object.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 DEFINE_NATIVE_ENTRY(LinkedHashMap_getIndex, 1) { | 16 DEFINE_NATIVE_ENTRY(LinkedHashMap_getIndex, 1) { |
17 const LinkedHashMap& map = | 17 const LinkedHashMap& map = |
18 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); | 18 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); |
19 return map.index(); | 19 return map.index(); |
20 } | 20 } |
21 | 21 |
22 | 22 |
23 DEFINE_NATIVE_ENTRY(LinkedHashMap_setIndex, 2) { | 23 DEFINE_NATIVE_ENTRY(LinkedHashMap_setIndex, 2) { |
24 const LinkedHashMap& map = | 24 const LinkedHashMap& map = |
25 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); | 25 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); |
26 const TypedData& index = | 26 const TypedData& index = TypedData::CheckedHandle(arguments->NativeArgAt(1)); |
27 TypedData::CheckedHandle(arguments->NativeArgAt(1)); | |
28 map.SetIndex(index); | 27 map.SetIndex(index); |
29 return Object::null(); | 28 return Object::null(); |
30 } | 29 } |
31 | 30 |
32 | 31 |
33 DEFINE_NATIVE_ENTRY(LinkedHashMap_getData, 1) { | 32 DEFINE_NATIVE_ENTRY(LinkedHashMap_getData, 1) { |
34 const LinkedHashMap& map = | 33 const LinkedHashMap& map = |
35 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); | 34 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); |
36 return map.data(); | 35 return map.data(); |
37 } | 36 } |
38 | 37 |
39 | 38 |
40 DEFINE_NATIVE_ENTRY(LinkedHashMap_setData, 2) { | 39 DEFINE_NATIVE_ENTRY(LinkedHashMap_setData, 2) { |
41 const LinkedHashMap& map = | 40 const LinkedHashMap& map = |
42 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); | 41 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); |
43 const Array& data = | 42 const Array& data = Array::CheckedHandle(arguments->NativeArgAt(1)); |
44 Array::CheckedHandle(arguments->NativeArgAt(1)); | |
45 map.SetData(data); | 43 map.SetData(data); |
46 return Object::null(); | 44 return Object::null(); |
47 } | 45 } |
48 | 46 |
49 | 47 |
50 DEFINE_NATIVE_ENTRY(LinkedHashMap_getHashMask, 1) { | 48 DEFINE_NATIVE_ENTRY(LinkedHashMap_getHashMask, 1) { |
51 const LinkedHashMap& map = | 49 const LinkedHashMap& map = |
52 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); | 50 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); |
53 return map.hash_mask(); | 51 return map.hash_mask(); |
54 } | 52 } |
55 | 53 |
56 | 54 |
57 DEFINE_NATIVE_ENTRY(LinkedHashMap_setHashMask, 2) { | 55 DEFINE_NATIVE_ENTRY(LinkedHashMap_setHashMask, 2) { |
58 const LinkedHashMap& map = | 56 const LinkedHashMap& map = |
59 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); | 57 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); |
60 const Smi& hashMask = | 58 const Smi& hashMask = Smi::CheckedHandle(arguments->NativeArgAt(1)); |
61 Smi::CheckedHandle(arguments->NativeArgAt(1)); | |
62 map.SetHashMask(hashMask.Value()); | 59 map.SetHashMask(hashMask.Value()); |
63 return Object::null(); | 60 return Object::null(); |
64 } | 61 } |
65 | 62 |
66 | 63 |
67 DEFINE_NATIVE_ENTRY(LinkedHashMap_getDeletedKeys, 1) { | 64 DEFINE_NATIVE_ENTRY(LinkedHashMap_getDeletedKeys, 1) { |
68 const LinkedHashMap& map = | 65 const LinkedHashMap& map = |
69 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); | 66 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); |
70 return map.deleted_keys(); | 67 return map.deleted_keys(); |
71 } | 68 } |
72 | 69 |
73 | 70 |
74 DEFINE_NATIVE_ENTRY(LinkedHashMap_setDeletedKeys, 2) { | 71 DEFINE_NATIVE_ENTRY(LinkedHashMap_setDeletedKeys, 2) { |
75 const LinkedHashMap& map = | 72 const LinkedHashMap& map = |
76 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); | 73 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); |
77 const Smi& deletedKeys = | 74 const Smi& deletedKeys = Smi::CheckedHandle(arguments->NativeArgAt(1)); |
78 Smi::CheckedHandle(arguments->NativeArgAt(1)); | |
79 map.SetDeletedKeys(deletedKeys.Value()); | 75 map.SetDeletedKeys(deletedKeys.Value()); |
80 return Object::null(); | 76 return Object::null(); |
81 } | 77 } |
82 | 78 |
83 | 79 |
84 DEFINE_NATIVE_ENTRY(LinkedHashMap_getUsedData, 1) { | 80 DEFINE_NATIVE_ENTRY(LinkedHashMap_getUsedData, 1) { |
85 const LinkedHashMap& map = | 81 const LinkedHashMap& map = |
86 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); | 82 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); |
87 return map.used_data(); | 83 return map.used_data(); |
88 } | 84 } |
89 | 85 |
90 | 86 |
91 DEFINE_NATIVE_ENTRY(LinkedHashMap_setUsedData, 2) { | 87 DEFINE_NATIVE_ENTRY(LinkedHashMap_setUsedData, 2) { |
92 const LinkedHashMap& map = | 88 const LinkedHashMap& map = |
93 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); | 89 LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0)); |
94 const Smi& usedData = | 90 const Smi& usedData = Smi::CheckedHandle(arguments->NativeArgAt(1)); |
95 Smi::CheckedHandle(arguments->NativeArgAt(1)); | |
96 map.SetUsedData(usedData.Value()); | 91 map.SetUsedData(usedData.Value()); |
97 return Object::null(); | 92 return Object::null(); |
98 } | 93 } |
99 | 94 |
100 } // namespace dart | 95 } // namespace dart |
OLD | NEW |