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

Unified Diff: runtime/lib/byte_buffer.cc

Issue 8678025: Fix crashes when going to natives. Throw an exception instead. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/array.cc ('k') | runtime/lib/double.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/byte_buffer.cc
===================================================================
--- runtime/lib/byte_buffer.cc (revision 1815)
+++ runtime/lib/byte_buffer.cc (working copy)
@@ -14,14 +14,7 @@
namespace dart {
DEFINE_NATIVE_ENTRY(ByteBuffer_allocate, 1) {
- const Instance& length_instance = Instance::CheckedHandle(arguments->At(0));
- if (!length_instance.IsSmi()) {
- GrowableArray<const Object*> args;
- args.Add(&length_instance);
- Exceptions::ThrowByType(Exceptions::kIllegalArgument, args);
- }
- Smi& length = Smi::Handle();
- length ^= length_instance.raw();
+ GET_NATIVE_ARGUMENT(Smi, length, arguments->At(0));
if (length.Value() < 0) {
GrowableArray<const Object*> args;
args.Add(&length);
@@ -37,11 +30,6 @@
DEFINE_NATIVE_ENTRY(ByteBuffer_getLength, 1) {
const ByteBuffer& array = ByteBuffer::CheckedHandle(arguments->At(0));
- if (array.IsNull()) {
- // TODO(asiva): Need to handle error cases.
- UNIMPLEMENTED();
- return;
- }
const Smi& length = Smi::Handle(Smi::New(array.Length()));
arguments->SetReturn(length);
}
« no previous file with comments | « runtime/lib/array.cc ('k') | runtime/lib/double.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698