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

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

Issue 1323813004: Changes to prepare for allowing script snapshots to be taken after running the main application (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix-long-line Created 5 years, 3 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 | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/raw_object_snapshot.cc » ('J')
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_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 394
395 static const Array& empty_array() { 395 static const Array& empty_array() {
396 ASSERT(empty_array_ != NULL); 396 ASSERT(empty_array_ != NULL);
397 return *empty_array_; 397 return *empty_array_;
398 } 398 }
399 static const Array& zero_array() { 399 static const Array& zero_array() {
400 ASSERT(zero_array_ != NULL); 400 ASSERT(zero_array_ != NULL);
401 return *zero_array_; 401 return *zero_array_;
402 } 402 }
403 403
404 static const ContextScope& empty_context_scope() {
405 ASSERT(empty_context_scope_ != NULL);
406 return *empty_context_scope_;
407 }
408
404 static const ObjectPool& empty_object_pool() { 409 static const ObjectPool& empty_object_pool() {
405 ASSERT(empty_object_pool_ != NULL); 410 ASSERT(empty_object_pool_ != NULL);
406 return *empty_object_pool_; 411 return *empty_object_pool_;
407 } 412 }
408 413
409 static const PcDescriptors& empty_descriptors() { 414 static const PcDescriptors& empty_descriptors() {
410 ASSERT(empty_descriptors_ != NULL); 415 ASSERT(empty_descriptors_ != NULL);
411 return *empty_descriptors_; 416 return *empty_descriptors_;
412 } 417 }
413 418
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 789
785 // The static values below are read-only handle pointers for singleton 790 // The static values below are read-only handle pointers for singleton
786 // objects that are shared between the different isolates. 791 // objects that are shared between the different isolates.
787 static Object* null_object_; 792 static Object* null_object_;
788 static Array* null_array_; 793 static Array* null_array_;
789 static String* null_string_; 794 static String* null_string_;
790 static Instance* null_instance_; 795 static Instance* null_instance_;
791 static TypeArguments* null_type_arguments_; 796 static TypeArguments* null_type_arguments_;
792 static Array* empty_array_; 797 static Array* empty_array_;
793 static Array* zero_array_; 798 static Array* zero_array_;
799 static ContextScope* empty_context_scope_;
794 static ObjectPool* empty_object_pool_; 800 static ObjectPool* empty_object_pool_;
795 static PcDescriptors* empty_descriptors_; 801 static PcDescriptors* empty_descriptors_;
796 static LocalVarDescriptors* empty_var_descriptors_; 802 static LocalVarDescriptors* empty_var_descriptors_;
797 static ExceptionHandlers* empty_exception_handlers_; 803 static ExceptionHandlers* empty_exception_handlers_;
798 static Array* extractor_parameter_types_; 804 static Array* extractor_parameter_types_;
799 static Array* extractor_parameter_names_; 805 static Array* extractor_parameter_names_;
800 static Instance* sentinel_; 806 static Instance* sentinel_;
801 static Instance* transition_sentinel_; 807 static Instance* transition_sentinel_;
802 static Instance* unknown_constant_; 808 static Instance* unknown_constant_;
803 static Instance* non_constant_; 809 static Instance* non_constant_;
(...skipping 3652 matching lines...) Expand 10 before | Expand all | Expand 10 after
4456 4462
4457 4463
4458 // The ContextScope class makes it possible to delay the compilation of a local 4464 // The ContextScope class makes it possible to delay the compilation of a local
4459 // function until it is invoked. A ContextScope instance collects the local 4465 // function until it is invoked. A ContextScope instance collects the local
4460 // variables that are referenced by the local function to be compiled and that 4466 // variables that are referenced by the local function to be compiled and that
4461 // belong to the outer scopes, that is, to the local scopes of (possibly nested) 4467 // belong to the outer scopes, that is, to the local scopes of (possibly nested)
4462 // functions enclosing the local function. Each captured variable is represented 4468 // functions enclosing the local function. Each captured variable is represented
4463 // by its token position in the source, its name, its type, its allocation index 4469 // by its token position in the source, its name, its type, its allocation index
4464 // in the context, and its context level. The function nesting level and loop 4470 // in the context, and its context level. The function nesting level and loop
4465 // nesting level are not preserved, since they are only used until the context 4471 // nesting level are not preserved, since they are only used until the context
4466 // level is assigned. 4472 // level is assigned. In addition the ContextScope has a field 'is_implicit'
4473 // which is true if the ContextScope was created for an implicit closure.
4467 class ContextScope : public Object { 4474 class ContextScope : public Object {
4468 public: 4475 public:
4469 intptr_t num_variables() const { return raw_ptr()->num_variables_; } 4476 intptr_t num_variables() const { return raw_ptr()->num_variables_; }
4470 4477
4471 intptr_t TokenIndexAt(intptr_t scope_index) const; 4478 intptr_t TokenIndexAt(intptr_t scope_index) const;
4472 void SetTokenIndexAt(intptr_t scope_index, intptr_t token_pos) const; 4479 void SetTokenIndexAt(intptr_t scope_index, intptr_t token_pos) const;
4473 4480
4474 RawString* NameAt(intptr_t scope_index) const; 4481 RawString* NameAt(intptr_t scope_index) const;
4475 void SetNameAt(intptr_t scope_index, const String& name) const; 4482 void SetNameAt(intptr_t scope_index, const String& name) const;
4476 4483
(...skipping 24 matching lines...) Expand all
4501 OFFSET_OF_RETURNED_VALUE(RawContextScope, data)); 4508 OFFSET_OF_RETURNED_VALUE(RawContextScope, data));
4502 return 0; 4509 return 0;
4503 } 4510 }
4504 4511
4505 static intptr_t InstanceSize(intptr_t len) { 4512 static intptr_t InstanceSize(intptr_t len) {
4506 ASSERT(0 <= len && len <= kMaxElements); 4513 ASSERT(0 <= len && len <= kMaxElements);
4507 return RoundedAllocationSize( 4514 return RoundedAllocationSize(
4508 sizeof(RawContextScope) + (len * kBytesPerElement)); 4515 sizeof(RawContextScope) + (len * kBytesPerElement));
4509 } 4516 }
4510 4517
4511 static RawContextScope* New(intptr_t num_variables); 4518 static RawContextScope* New(intptr_t num_variables, bool is_implicit);
4512 4519
4513 private: 4520 private:
4514 void set_num_variables(intptr_t num_variables) const { 4521 void set_num_variables(intptr_t num_variables) const {
4515 StoreNonPointer(&raw_ptr()->num_variables_, num_variables); 4522 StoreNonPointer(&raw_ptr()->num_variables_, num_variables);
4516 } 4523 }
4517 4524
4525 void set_is_implicit(bool is_implicit) const {
4526 StoreNonPointer(&raw_ptr()->is_implicit_, is_implicit);
4527 }
4528
4518 const RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const { 4529 const RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const {
4519 ASSERT((index >= 0) && (index < num_variables())); 4530 ASSERT((index >= 0) && (index < num_variables()));
4520 return raw_ptr()->VariableDescAddr(index); 4531 return raw_ptr()->VariableDescAddr(index);
4521 } 4532 }
4522 4533
4523 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object); 4534 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object);
4524 friend class Class; 4535 friend class Class;
4536 friend class Object;
4525 }; 4537 };
4526 4538
4527 4539
4528 class MegamorphicCache : public Object { 4540 class MegamorphicCache : public Object {
4529 public: 4541 public:
4530 static const int kInitialCapacity = 16; 4542 static const int kInitialCapacity = 16;
4531 static const double kLoadFactor; 4543 static const double kLoadFactor;
4532 4544
4533 RawArray* buckets() const; 4545 RawArray* buckets() const;
4534 void set_buckets(const Array& buckets) const; 4546 void set_buckets(const Array& buckets) const;
(...skipping 3500 matching lines...) Expand 10 before | Expand all | Expand 10 after
8035 8047
8036 8048
8037 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8049 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8038 intptr_t index) { 8050 intptr_t index) {
8039 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8051 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8040 } 8052 }
8041 8053
8042 } // namespace dart 8054 } // namespace dart
8043 8055
8044 #endif // VM_OBJECT_H_ 8056 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/raw_object_snapshot.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698