Change return value of ObjectStore::PreallocateObjects to return the error object or null instead of a bool. Most of the times the sticky error is cleared and returned as an error so returning a bool and querying the sticky error here does not work as the sticky error is a null object.

R=srdjan@google.com

Review URL: https://codereview.chromium.org/1721053002 .
This commit is contained in:
Siva Annamalai 2016-02-22 13:37:22 -08:00
parent e9a6175489
commit 2964f9e750
3 changed files with 11 additions and 10 deletions

View file

@ -464,8 +464,9 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
I->set_ic_miss_code(miss_code);
if (snapshot_buffer == NULL) {
if (!I->object_store()->PreallocateObjects()) {
return T->sticky_error();
const Error& error = Error::Handle(I->object_store()->PreallocateObjects());
if (!error.IsNull()) {
return error.raw();
}
}

View file

@ -118,7 +118,7 @@ void ObjectStore::Init(Isolate* isolate) {
}
bool ObjectStore::PreallocateObjects() {
RawError* ObjectStore::PreallocateObjects() {
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
Zone* zone = thread->zone();
@ -126,7 +126,7 @@ bool ObjectStore::PreallocateObjects() {
if (this->stack_overflow() != Instance::null()) {
ASSERT(this->out_of_memory() != Instance::null());
ASSERT(this->preallocated_stack_trace() != Stacktrace::null());
return true;
return Error::null();
}
ASSERT(this->stack_overflow() == Instance::null());
ASSERT(this->out_of_memory() == Instance::null());
@ -147,7 +147,7 @@ bool ObjectStore::PreallocateObjects() {
Symbols::Dot(),
Object::empty_array());
if (result.IsError()) {
return false;
return Error::Cast(result).raw();
}
set_stack_overflow(Instance::Cast(result));
@ -156,7 +156,7 @@ bool ObjectStore::PreallocateObjects() {
Symbols::Dot(),
Object::empty_array());
if (result.IsError()) {
return false;
return Error::Cast(result).raw();
}
set_out_of_memory(Instance::Cast(result));
@ -178,7 +178,7 @@ bool ObjectStore::PreallocateObjects() {
stack_trace.set_expand_inlined(false);
set_preallocated_stack_trace(stack_trace);
return true;
return Error::null();
}

View file

@ -478,9 +478,9 @@ class ObjectStore {
void VisitObjectPointers(ObjectPointerVisitor* visitor);
// Called to initialize objects required by the vm but which invoke
// dart code. If an error occurs then false is returned and error
// information is stored in Thread::sticky_error().
bool PreallocateObjects();
// dart code. If an error occurs the error object is returned otherwise
// a null object is returned.
RawError* PreallocateObjects();
void InitKnownObjects();