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

Unified Diff: runtime/vm/object.cc

Issue 1156143003: Refactor Isolate -> Thread in NativeArguments and exception handler jump. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix comment; remove unused accessor. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/native_entry.cc ('k') | runtime/vm/runtime_entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 3314c72efe8a016b79b7350f1873ae1c91e2eb9d..0f5014f104e4d270598c63ab9317c5c1513cff89 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -1687,7 +1687,8 @@ RawObject* Object::Allocate(intptr_t cls_id,
intptr_t size,
Heap::Space space) {
ASSERT(Utils::IsAligned(size, kObjectAlignment));
- Isolate* isolate = Isolate::Current();
+ Thread* thread = Thread::Current();
+ Isolate* isolate = thread->isolate();
ASSERT(isolate->no_callback_scope_depth() == 0);
Heap* heap = isolate->heap();
@@ -1697,7 +1698,7 @@ RawObject* Object::Allocate(intptr_t cls_id,
// into dart code or allocating any code.
const Instance& exception =
Instance::Handle(isolate->object_store()->out_of_memory());
- Exceptions::Throw(isolate, exception);
+ Exceptions::Throw(thread, exception);
UNREACHABLE();
}
if (space == Heap::kNew) {
@@ -17300,11 +17301,7 @@ const char* Bigint::ToDecCString(uword (*allocator)(intptr_t size)) const {
const intptr_t kMaxUsed =
kIntptrMax / kBitsPerDigit / kLog2Dividend * kLog2Divisor;
if (used > kMaxUsed) {
- // Throw out of memory exception.
- Isolate* isolate = Isolate::Current();
- const Instance& exception =
- Instance::Handle(isolate->object_store()->out_of_memory());
- Exceptions::Throw(isolate, exception);
+ Exceptions::ThrowOOM();
UNREACHABLE();
}
const int64_t bit_len = used * kBitsPerDigit;
@@ -17382,11 +17379,7 @@ const char* Bigint::ToHexCString(uword (*allocator)(intptr_t size)) const {
const int kHexDigitsPerDigit = 8;
const intptr_t kMaxUsed = (kIntptrMax - 4) / kHexDigitsPerDigit;
if (used > kMaxUsed) {
- // Throw out of memory exception.
- Isolate* isolate = Isolate::Current();
- const Instance& exception =
- Instance::Handle(isolate->object_store()->out_of_memory());
- Exceptions::Throw(isolate, exception);
+ Exceptions::ThrowOOM();
UNREACHABLE();
}
intptr_t hex_len = (used - 1) * kHexDigitsPerDigit;
@@ -18159,10 +18152,7 @@ RawString* String::ConcatAllRange(const Array& strings,
str ^= strings.At(i);
const intptr_t str_len = str.Length();
if ((kMaxElements - result_len) < str_len) {
- Isolate* isolate = Isolate::Current();
- const Instance& exception =
- Instance::Handle(isolate->object_store()->out_of_memory());
- Exceptions::Throw(isolate, exception);
+ Exceptions::ThrowOOM();
UNREACHABLE();
}
result_len += str_len;
@@ -19426,12 +19416,7 @@ void GrowableObjectArray::Add(const Object& value, Heap::Space space) const {
// TODO(Issue 2500): Need a better growth strategy.
intptr_t new_capacity = (Capacity() == 0) ? 4 : Capacity() * 2;
if (new_capacity <= Capacity()) {
- // Use the preallocated out of memory exception to avoid calling
- // into dart code or allocating any code.
- Isolate* isolate = Isolate::Current();
- const Instance& exception =
- Instance::Handle(isolate->object_store()->out_of_memory());
- Exceptions::Throw(isolate, exception);
+ Exceptions::ThrowOOM();
UNREACHABLE();
}
Grow(new_capacity, space);
« no previous file with comments | « runtime/vm/native_entry.cc ('k') | runtime/vm/runtime_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698