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

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

Issue 12320103: Fix for bug 6767 - Limit stack trace collection for stack overflow exceptions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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/bigint_operations.h" 5 #include "vm/bigint_operations.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2216 intptr_t object_id, 2216 intptr_t object_id,
2217 Snapshot::Kind kind) { 2217 Snapshot::Kind kind) {
2218 UNREACHABLE(); // DartFunction is an abstract class. 2218 UNREACHABLE(); // DartFunction is an abstract class.
2219 } 2219 }
2220 2220
2221 2221
2222 RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader, 2222 RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader,
2223 intptr_t object_id, 2223 intptr_t object_id,
2224 intptr_t tags, 2224 intptr_t tags,
2225 Snapshot::Kind kind) { 2225 Snapshot::Kind kind) {
2226 UNIMPLEMENTED(); 2226 ASSERT(kind == Snapshot::kFull);
2227 return Stacktrace::null(); 2227 ASSERT(reader != NULL);
hausner 2013/02/25 23:09:08 How about simply (pre-)allocating a new stack trac
siva 2013/02/26 18:49:48 I tried doing what you suggested, it makes the cod
2228
2229 Stacktrace& result = Stacktrace::ZoneHandle(reader->isolate(),
2230 reader->NewStacktrace());
2231 reader->AddBackRef(object_id, &result, kIsDeserialized);
2232
2233 // There are no non object pointer fields.
2234
2235 // Read all the object pointer fields.
2236 Array& array = Array::Handle(reader->isolate());
2237 array ^= reader->ReadObjectRef();
2238 result.set_function_array(array);
2239 array ^= reader->ReadObjectRef();
2240 result.set_code_array(array);
2241 array ^= reader->ReadObjectRef();
2242 result.set_pc_offset_array(array);
2243 return result.raw();
2228 } 2244 }
2229 2245
2230 2246
2231 void RawStacktrace::WriteTo(SnapshotWriter* writer, 2247 void RawStacktrace::WriteTo(SnapshotWriter* writer,
2232 intptr_t object_id, 2248 intptr_t object_id,
2233 Snapshot::Kind kind) { 2249 Snapshot::Kind kind) {
2234 UNIMPLEMENTED(); 2250 ASSERT(kind == Snapshot::kFull);
2251 ASSERT(writer != NULL);
2252
2253 // Write out the serialization header value for this object.
2254 writer->WriteInlinedObjectHeader(object_id);
2255
2256 // Write out the class and tags information.
2257 writer->WriteIndexedObject(kStacktraceCid);
2258 writer->WriteIntptrValue(writer->GetObjectTags(this));
2259
2260 // There are no non object pointer fields.
2261
2262 // Write out all the object pointer fields.
2263 SnapshotWriterVisitor visitor(writer);
2264 visitor.VisitPointers(from(), to());
2235 } 2265 }
2236 2266
2237 2267
2238 RawJSRegExp* JSRegExp::ReadFrom(SnapshotReader* reader, 2268 RawJSRegExp* JSRegExp::ReadFrom(SnapshotReader* reader,
2239 intptr_t object_id, 2269 intptr_t object_id,
2240 intptr_t tags, 2270 intptr_t tags,
2241 Snapshot::Kind kind) { 2271 Snapshot::Kind kind) {
2242 ASSERT(reader != NULL); 2272 ASSERT(reader != NULL);
2243 ASSERT(kind == Snapshot::kMessage); 2273 ASSERT(kind == Snapshot::kMessage);
2244 2274
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 // Write out the class and tags information. 2355 // Write out the class and tags information.
2326 writer->WriteIndexedObject(kWeakPropertyCid); 2356 writer->WriteIndexedObject(kWeakPropertyCid);
2327 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2357 writer->WriteIntptrValue(writer->GetObjectTags(this));
2328 2358
2329 // Write out all the other fields. 2359 // Write out all the other fields.
2330 writer->Write<RawObject*>(ptr()->key_); 2360 writer->Write<RawObject*>(ptr()->key_);
2331 writer->Write<RawObject*>(ptr()->value_); 2361 writer->Write<RawObject*>(ptr()->value_);
2332 } 2362 }
2333 2363
2334 } // namespace dart 2364 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698