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

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

Issue 326183002: Pass around the current isolate in exception handling code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/reusable_handles.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 Isolate* isolate = Isolate::Current(); 1565 Isolate* isolate = Isolate::Current();
1566 ASSERT(isolate->no_callback_scope_depth() == 0); 1566 ASSERT(isolate->no_callback_scope_depth() == 0);
1567 Heap* heap = isolate->heap(); 1567 Heap* heap = isolate->heap();
1568 1568
1569 uword address = heap->Allocate(size, space); 1569 uword address = heap->Allocate(size, space);
1570 if (address == 0) { 1570 if (address == 0) {
1571 // Use the preallocated out of memory exception to avoid calling 1571 // Use the preallocated out of memory exception to avoid calling
1572 // into dart code or allocating any code. 1572 // into dart code or allocating any code.
1573 const Instance& exception = 1573 const Instance& exception =
1574 Instance::Handle(isolate->object_store()->out_of_memory()); 1574 Instance::Handle(isolate->object_store()->out_of_memory());
1575 Exceptions::Throw(exception); 1575 Exceptions::Throw(isolate, exception);
1576 UNREACHABLE(); 1576 UNREACHABLE();
1577 } 1577 }
1578 if (space == Heap::kNew) { 1578 if (space == Heap::kNew) {
1579 isolate->class_table()->UpdateAllocatedNew(cls_id, size); 1579 isolate->class_table()->UpdateAllocatedNew(cls_id, size);
1580 } else { 1580 } else {
1581 isolate->class_table()->UpdateAllocatedOld(cls_id, size); 1581 isolate->class_table()->UpdateAllocatedOld(cls_id, size);
1582 } 1582 }
1583 NoGCScope no_gc; 1583 NoGCScope no_gc;
1584 InitializeObject(address, cls_id, size); 1584 InitializeObject(address, cls_id, size);
1585 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); 1585 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag);
(...skipping 15078 matching lines...) Expand 10 before | Expand all | Expand 10 after
16664 String& str = String::Handle(); 16664 String& str = String::Handle();
16665 intptr_t char_size = kOneByteChar; 16665 intptr_t char_size = kOneByteChar;
16666 // Compute 'char_size' and 'result_len'. 16666 // Compute 'char_size' and 'result_len'.
16667 for (intptr_t i = start; i < end; i++) { 16667 for (intptr_t i = start; i < end; i++) {
16668 str ^= strings.At(i); 16668 str ^= strings.At(i);
16669 const intptr_t str_len = str.Length(); 16669 const intptr_t str_len = str.Length();
16670 if ((kMaxElements - result_len) < str_len) { 16670 if ((kMaxElements - result_len) < str_len) {
16671 Isolate* isolate = Isolate::Current(); 16671 Isolate* isolate = Isolate::Current();
16672 const Instance& exception = 16672 const Instance& exception =
16673 Instance::Handle(isolate->object_store()->out_of_memory()); 16673 Instance::Handle(isolate->object_store()->out_of_memory());
16674 Exceptions::Throw(exception); 16674 Exceptions::Throw(isolate, exception);
16675 UNREACHABLE(); 16675 UNREACHABLE();
16676 } 16676 }
16677 result_len += str_len; 16677 result_len += str_len;
16678 char_size = Utils::Maximum(char_size, str.CharSize()); 16678 char_size = Utils::Maximum(char_size, str.CharSize());
16679 } 16679 }
16680 if (char_size == kOneByteChar) { 16680 if (char_size == kOneByteChar) {
16681 return OneByteString::ConcatAll(strings, start, end, result_len, space); 16681 return OneByteString::ConcatAll(strings, start, end, result_len, space);
16682 } 16682 }
16683 ASSERT(char_size == kTwoByteChar); 16683 ASSERT(char_size == kTwoByteChar);
16684 return TwoByteString::ConcatAll(strings, start, end, result_len, space); 16684 return TwoByteString::ConcatAll(strings, start, end, result_len, space);
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
17884 ASSERT(!IsNull()); 17884 ASSERT(!IsNull());
17885 if (Length() == Capacity()) { 17885 if (Length() == Capacity()) {
17886 // TODO(Issue 2500): Need a better growth strategy. 17886 // TODO(Issue 2500): Need a better growth strategy.
17887 intptr_t new_capacity = (Capacity() == 0) ? 4 : Capacity() * 2; 17887 intptr_t new_capacity = (Capacity() == 0) ? 4 : Capacity() * 2;
17888 if (new_capacity <= Capacity()) { 17888 if (new_capacity <= Capacity()) {
17889 // Use the preallocated out of memory exception to avoid calling 17889 // Use the preallocated out of memory exception to avoid calling
17890 // into dart code or allocating any code. 17890 // into dart code or allocating any code.
17891 Isolate* isolate = Isolate::Current(); 17891 Isolate* isolate = Isolate::Current();
17892 const Instance& exception = 17892 const Instance& exception =
17893 Instance::Handle(isolate->object_store()->out_of_memory()); 17893 Instance::Handle(isolate->object_store()->out_of_memory());
17894 Exceptions::Throw(exception); 17894 Exceptions::Throw(isolate, exception);
17895 UNREACHABLE(); 17895 UNREACHABLE();
17896 } 17896 }
17897 Grow(new_capacity, space); 17897 Grow(new_capacity, space);
17898 } 17898 }
17899 ASSERT(Length() < Capacity()); 17899 ASSERT(Length() < Capacity());
17900 intptr_t index = Length(); 17900 intptr_t index = Length();
17901 SetLength(index + 1); 17901 SetLength(index + 1);
17902 SetAt(index, value); 17902 SetAt(index, value);
17903 } 17903 }
17904 17904
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
19081 return tag_label.ToCString(); 19081 return tag_label.ToCString();
19082 } 19082 }
19083 19083
19084 19084
19085 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 19085 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
19086 Instance::PrintJSONImpl(stream, ref); 19086 Instance::PrintJSONImpl(stream, ref);
19087 } 19087 }
19088 19088
19089 19089
19090 } // namespace dart 19090 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/reusable_handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698