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

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: code-review-comments 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.h » ('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.
regis 2015/08/31 20:25:06 Can you update this comment with the meaning of is
siva 2015/08/31 22:20:52 Done.
4467 class ContextScope : public Object { 4473 class ContextScope : public Object {
4468 public: 4474 public:
4469 intptr_t num_variables() const { return raw_ptr()->num_variables_; } 4475 intptr_t num_variables() const { return raw_ptr()->num_variables_; }
4470 4476
4471 intptr_t TokenIndexAt(intptr_t scope_index) const; 4477 intptr_t TokenIndexAt(intptr_t scope_index) const;
4472 void SetTokenIndexAt(intptr_t scope_index, intptr_t token_pos) const; 4478 void SetTokenIndexAt(intptr_t scope_index, intptr_t token_pos) const;
4473 4479
4474 RawString* NameAt(intptr_t scope_index) const; 4480 RawString* NameAt(intptr_t scope_index) const;
4475 void SetNameAt(intptr_t scope_index, const String& name) const; 4481 void SetNameAt(intptr_t scope_index, const String& name) const;
4476 4482
(...skipping 24 matching lines...) Expand all
4501 OFFSET_OF_RETURNED_VALUE(RawContextScope, data)); 4507 OFFSET_OF_RETURNED_VALUE(RawContextScope, data));
4502 return 0; 4508 return 0;
4503 } 4509 }
4504 4510
4505 static intptr_t InstanceSize(intptr_t len) { 4511 static intptr_t InstanceSize(intptr_t len) {
4506 ASSERT(0 <= len && len <= kMaxElements); 4512 ASSERT(0 <= len && len <= kMaxElements);
4507 return RoundedAllocationSize( 4513 return RoundedAllocationSize(
4508 sizeof(RawContextScope) + (len * kBytesPerElement)); 4514 sizeof(RawContextScope) + (len * kBytesPerElement));
4509 } 4515 }
4510 4516
4511 static RawContextScope* New(intptr_t num_variables); 4517 static RawContextScope* New(intptr_t num_variables, bool is_implicit);
4512 4518
4513 private: 4519 private:
4514 void set_num_variables(intptr_t num_variables) const { 4520 void set_num_variables(intptr_t num_variables) const {
4515 StoreNonPointer(&raw_ptr()->num_variables_, num_variables); 4521 StoreNonPointer(&raw_ptr()->num_variables_, num_variables);
4516 } 4522 }
4517 4523
4524 void set_is_implicit(bool is_implicit) const {
4525 StoreNonPointer(&raw_ptr()->is_implicit_, is_implicit);
4526 }
4527
4518 const RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const { 4528 const RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const {
4519 ASSERT((index >= 0) && (index < num_variables())); 4529 ASSERT((index >= 0) && (index < num_variables()));
4520 return raw_ptr()->VariableDescAddr(index); 4530 return raw_ptr()->VariableDescAddr(index);
4521 } 4531 }
4522 4532
4523 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object); 4533 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object);
4524 friend class Class; 4534 friend class Class;
4535 friend class Object;
4525 }; 4536 };
4526 4537
4527 4538
4528 class MegamorphicCache : public Object { 4539 class MegamorphicCache : public Object {
4529 public: 4540 public:
4530 static const int kInitialCapacity = 16; 4541 static const int kInitialCapacity = 16;
4531 static const double kLoadFactor; 4542 static const double kLoadFactor;
4532 4543
4533 RawArray* buckets() const; 4544 RawArray* buckets() const;
4534 void set_buckets(const Array& buckets) const; 4545 void set_buckets(const Array& buckets) const;
(...skipping 3502 matching lines...) Expand 10 before | Expand all | Expand 10 after
8037 8048
8038 8049
8039 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8050 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8040 intptr_t index) { 8051 intptr_t index) {
8041 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8052 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8042 } 8053 }
8043 8054
8044 } // namespace dart 8055 } // namespace dart
8045 8056
8046 #endif // VM_OBJECT_H_ 8057 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/raw_object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698