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

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

Issue 388963003: Avoid allocating an exception object in the snapshot reader. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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
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 12675 matching lines...) Expand 10 before | Expand all | Expand 10 after
12686 space); 12686 space);
12687 NoGCScope no_gc; 12687 NoGCScope no_gc;
12688 result ^= raw; 12688 result ^= raw;
12689 } 12689 }
12690 result.set_exception(exception); 12690 result.set_exception(exception);
12691 result.set_stacktrace(stacktrace); 12691 result.set_stacktrace(stacktrace);
12692 return result.raw(); 12692 return result.raw();
12693 } 12693 }
12694 12694
12695 12695
12696 RawUnhandledException* UnhandledException::New(Heap::Space space) {
12697 ASSERT(Object::unhandled_exception_class() != Class::null());
12698 UnhandledException& result = UnhandledException::Handle();
12699 {
12700 RawObject* raw = Object::Allocate(UnhandledException::kClassId,
12701 UnhandledException::InstanceSize(),
12702 space);
12703 NoGCScope no_gc;
12704 result ^= raw;
12705 }
12706 const Instance& null_object = Instance::Handle();
12707 result.set_exception(null_object);
12708 result.set_stacktrace(null_object);
siva 2014/07/16 01:00:13 Can we use Object::null_instance() here instead of
Florian Schneider 2014/07/16 11:15:42 Done.
12709 return result.raw();
12710 }
12711
12712
12696 void UnhandledException::set_exception(const Instance& exception) const { 12713 void UnhandledException::set_exception(const Instance& exception) const {
12697 StorePointer(&raw_ptr()->exception_, exception.raw()); 12714 StorePointer(&raw_ptr()->exception_, exception.raw());
12698 } 12715 }
12699 12716
12700 12717
12701 void UnhandledException::set_stacktrace(const Instance& stacktrace) const { 12718 void UnhandledException::set_stacktrace(const Instance& stacktrace) const {
12702 StorePointer(&raw_ptr()->stacktrace_, stacktrace.raw()); 12719 StorePointer(&raw_ptr()->stacktrace_, stacktrace.raw());
12703 } 12720 }
12704 12721
12705 12722
(...skipping 6375 matching lines...) Expand 10 before | Expand all | Expand 10 after
19081 return tag_label.ToCString(); 19098 return tag_label.ToCString();
19082 } 19099 }
19083 19100
19084 19101
19085 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 19102 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
19086 Instance::PrintJSONImpl(stream, ref); 19103 Instance::PrintJSONImpl(stream, ref);
19087 } 19104 }
19088 19105
19089 19106
19090 } // namespace dart 19107 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698