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

Side by Side Diff: runtime/vm/object_store.h

Issue 2147123002: Made simple instance-of checks fast for unoptimized code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Removed compile_time_constants_ from object_store. Created 4 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/object_store.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 #ifndef VM_OBJECT_STORE_H_ 5 #ifndef VM_OBJECT_STORE_H_
6 #define VM_OBJECT_STORE_H_ 6 #define VM_OBJECT_STORE_H_
7 7
8 #include "vm/object.h" 8 #include "vm/object.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 } 472 }
473 RawFunction* megamorphic_miss_function() const { 473 RawFunction* megamorphic_miss_function() const {
474 return megamorphic_miss_function_; 474 return megamorphic_miss_function_;
475 } 475 }
476 void SetMegamorphicMissHandler(const Code& code, const Function& func) { 476 void SetMegamorphicMissHandler(const Code& code, const Function& func) {
477 // Hold onto the code so it is traced and not detached from the function. 477 // Hold onto the code so it is traced and not detached from the function.
478 megamorphic_miss_code_ = code.raw(); 478 megamorphic_miss_code_ = code.raw();
479 megamorphic_miss_function_ = func.raw(); 479 megamorphic_miss_function_ = func.raw();
480 } 480 }
481 481
482 RawFunction* simple_instance_of_function() const {
483 return simple_instance_of_function_;
484 }
485 RawFunction* simple_instance_of_true_function() const {
486 return simple_instance_of_true_function_;
487 }
488 RawFunction* simple_instance_of_false_function() const {
489 return simple_instance_of_false_function_;
490 }
491
482 // Visit all object pointers. 492 // Visit all object pointers.
483 void VisitObjectPointers(ObjectPointerVisitor* visitor); 493 void VisitObjectPointers(ObjectPointerVisitor* visitor);
484 494
485 // Called to initialize objects required by the vm but which invoke 495 // Called to initialize objects required by the vm but which invoke
486 // dart code. If an error occurs the error object is returned otherwise 496 // dart code. If an error occurs the error object is returned otherwise
487 // a null object is returned. 497 // a null object is returned.
488 RawError* PreallocateObjects(); 498 RawError* PreallocateObjects();
489 499
490 void InitKnownObjects(); 500 void InitKnownObjects();
491 501
492 static void Init(Isolate* isolate); 502 static void Init(Isolate* isolate);
493 503
494 void PrintToJSONObject(JSONObject* jsobj); 504 void PrintToJSONObject(JSONObject* jsobj);
495 505
496 private: 506 private:
497 ObjectStore(); 507 ObjectStore();
498 508
509 // Finds a core library private method in Object.
510 RawFunction* PrivateObjectLookup(const String& name);
511
499 #define OBJECT_STORE_FIELD_LIST(V) \ 512 #define OBJECT_STORE_FIELD_LIST(V) \
500 V(RawClass*, object_class_) \ 513 V(RawClass*, object_class_) \
501 V(RawType*, object_type_) \ 514 V(RawType*, object_type_) \
502 V(RawClass*, null_class_) \ 515 V(RawClass*, null_class_) \
503 V(RawType*, null_type_) \ 516 V(RawType*, null_type_) \
504 V(RawType*, function_type_) \ 517 V(RawType*, function_type_) \
505 V(RawClass*, closure_class_) \ 518 V(RawClass*, closure_class_) \
506 V(RawType*, number_type_) \ 519 V(RawType*, number_type_) \
507 V(RawType*, int_type_) \ 520 V(RawType*, int_type_) \
508 V(RawClass*, integer_implementation_class_) \ 521 V(RawClass*, integer_implementation_class_) \
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 V(RawGrowableObjectArray*, exit_listeners_) \ 577 V(RawGrowableObjectArray*, exit_listeners_) \
565 V(RawGrowableObjectArray*, error_listeners_) \ 578 V(RawGrowableObjectArray*, error_listeners_) \
566 V(RawContext*, empty_context_) \ 579 V(RawContext*, empty_context_) \
567 V(RawInstance*, stack_overflow_) \ 580 V(RawInstance*, stack_overflow_) \
568 V(RawInstance*, out_of_memory_) \ 581 V(RawInstance*, out_of_memory_) \
569 V(RawUnhandledException*, preallocated_unhandled_exception_) \ 582 V(RawUnhandledException*, preallocated_unhandled_exception_) \
570 V(RawStacktrace*, preallocated_stack_trace_) \ 583 V(RawStacktrace*, preallocated_stack_trace_) \
571 V(RawFunction*, lookup_port_handler_) \ 584 V(RawFunction*, lookup_port_handler_) \
572 V(RawTypedData*, empty_uint32_array_) \ 585 V(RawTypedData*, empty_uint32_array_) \
573 V(RawFunction*, handle_message_function_) \ 586 V(RawFunction*, handle_message_function_) \
587 V(RawFunction*, simple_instance_of_function_) \
588 V(RawFunction*, simple_instance_of_true_function_) \
589 V(RawFunction*, simple_instance_of_false_function_) \
574 V(RawArray*, library_load_error_table_) \ 590 V(RawArray*, library_load_error_table_) \
575 V(RawArray*, unique_dynamic_targets_) \ 591 V(RawArray*, unique_dynamic_targets_) \
576 V(RawGrowableObjectArray*, token_objects_) \ 592 V(RawGrowableObjectArray*, token_objects_) \
577 V(RawArray*, token_objects_map_) \ 593 V(RawArray*, token_objects_map_) \
578 V(RawGrowableObjectArray*, megamorphic_cache_table_) \ 594 V(RawGrowableObjectArray*, megamorphic_cache_table_) \
579 V(RawCode*, megamorphic_miss_code_) \ 595 V(RawCode*, megamorphic_miss_code_) \
580 V(RawFunction*, megamorphic_miss_function_) \ 596 V(RawFunction*, megamorphic_miss_function_) \
597 // Please remember the last entry must be referred in the 'to' function below.
581 598
582 RawObject** from() { return reinterpret_cast<RawObject**>(&object_class_); } 599 RawObject** from() { return reinterpret_cast<RawObject**>(&object_class_); }
583 #define DECLARE_OBJECT_STORE_FIELD(type, name) \ 600 #define DECLARE_OBJECT_STORE_FIELD(type, name) \
584 type name; 601 type name;
585 OBJECT_STORE_FIELD_LIST(DECLARE_OBJECT_STORE_FIELD) 602 OBJECT_STORE_FIELD_LIST(DECLARE_OBJECT_STORE_FIELD)
586 #undef DECLARE_OBJECT_STORE_FIELD 603 #undef DECLARE_OBJECT_STORE_FIELD
587 RawObject** to() { 604 RawObject** to() {
588 return reinterpret_cast<RawObject**>(&megamorphic_miss_function_); 605 return reinterpret_cast<RawObject**>(&megamorphic_miss_function_);
589 } 606 }
590 RawObject** to_snapshot(Snapshot::Kind kind) { 607 RawObject** to_snapshot(Snapshot::Kind kind) {
(...skipping 15 matching lines...) Expand all
606 623
607 friend class Serializer; 624 friend class Serializer;
608 friend class Deserializer; 625 friend class Deserializer;
609 626
610 DISALLOW_COPY_AND_ASSIGN(ObjectStore); 627 DISALLOW_COPY_AND_ASSIGN(ObjectStore);
611 }; 628 };
612 629
613 } // namespace dart 630 } // namespace dart
614 631
615 #endif // VM_OBJECT_STORE_H_ 632 #endif // VM_OBJECT_STORE_H_
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/object_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698