Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: runtime/lib/array.cc

Issue 139663003: Fix 16099: Invocation's positionalArguments contains an immutable array. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/lib/array.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
115 DEFINE_NATIVE_ENTRY(ImmutableList_from, 4) {
116 // Ignore first argument of a thsi factory (type argument).
117 const Array& from_array = Array::CheckedHandle(arguments->NativeArgAt(1));
118 const Smi& smi_offset = Smi::CheckedHandle(arguments->NativeArgAt(2));
119 const Smi& smi_length = Smi::CheckedHandle(arguments->NativeArgAt(3));
120 const intptr_t length = smi_length.Value();
121 const intptr_t offset = smi_offset.Value();
122 const Array& result = Array::Handle(Array::New(length));
123 Object& temp = Object::Handle();
124 for (intptr_t i = 0; i < length; i++) {
125 temp = from_array.At(i + offset);
126 result.SetAt(i, temp);
127 }
128 result.MakeImmutable();
129 return result.raw();
130 }
131
113 } // namespace dart 132 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698