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

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

Issue 2983823002: Improve hashCode for closures (Closed)
Patch Set: Error handling Created 3 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
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/bootstrap.h" 5 #include "vm/bootstrap.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/bootstrap_natives.h" 9 #include "vm/bootstrap_natives.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // instances. This allows us to just finalize function types without going 225 // instances. This allows us to just finalize function types without going
226 // through the hoops of trying to compile their scope class. 226 // through the hoops of trying to compile their scope class.
227 ObjectStore* object_store = thread->isolate()->object_store(); 227 ObjectStore* object_store = thread->isolate()->object_store();
228 Zone* zone = thread->zone(); 228 Zone* zone = thread->zone();
229 Class& cls = Class::Handle(zone, object_store->closure_class()); 229 Class& cls = Class::Handle(zone, object_store->closure_class());
230 Compiler::CompileClass(cls); 230 Compiler::CompileClass(cls);
231 231
232 #if defined(DEBUG) 232 #if defined(DEBUG)
233 // Verify that closure field offsets are identical in Dart and C++. 233 // Verify that closure field offsets are identical in Dart and C++.
234 const Array& fields = Array::Handle(zone, cls.fields()); 234 const Array& fields = Array::Handle(zone, cls.fields());
235 ASSERT(fields.Length() == 4); 235 ASSERT(fields.Length() == 5);
236 Field& field = Field::Handle(zone); 236 Field& field = Field::Handle(zone);
237 field ^= fields.At(0); 237 field ^= fields.At(0);
238 ASSERT(field.Offset() == Closure::instantiator_type_arguments_offset()); 238 ASSERT(field.Offset() == Closure::instantiator_type_arguments_offset());
239 field ^= fields.At(1); 239 field ^= fields.At(1);
240 ASSERT(field.Offset() == Closure::function_type_arguments_offset()); 240 ASSERT(field.Offset() == Closure::function_type_arguments_offset());
241 field ^= fields.At(2); 241 field ^= fields.At(2);
242 ASSERT(field.Offset() == Closure::function_offset()); 242 ASSERT(field.Offset() == Closure::function_offset());
243 field ^= fields.At(3); 243 field ^= fields.At(3);
244 ASSERT(field.Offset() == Closure::context_offset()); 244 ASSERT(field.Offset() == Closure::context_offset());
245 field ^= fields.At(4);
246 ASSERT(field.Offset() == Closure::hash_offset());
245 #endif // defined(DEBUG) 247 #endif // defined(DEBUG)
246 248
247 // Eagerly compile Bool class, bool constants are used from within compiler. 249 // Eagerly compile Bool class, bool constants are used from within compiler.
248 cls = object_store->bool_class(); 250 cls = object_store->bool_class();
249 Compiler::CompileClass(cls); 251 Compiler::CompileClass(cls);
250 } 252 }
251 253
252 static RawError* BootstrapFromSource(Thread* thread) { 254 static RawError* BootstrapFromSource(Thread* thread) {
253 Isolate* isolate = thread->isolate(); 255 Isolate* isolate = thread->isolate();
254 Zone* zone = thread->zone(); 256 Zone* zone = thread->zone();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 lib.Register(thread); 375 lib.Register(thread);
374 isolate->object_store()->set_bootstrap_library(id, lib); 376 isolate->object_store()->set_bootstrap_library(id, lib);
375 } 377 }
376 } 378 }
377 379
378 return (kernel_program == NULL) ? BootstrapFromSource(thread) 380 return (kernel_program == NULL) ? BootstrapFromSource(thread)
379 : BootstrapFromKernel(thread, kernel_program); 381 : BootstrapFromKernel(thread, kernel_program);
380 } 382 }
381 383
382 } // namespace dart 384 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/function.dart ('k') | runtime/vm/bootstrap_natives.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698