| Index: runtime/vm/dart_entry.cc
|
| ===================================================================
|
| --- runtime/vm/dart_entry.cc (revision 3821)
|
| +++ runtime/vm/dart_entry.cc (working copy)
|
| @@ -6,13 +6,14 @@
|
|
|
| #include "vm/code_generator.h"
|
| #include "vm/compiler.h"
|
| +#include "vm/longjump.h"
|
| #include "vm/object_store.h"
|
| #include "vm/resolver.h"
|
| #include "vm/stub_code.h"
|
|
|
| namespace dart {
|
|
|
| -RawObject* DartEntry::InvokeDynamic(
|
| +RawInstance* DartEntry::InvokeDynamic(
|
| const Instance& receiver,
|
| const Function& function,
|
| const GrowableArray<const Object*>& arguments,
|
| @@ -21,10 +22,7 @@
|
| // will result in a compilation of the function if it is not already
|
| // compiled.
|
| if (!function.HasCode()) {
|
| - const Error& error = Error::Handle(Compiler::CompileFunction(function));
|
| - if (!error.IsNull()) {
|
| - return error.raw();
|
| - }
|
| + Compiler::CompileFunction(function);
|
| }
|
| const Code& code = Code::Handle(function.code());
|
| ASSERT(!code.IsNull());
|
| @@ -55,7 +53,7 @@
|
| }
|
|
|
|
|
| -RawObject* DartEntry::InvokeStatic(
|
| +RawInstance* DartEntry::InvokeStatic(
|
| const Function& function,
|
| const GrowableArray<const Object*>& arguments,
|
| const Array& optional_arguments_names) {
|
| @@ -64,10 +62,7 @@
|
| // compiled.
|
| ASSERT(!function.IsNull());
|
| if (!function.HasCode()) {
|
| - const Error& error = Error::Handle(Compiler::CompileFunction(function));
|
| - if (!error.IsNull()) {
|
| - return error.raw();
|
| - }
|
| + Compiler::CompileFunction(function);
|
| }
|
| const Code& code = Code::Handle(function.code());
|
| ASSERT(!code.IsNull());
|
| @@ -89,7 +84,7 @@
|
| }
|
|
|
|
|
| -RawObject* DartEntry::InvokeClosure(
|
| +RawInstance* DartEntry::InvokeClosure(
|
| const Closure& closure,
|
| const GrowableArray<const Object*>& arguments,
|
| const Array& optional_arguments_names) {
|
| @@ -101,10 +96,7 @@
|
| const Context& context = Context::Handle(closure.context());
|
| ASSERT(!function.IsNull());
|
| if (!function.HasCode()) {
|
| - const Error& error = Error::Handle(Compiler::CompileFunction(function));
|
| - if (!error.IsNull()) {
|
| - return error.raw();
|
| - }
|
| + Compiler::CompileFunction(function);
|
| }
|
| const Code& code = Code::Handle(function.code());
|
| ASSERT(!code.IsNull());
|
| @@ -124,7 +116,7 @@
|
| }
|
|
|
|
|
| -RawObject* DartLibraryCalls::ExceptionCreate(
|
| +RawInstance* DartLibraryCalls::ExceptionCreate(
|
| const String& class_name,
|
| const GrowableArray<const Object*>& arguments) {
|
| const Library& core_lib = Library::Handle(Library::CoreLibrary());
|
| @@ -143,18 +135,12 @@
|
| Function::Handle(cls.LookupConstructor(constructor_name));
|
| ASSERT(!constructor.IsNull());
|
| const Array& kNoArgumentNames = Array::Handle();
|
| - const Object& retval = Object::Handle(
|
| - DartEntry::InvokeStatic(constructor, constructor_arguments,
|
| - kNoArgumentNames));
|
| - ASSERT(retval.IsNull() || retval.IsError());
|
| - if (retval.IsError()) {
|
| - return retval.raw();
|
| - }
|
| + DartEntry::InvokeStatic(constructor, constructor_arguments, kNoArgumentNames);
|
| return exception_object.raw();
|
| }
|
|
|
|
|
| -RawObject* DartLibraryCalls::ToString(const Instance& receiver) {
|
| +RawInstance* DartLibraryCalls::ToString(const Instance& receiver) {
|
| const String& function_name =
|
| String::Handle(String::NewSymbol("toString"));
|
| GrowableArray<const Object*> arguments;
|
| @@ -167,18 +153,19 @@
|
| kNumArguments,
|
| kNumNamedArguments));
|
| ASSERT(!function.IsNull());
|
| - const Object& result = Object::Handle(
|
| + const Instance& result = Instance::Handle(
|
| DartEntry::InvokeDynamic(receiver,
|
| function,
|
| arguments,
|
| kNoArgumentNames));
|
| - ASSERT(result.IsInstance() || result.IsError());
|
| + // Object's 'toString' threw an exception, let the caller handle it.
|
| + ASSERT(result.IsString() || result.IsUnhandledException());
|
| return result.raw();
|
| }
|
|
|
|
|
| -RawObject* DartLibraryCalls::Equals(const Instance& left,
|
| - const Instance& right) {
|
| +RawInstance* DartLibraryCalls::Equals(const Instance& left,
|
| + const Instance& right) {
|
| const String& function_name =
|
| String::Handle(String::NewSymbol("=="));
|
| GrowableArray<const Object*> arguments;
|
| @@ -192,9 +179,10 @@
|
| kNumArguments,
|
| kNumNamedArguments));
|
| ASSERT(!function.IsNull());
|
| - const Object& result = Object::Handle(
|
| + const Instance& result = Instance::Handle(
|
| DartEntry::InvokeDynamic(left, function, arguments, kNoArgumentNames));
|
| - ASSERT(result.IsInstance() || result.IsError());
|
| + // Object's '==' threw an exception, let the caller handle it.
|
| + ASSERT(result.IsBool() || result.IsUnhandledException());
|
| return result.raw();
|
| }
|
|
|
| @@ -221,7 +209,7 @@
|
| arguments.Add(&message);
|
| const Object& result = Object::Handle(
|
| DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
|
| - ASSERT(result.IsNull() || result.IsError());
|
| + ASSERT(result.IsNull() || result.IsUnhandledException());
|
| return result.raw();
|
| }
|
|
|
|
|