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

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

Issue 8476002: Fix more co19 crashes. Introduce GET_NATIVE_ARGUMENT that throws an illegal argument exception if... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month 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 | « runtime/lib/integers.cc ('k') | runtime/lib/string.cc » ('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 "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/native_entry.h" 8 #include "vm/native_entry.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 DEFINE_NATIVE_ENTRY(Object_toString, 1) { 13 DEFINE_NATIVE_ENTRY(Object_toString, 1) {
14 const Instance& instance = Instance::CheckedHandle(arguments->At(0)); 14 const Instance& instance = Instance::CheckedHandle(arguments->At(0));
15 const char* c_str = instance.ToCString(); 15 const char* c_str = instance.ToCString();
16 arguments->SetReturn(String::Handle(String::New(c_str))); 16 arguments->SetReturn(String::Handle(String::New(c_str)));
17 } 17 }
18 18
19 19
20 DEFINE_NATIVE_ENTRY(Object_noSuchMethod, 3) { 20 DEFINE_NATIVE_ENTRY(Object_noSuchMethod, 3) {
21 const Instance& instance = Instance::CheckedHandle(arguments->At(0)); 21 const Instance& instance = Instance::CheckedHandle(arguments->At(0));
22 const String& function_name = String::CheckedHandle(arguments->At(1));
23 const Array& func_args = Array::CheckedHandle(arguments->At(2));
24 if (instance.IsNull()) { 22 if (instance.IsNull()) {
25 GrowableArray<const Object*> args; 23 GrowableArray<const Object*> args;
26 Exceptions::ThrowByType(Exceptions::kNullPointer, args); 24 Exceptions::ThrowByType(Exceptions::kNullPointer, args);
27 } 25 }
26 GET_NATIVE_ARGUMENT(String, function_name, arguments->At(1));
27 GET_NATIVE_ARGUMENT(Array, func_args, arguments->At(2));
28 GrowableArray<const Object*> dart_arguments(3); 28 GrowableArray<const Object*> dart_arguments(3);
29 dart_arguments.Add(&instance); 29 dart_arguments.Add(&instance);
30 dart_arguments.Add(&function_name); 30 dart_arguments.Add(&function_name);
31 dart_arguments.Add(&func_args); 31 dart_arguments.Add(&func_args);
32 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments); 32 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments);
33 } 33 }
34 34
35 } // namespace dart 35 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/integers.cc ('k') | runtime/lib/string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698