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 |
3 | // BSD-style license that can be found in the LICENSE file. |
4 | |
5 | #include "platform/assert.h" |
6 | |
7 | #include "vm/bootstrap_natives.h" |
8 | #include "vm/exceptions.h" |
9 | #include "vm/flags.h" |
10 | #include "vm/native_entry.h" |
11 | #include "vm/object.h" |
12 | |
13 | namespace dart { |
14 | |
15 | DEFINE_NATIVE_ENTRY(LinkedHashMap_getIndex, 0, 1) { |
16 | const LinkedHashMap& map = |
17 | LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); |
18 | return map.index(); |
19 | } |
20 | |
21 | DEFINE_NATIVE_ENTRY(LinkedHashMap_setIndex, 0, 2) { |
22 | const LinkedHashMap& map = |
23 | LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); |
24 | const TypedData& index = |
25 | TypedData::CheckedHandle(zone, arguments->NativeArgAt(1)); |
26 | map.SetIndex(index); |
27 | return Object::null(); |
28 | } |
29 | |
30 | DEFINE_NATIVE_ENTRY(LinkedHashMap_getData, 0, 1) { |
31 | const LinkedHashMap& map = |
32 | LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); |
33 | return map.data(); |
34 | } |
35 | |
36 | DEFINE_NATIVE_ENTRY(LinkedHashMap_setData, 0, 2) { |
37 | const LinkedHashMap& map = |
38 | LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); |
39 | const Array& data = Array::CheckedHandle(zone, arguments->NativeArgAt(1)); |
40 | map.SetData(data); |
41 | return Object::null(); |
42 | } |
43 | |
44 | DEFINE_NATIVE_ENTRY(LinkedHashMap_getHashMask, 0, 1) { |
45 | const LinkedHashMap& map = |
46 | LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); |
47 | return map.hash_mask(); |
48 | } |
49 | |
50 | DEFINE_NATIVE_ENTRY(LinkedHashMap_setHashMask, 0, 2) { |
51 | const LinkedHashMap& map = |
52 | LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); |
53 | const Smi& hashMask = Smi::CheckedHandle(zone, arguments->NativeArgAt(1)); |
54 | map.SetHashMask(hashMask.Value()); |
55 | return Object::null(); |
56 | } |
57 | |
58 | DEFINE_NATIVE_ENTRY(LinkedHashMap_getDeletedKeys, 0, 1) { |
59 | const LinkedHashMap& map = |
60 | LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); |
61 | return map.deleted_keys(); |
62 | } |
63 | |
64 | DEFINE_NATIVE_ENTRY(LinkedHashMap_setDeletedKeys, 0, 2) { |
65 | const LinkedHashMap& map = |
66 | LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); |
67 | const Smi& deletedKeys = Smi::CheckedHandle(zone, arguments->NativeArgAt(1)); |
68 | map.SetDeletedKeys(deletedKeys.Value()); |
69 | return Object::null(); |
70 | } |
71 | |
72 | DEFINE_NATIVE_ENTRY(LinkedHashMap_getUsedData, 0, 1) { |
73 | const LinkedHashMap& map = |
74 | LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); |
75 | return map.used_data(); |
76 | } |
77 | |
78 | DEFINE_NATIVE_ENTRY(LinkedHashMap_setUsedData, 0, 2) { |
79 | const LinkedHashMap& map = |
80 | LinkedHashMap::CheckedHandle(zone, arguments->NativeArgAt(0)); |
81 | const Smi& usedData = Smi::CheckedHandle(zone, arguments->NativeArgAt(1)); |
82 | map.SetUsedData(usedData.Value()); |
83 | return Object::null(); |
84 | } |
85 | |
86 | } // namespace dart |
87 | |