Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
| 10 #include "vm/native_entry.h" | 10 #include "vm/native_entry.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 } | 103 } |
| 104 } else { | 104 } else { |
| 105 for (intptr_t i = 0; i < icount; i++) { | 105 for (intptr_t i = 0; i < icount; i++) { |
| 106 src_obj = source.At(isrc_start + i); | 106 src_obj = source.At(isrc_start + i); |
| 107 dest.SetAt(idst_start + i, src_obj); | 107 dest.SetAt(idst_start + i, src_obj); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 return Object::null(); | 110 return Object::null(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 | |
| 114 // Private factory, expects correct arguments. | |
|
siva
2014/01/15 18:35:09
We should add a comment here that the first argume
srdjan
2014/01/15 19:04:26
Done.
| |
| 115 DEFINE_NATIVE_ENTRY(ImmutableList_from, 4) { | |
| 116 const Array& from_array = Array::CheckedHandle(arguments->NativeArgAt(1)); | |
| 117 const Smi& smi_offset = Smi::CheckedHandle(arguments->NativeArgAt(2)); | |
| 118 const Smi& smi_length = Smi::CheckedHandle(arguments->NativeArgAt(3)); | |
| 119 const intptr_t length = smi_length.Value(); | |
| 120 const intptr_t offset = smi_offset.Value(); | |
| 121 const Array& result = Array::Handle(Array::New(length)); | |
| 122 Object& temp = Object::Handle(); | |
| 123 for (intptr_t i = 0; i < length; i++) { | |
| 124 temp = from_array.At(i + offset); | |
| 125 result.SetAt(i, temp); | |
| 126 } | |
| 127 result.MakeImmutable(); | |
| 128 return result.raw(); | |
| 129 } | |
| 130 | |
| 113 } // namespace dart | 131 } // namespace dart |
| OLD | NEW |