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

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

Issue 9567023: Fix crash in inline cache: forgot to GC properly RawICData. Various cleanups. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « runtime/vm/object.h ('k') | runtime/vm/raw_object.cc » ('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 "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 8478 matching lines...) Expand 10 before | Expand all | Expand 10 after
8489 GrowableArray<const Class*> classes; 8489 GrowableArray<const Class*> classes;
8490 GetCheckAt(index, &classes, target); 8490 GetCheckAt(index, &classes, target);
8491 *cls = classes[0]->raw(); 8491 *cls = classes[0]->raw();
8492 } 8492 }
8493 8493
8494 8494
8495 RawICData* ICData::New(const Function& function, 8495 RawICData* ICData::New(const Function& function,
8496 const String& target_name, 8496 const String& target_name,
8497 intptr_t id, 8497 intptr_t id,
8498 intptr_t num_args_tested) { 8498 intptr_t num_args_tested) {
8499 ASSERT(num_args_tested > 0);
8499 const Class& cls = Class::Handle(Object::icdata_class()); 8500 const Class& cls = Class::Handle(Object::icdata_class());
8500 ASSERT(!cls.IsNull()); 8501 ASSERT(!cls.IsNull());
8501 ICData& result = ICData::Handle(); 8502 ICData& result = ICData::Handle();
8502 { 8503 {
8503 // IC data objects ar long living objects, allocate them in old generation. 8504 // IC data objects ar long living objects, allocate them in old generation.
8504 RawObject* raw = 8505 RawObject* raw =
8505 Object::Allocate(cls, ICData::InstanceSize(), Heap::kOld); 8506 Object::Allocate(cls, ICData::InstanceSize(), Heap::kOld);
8506 NoGCScope no_gc; 8507 NoGCScope no_gc;
8507 result ^= raw; 8508 result ^= raw;
8508 } 8509 }
8509 result.set_function(function); 8510 result.set_function(function);
8510 result.set_target_name(target_name); 8511 result.set_target_name(target_name);
8511 result.set_id(id); 8512 result.set_id(id);
8512 result.set_num_args_tested(num_args_tested); 8513 result.set_num_args_tested(num_args_tested);
8513 // Number of array elements in one test entry (num_args_tested + 1) 8514 // Number of array elements in one test entry (num_args_tested + 1)
8514 intptr_t len = num_args_tested + 1; 8515 intptr_t len = result.TestEntryLength();
8515 // IC data array must be null terminated (sentinel entry). 8516 // IC data array must be null terminated (sentinel entry).
8516 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); 8517 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld));
8517 result.set_ic_data(ic_data); 8518 result.set_ic_data(ic_data);
8518 return result.raw(); 8519 return result.raw();
8519 } 8520 }
8520 8521
8521 } // namespace dart 8522 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698