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

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

Issue 1004923002: Fix for issue 22778, stored the function object in the forward reference table instead of the impli… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | « no previous file | tests/isolate/issue_22778_test.dart » ('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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return cls.raw(); 236 return cls.raw();
237 } 237 }
238 238
239 239
240 RawObject* SnapshotReader::ReadStaticImplicitClosure(intptr_t object_id, 240 RawObject* SnapshotReader::ReadStaticImplicitClosure(intptr_t object_id,
241 intptr_t class_header) { 241 intptr_t class_header) {
242 ASSERT(kind_ == Snapshot::kMessage); 242 ASSERT(kind_ == Snapshot::kMessage);
243 243
244 // First create a function object and associate it with the specified 244 // First create a function object and associate it with the specified
245 // 'object_id'. 245 // 'object_id'.
246 Function& func = Function::ZoneHandle(isolate(), Function::null()); 246 Function& func = Function::Handle(isolate(), Function::null());
247 AddBackRef(object_id, &func, kIsDeserialized); 247 Instance& obj = Instance::ZoneHandle(isolate(), Instance::null());
248 AddBackRef(object_id, &obj, kIsDeserialized);
248 249
249 // Read the library/class/function information and lookup the function. 250 // Read the library/class/function information and lookup the function.
250 str_ ^= ReadObjectImpl(); 251 str_ ^= ReadObjectImpl();
251 library_ = Library::LookupLibrary(str_); 252 library_ = Library::LookupLibrary(str_);
252 if (library_.IsNull() || !library_.Loaded()) { 253 if (library_.IsNull() || !library_.Loaded()) {
253 SetReadException("Invalid Library object found in message."); 254 SetReadException("Invalid Library object found in message.");
254 } 255 }
255 str_ ^= ReadObjectImpl(); 256 str_ ^= ReadObjectImpl();
256 if (str_.Equals(Symbols::TopLevel())) { 257 if (str_.Equals(Symbols::TopLevel())) {
257 str_ ^= ReadObjectImpl(); 258 str_ ^= ReadObjectImpl();
258 func = library_.LookupFunctionAllowPrivate(str_); 259 func = library_.LookupFunctionAllowPrivate(str_);
259 } else { 260 } else {
260 cls_ = library_.LookupClassAllowPrivate(str_); 261 cls_ = library_.LookupClassAllowPrivate(str_);
261 if (cls_.IsNull()) { 262 if (cls_.IsNull()) {
262 OS::Print("Name of class not found %s\n", str_.ToCString()); 263 OS::Print("Name of class not found %s\n", str_.ToCString());
263 SetReadException("Invalid Class object found in message."); 264 SetReadException("Invalid Class object found in message.");
264 } 265 }
265 cls_.EnsureIsFinalized(isolate()); 266 cls_.EnsureIsFinalized(isolate());
266 str_ ^= ReadObjectImpl(); 267 str_ ^= ReadObjectImpl();
267 func = cls_.LookupFunctionAllowPrivate(str_); 268 func = cls_.LookupFunctionAllowPrivate(str_);
268 } 269 }
269 if (func.IsNull()) { 270 if (func.IsNull()) {
270 SetReadException("Invalid function object found in message."); 271 SetReadException("Invalid function object found in message.");
271 } 272 }
272 func = func.ImplicitClosureFunction(); 273 func = func.ImplicitClosureFunction();
273 ASSERT(!func.IsNull()); 274 ASSERT(!func.IsNull());
274 275
275 // Return the associated implicit static closure. 276 // Return the associated implicit static closure.
276 return func.ImplicitStaticClosure(); 277 obj = func.ImplicitStaticClosure();
278 return obj.raw();
277 } 279 }
278 280
279 281
280 RawObject* SnapshotReader::ReadObjectImpl() { 282 RawObject* SnapshotReader::ReadObjectImpl() {
281 int64_t value = Read<int64_t>(); 283 int64_t value = Read<int64_t>();
282 if ((value & kSmiTagMask) == kSmiTag) { 284 if ((value & kSmiTagMask) == kSmiTag) {
283 return NewInteger(value); 285 return NewInteger(value);
284 } 286 }
285 ASSERT((value <= kIntptrMax) && (value >= kIntptrMin)); 287 ASSERT((value <= kIntptrMax) && (value >= kIntptrMin));
286 return ReadObjectImpl(static_cast<intptr_t>(value)); 288 return ReadObjectImpl(static_cast<intptr_t>(value));
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 NoGCScope no_gc; 1950 NoGCScope no_gc;
1949 WriteObject(obj.raw()); 1951 WriteObject(obj.raw());
1950 UnmarkAll(); 1952 UnmarkAll();
1951 } else { 1953 } else {
1952 ThrowException(exception_type(), exception_msg()); 1954 ThrowException(exception_type(), exception_msg());
1953 } 1955 }
1954 } 1956 }
1955 1957
1956 1958
1957 } // namespace dart 1959 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/isolate/issue_22778_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698