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

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

Issue 2941643002: Check for a passed-in type argument vector in the prolog of generic functions. (Closed)
Patch Set: address review comments Created 3 years, 6 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
« no previous file with comments | « runtime/lib/internal_patch.dart ('k') | runtime/lib/object_patch.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 354
355 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { 355 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) {
356 #if defined(ARCH_IS_64_BIT) 356 #if defined(ARCH_IS_64_BIT)
357 return Bool::True().raw(); 357 return Bool::True().raw();
358 #else 358 #else
359 return Bool::False().raw(); 359 return Bool::False().raw();
360 #endif // defined(ARCH_IS_64_BIT) 360 #endif // defined(ARCH_IS_64_BIT)
361 } 361 }
362 362
363
364 DEFINE_NATIVE_ENTRY(Internal_prependTypeArguments, 3) {
365 const TypeArguments& function_type_arguments =
366 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0));
367 const TypeArguments& parent_type_arguments =
368 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
369 if (function_type_arguments.IsNull() && parent_type_arguments.IsNull()) {
370 return TypeArguments::null();
371 }
372 GET_NON_NULL_NATIVE_ARGUMENT(Smi, smi_len, arguments->NativeArgAt(2));
373 const intptr_t len = smi_len.Value();
374 const TypeArguments& result =
375 TypeArguments::Handle(zone, TypeArguments::New(len, Heap::kNew));
376 AbstractType& type = AbstractType::Handle(zone);
377 const intptr_t split = parent_type_arguments.IsNull()
378 ? len - function_type_arguments.Length()
379 : parent_type_arguments.Length();
380 for (intptr_t i = 0; i < split; i++) {
381 type = parent_type_arguments.IsNull() ? Type::DynamicType()
382 : parent_type_arguments.TypeAt(i);
383 result.SetTypeAt(i, type);
384 }
385 for (intptr_t i = split; i < len; i++) {
386 type = function_type_arguments.IsNull()
387 ? Type::DynamicType()
388 : function_type_arguments.TypeAt(i - split);
389 result.SetTypeAt(i, type);
390 }
391 return result.Canonicalize();
392 }
393
363 } // namespace dart 394 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/internal_patch.dart ('k') | runtime/lib/object_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698