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

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

Issue 1384403002: Preparation for moving reusable handles to thread and more cleanups: isolate -> thread based handle… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixed import Created 5 years, 2 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
« no previous file with comments | « runtime/vm/allocation.cc ('k') | runtime/vm/coverage.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/class_finalizer.h" 5 #include "vm/class_finalizer.h"
6 6
7 #include "vm/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 3118 matching lines...) Expand 10 before | Expand all | Expand 10 after
3129 va_start(args, format); 3129 va_start(args, format);
3130 const Script& script = Script::Handle(cls.script()); 3130 const Script& script = Script::Handle(cls.script());
3131 Report::MessageV(Report::kError, script, token_pos, format, args); 3131 Report::MessageV(Report::kError, script, token_pos, format, args);
3132 va_end(args); 3132 va_end(args);
3133 UNREACHABLE(); 3133 UNREACHABLE();
3134 } 3134 }
3135 3135
3136 3136
3137 void ClassFinalizer::VerifyImplicitFieldOffsets() { 3137 void ClassFinalizer::VerifyImplicitFieldOffsets() {
3138 #ifdef DEBUG 3138 #ifdef DEBUG
3139 Isolate* isolate = Isolate::Current(); 3139 Thread* thread = Thread::Current();
3140 Isolate* isolate = thread->isolate();
3141 Zone* zone = thread->zone();
3140 const ClassTable& class_table = *(isolate->class_table()); 3142 const ClassTable& class_table = *(isolate->class_table());
3141 Class& cls = Class::Handle(isolate); 3143 Class& cls = Class::Handle(zone);
3142 Array& fields_array = Array::Handle(isolate); 3144 Array& fields_array = Array::Handle(zone);
3143 Field& field = Field::Handle(isolate); 3145 Field& field = Field::Handle(zone);
3144 String& name = String::Handle(isolate); 3146 String& name = String::Handle(zone);
3145 String& expected_name = String::Handle(isolate); 3147 String& expected_name = String::Handle(zone);
3146 Error& error = Error::Handle(isolate); 3148 Error& error = Error::Handle(zone);
3147 3149
3148 // First verify field offsets of all the TypedDataView classes. 3150 // First verify field offsets of all the TypedDataView classes.
3149 for (intptr_t cid = kTypedDataInt8ArrayViewCid; 3151 for (intptr_t cid = kTypedDataInt8ArrayViewCid;
3150 cid <= kTypedDataFloat32x4ArrayViewCid; 3152 cid <= kTypedDataFloat32x4ArrayViewCid;
3151 cid++) { 3153 cid++) {
3152 cls = class_table.At(cid); // Get the TypedDataView class. 3154 cls = class_table.At(cid); // Get the TypedDataView class.
3153 error = cls.EnsureIsFinalized(isolate); 3155 error = cls.EnsureIsFinalized(thread);
3154 ASSERT(error.IsNull()); 3156 ASSERT(error.IsNull());
3155 cls = cls.SuperClass(); // Get it's super class '_TypedListView'. 3157 cls = cls.SuperClass(); // Get it's super class '_TypedListView'.
3156 cls = cls.SuperClass(); 3158 cls = cls.SuperClass();
3157 fields_array ^= cls.fields(); 3159 fields_array ^= cls.fields();
3158 ASSERT(fields_array.Length() == TypedDataView::NumberOfFields()); 3160 ASSERT(fields_array.Length() == TypedDataView::NumberOfFields());
3159 field ^= fields_array.At(0); 3161 field ^= fields_array.At(0);
3160 ASSERT(field.Offset() == TypedDataView::data_offset()); 3162 ASSERT(field.Offset() == TypedDataView::data_offset());
3161 name ^= field.name(); 3163 name ^= field.name();
3162 expected_name ^= String::New("_typedData"); 3164 expected_name ^= String::New("_typedData");
3163 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 3165 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
3164 field ^= fields_array.At(1); 3166 field ^= fields_array.At(1);
3165 ASSERT(field.Offset() == TypedDataView::offset_in_bytes_offset()); 3167 ASSERT(field.Offset() == TypedDataView::offset_in_bytes_offset());
3166 name ^= field.name(); 3168 name ^= field.name();
3167 ASSERT(name.Equals("offsetInBytes")); 3169 ASSERT(name.Equals("offsetInBytes"));
3168 field ^= fields_array.At(2); 3170 field ^= fields_array.At(2);
3169 ASSERT(field.Offset() == TypedDataView::length_offset()); 3171 ASSERT(field.Offset() == TypedDataView::length_offset());
3170 name ^= field.name(); 3172 name ^= field.name();
3171 ASSERT(name.Equals("length")); 3173 ASSERT(name.Equals("length"));
3172 } 3174 }
3173 3175
3174 // Now verify field offsets of '_ByteDataView' class. 3176 // Now verify field offsets of '_ByteDataView' class.
3175 cls = class_table.At(kByteDataViewCid); 3177 cls = class_table.At(kByteDataViewCid);
3176 error = cls.EnsureIsFinalized(isolate); 3178 error = cls.EnsureIsFinalized(thread);
3177 ASSERT(error.IsNull()); 3179 ASSERT(error.IsNull());
3178 fields_array ^= cls.fields(); 3180 fields_array ^= cls.fields();
3179 ASSERT(fields_array.Length() == TypedDataView::NumberOfFields()); 3181 ASSERT(fields_array.Length() == TypedDataView::NumberOfFields());
3180 field ^= fields_array.At(0); 3182 field ^= fields_array.At(0);
3181 ASSERT(field.Offset() == TypedDataView::data_offset()); 3183 ASSERT(field.Offset() == TypedDataView::data_offset());
3182 name ^= field.name(); 3184 name ^= field.name();
3183 expected_name ^= String::New("_typedData"); 3185 expected_name ^= String::New("_typedData");
3184 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 3186 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
3185 field ^= fields_array.At(1); 3187 field ^= fields_array.At(1);
3186 ASSERT(field.Offset() == TypedDataView::offset_in_bytes_offset()); 3188 ASSERT(field.Offset() == TypedDataView::offset_in_bytes_offset());
3187 name ^= field.name(); 3189 name ^= field.name();
3188 expected_name ^= String::New("_offset"); 3190 expected_name ^= String::New("_offset");
3189 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 3191 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
3190 field ^= fields_array.At(2); 3192 field ^= fields_array.At(2);
3191 ASSERT(field.Offset() == TypedDataView::length_offset()); 3193 ASSERT(field.Offset() == TypedDataView::length_offset());
3192 name ^= field.name(); 3194 name ^= field.name();
3193 ASSERT(name.Equals("length")); 3195 ASSERT(name.Equals("length"));
3194 3196
3195 // Now verify field offsets of '_ByteBuffer' class. 3197 // Now verify field offsets of '_ByteBuffer' class.
3196 cls = class_table.At(kByteBufferCid); 3198 cls = class_table.At(kByteBufferCid);
3197 error = cls.EnsureIsFinalized(isolate); 3199 error = cls.EnsureIsFinalized(thread);
3198 ASSERT(error.IsNull()); 3200 ASSERT(error.IsNull());
3199 fields_array ^= cls.fields(); 3201 fields_array ^= cls.fields();
3200 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); 3202 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields());
3201 field ^= fields_array.At(0); 3203 field ^= fields_array.At(0);
3202 ASSERT(field.Offset() == ByteBuffer::data_offset()); 3204 ASSERT(field.Offset() == ByteBuffer::data_offset());
3203 name ^= field.name(); 3205 name ^= field.name();
3204 expected_name ^= String::New("_data"); 3206 expected_name ^= String::New("_data");
3205 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 3207 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
3206 #endif 3208 #endif
3207 } 3209 }
3208 3210
3209 } // namespace dart 3211 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/allocation.cc ('k') | runtime/vm/coverage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698