OLD | NEW |
---|---|
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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 DEFINE_FLAG(bool, show_internal_names, false, | 59 DEFINE_FLAG(bool, show_internal_names, false, |
60 "Show names of internal classes (e.g. \"OneByteString\") in error messages " | 60 "Show names of internal classes (e.g. \"OneByteString\") in error messages " |
61 "instead of showing the corresponding interface names (e.g. \"String\")"); | 61 "instead of showing the corresponding interface names (e.g. \"String\")"); |
62 DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false, | 62 DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false, |
63 "Throw an exception when the result of an integer calculation will not " | 63 "Throw an exception when the result of an integer calculation will not " |
64 "fit into a javascript integer."); | 64 "fit into a javascript integer."); |
65 DEFINE_FLAG(bool, use_field_guards, true, "Guard field cids."); | 65 DEFINE_FLAG(bool, use_field_guards, true, "Guard field cids."); |
66 DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache"); | 66 DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache"); |
67 DEFINE_FLAG(bool, trace_field_guards, false, "Trace changes in field's cids."); | 67 DEFINE_FLAG(bool, trace_field_guards, false, "Trace changes in field's cids."); |
68 | 68 |
69 DECLARE_FLAG(charp, coverage_dir); | |
70 DECLARE_FLAG(bool, load_deferred_eagerly); | |
71 DECLARE_FLAG(bool, show_invisible_frames); | |
69 DECLARE_FLAG(bool, trace_compiler); | 72 DECLARE_FLAG(bool, trace_compiler); |
70 DECLARE_FLAG(bool, trace_deoptimization); | 73 DECLARE_FLAG(bool, trace_deoptimization); |
71 DECLARE_FLAG(bool, trace_deoptimization_verbose); | 74 DECLARE_FLAG(bool, trace_deoptimization_verbose); |
72 DECLARE_FLAG(bool, show_invisible_frames); | |
73 DECLARE_FLAG(charp, coverage_dir); | |
74 DECLARE_FLAG(bool, write_protect_code); | 75 DECLARE_FLAG(bool, write_protect_code); |
75 | 76 |
77 | |
76 static const char* kGetterPrefix = "get:"; | 78 static const char* kGetterPrefix = "get:"; |
77 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); | 79 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); |
78 static const char* kSetterPrefix = "set:"; | 80 static const char* kSetterPrefix = "set:"; |
79 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); | 81 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); |
80 | 82 |
81 cpp_vtable Object::handle_vtable_ = 0; | 83 cpp_vtable Object::handle_vtable_ = 0; |
82 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; | 84 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; |
83 cpp_vtable Smi::handle_vtable_ = 0; | 85 cpp_vtable Smi::handle_vtable_ = 0; |
84 | 86 |
85 // These are initialized to a value that will force a illegal memory access if | 87 // These are initialized to a value that will force a illegal memory access if |
(...skipping 10126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10212 const intptr_t new_length = length + kIncrementSize; | 10214 const intptr_t new_length = length + kIncrementSize; |
10213 imports = Array::Grow(imports, new_length, Heap::kOld); | 10215 imports = Array::Grow(imports, new_length, Heap::kOld); |
10214 set_imports(imports); | 10216 set_imports(imports); |
10215 } | 10217 } |
10216 imports.SetAt(num_current_imports, import); | 10218 imports.SetAt(num_current_imports, import); |
10217 set_num_imports(num_current_imports + 1); | 10219 set_num_imports(num_current_imports + 1); |
10218 } | 10220 } |
10219 | 10221 |
10220 | 10222 |
10221 RawObject* LibraryPrefix::LookupObject(const String& name) const { | 10223 RawObject* LibraryPrefix::LookupObject(const String& name) const { |
10222 if (!is_loaded()) { | 10224 if (!is_loaded() && !FLAG_load_deferred_eagerly) { |
10223 return Object::null(); | 10225 return Object::null(); |
10224 } | 10226 } |
10225 Array& imports = Array::Handle(this->imports()); | 10227 Array& imports = Array::Handle(this->imports()); |
10226 Object& obj = Object::Handle(); | 10228 Object& obj = Object::Handle(); |
10227 Namespace& import = Namespace::Handle(); | 10229 Namespace& import = Namespace::Handle(); |
10228 Library& import_lib = Library::Handle(); | 10230 Library& import_lib = Library::Handle(); |
10229 String& import_lib_url = String::Handle(); | 10231 String& import_lib_url = String::Handle(); |
10230 String& first_import_lib_url = String::Handle(); | 10232 String& first_import_lib_url = String::Handle(); |
10231 Object& found_obj = Object::Handle(); | 10233 Object& found_obj = Object::Handle(); |
10232 for (intptr_t i = 0; i < num_imports(); i++) { | 10234 for (intptr_t i = 0; i < num_imports(); i++) { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10359 | 10361 |
10360 void LibraryPrefix::RegisterDependentCode(const Code& code) const { | 10362 void LibraryPrefix::RegisterDependentCode(const Code& code) const { |
10361 ASSERT(is_deferred_load()); | 10363 ASSERT(is_deferred_load()); |
10362 ASSERT(!is_loaded()); | 10364 ASSERT(!is_loaded()); |
10363 PrefixDependentArray a(*this); | 10365 PrefixDependentArray a(*this); |
10364 a.Register(code); | 10366 a.Register(code); |
10365 } | 10367 } |
10366 | 10368 |
10367 | 10369 |
10368 void LibraryPrefix::InvalidateDependentCode() const { | 10370 void LibraryPrefix::InvalidateDependentCode() const { |
10369 PrefixDependentArray a(*this); | 10371 // When eagerely loading classes we emit runtime checks for loadef state of |
hausner
2015/07/08 18:19:57
loadef -> loaded.
I would change the compiler so
srdjan
2015/07/09 16:41:43
No deferred prefixes are allowed when eager deferr
| |
10370 a.DisableCode(); | 10372 // prefixes, therefore no recompilation is necessary/allowed. |
10371 set_is_loaded(); | 10373 if (!FLAG_load_deferred_eagerly) { |
10374 PrefixDependentArray a(*this); | |
10375 a.DisableCode(); | |
10376 set_is_loaded(); | |
10377 } | |
10372 } | 10378 } |
10373 | 10379 |
10374 | 10380 |
10375 RawLibraryPrefix* LibraryPrefix::New() { | 10381 RawLibraryPrefix* LibraryPrefix::New() { |
10376 RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, | 10382 RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, |
10377 LibraryPrefix::InstanceSize(), | 10383 LibraryPrefix::InstanceSize(), |
10378 Heap::kOld); | 10384 Heap::kOld); |
10379 return reinterpret_cast<RawLibraryPrefix*>(raw); | 10385 return reinterpret_cast<RawLibraryPrefix*>(raw); |
10380 } | 10386 } |
10381 | 10387 |
(...skipping 10798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
21180 return tag_label.ToCString(); | 21186 return tag_label.ToCString(); |
21181 } | 21187 } |
21182 | 21188 |
21183 | 21189 |
21184 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21190 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21185 Instance::PrintJSONImpl(stream, ref); | 21191 Instance::PrintJSONImpl(stream, ref); |
21186 } | 21192 } |
21187 | 21193 |
21188 | 21194 |
21189 } // namespace dart | 21195 } // namespace dart |
OLD | NEW |