Chromium Code Reviews| 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/become.h" | 10 #include "vm/become.h" |
| (...skipping 5155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5166 | 5166 |
| 5167 void PatchClass::set_script(const Script& value) const { | 5167 void PatchClass::set_script(const Script& value) const { |
| 5168 StorePointer(&raw_ptr()->script_, value.raw()); | 5168 StorePointer(&raw_ptr()->script_, value.raw()); |
| 5169 } | 5169 } |
| 5170 | 5170 |
| 5171 intptr_t Function::Hash() const { | 5171 intptr_t Function::Hash() const { |
| 5172 return String::HashRawSymbol(name()); | 5172 return String::HashRawSymbol(name()); |
| 5173 } | 5173 } |
| 5174 | 5174 |
| 5175 bool Function::HasBreakpoint() const { | 5175 bool Function::HasBreakpoint() const { |
| 5176 #if defined(PRODUCT) | |
| 5177 return false; | |
| 5178 #else | |
| 5176 if (!FLAG_support_debugger) { | 5179 if (!FLAG_support_debugger) { |
|
rmacnak
2017/07/18 18:17:40
Consider removing FLAG_support_debugger since we n
zra
2017/07/18 20:28:54
Done.
| |
| 5177 return false; | 5180 return false; |
| 5178 } | 5181 } |
| 5179 Thread* thread = Thread::Current(); | 5182 Thread* thread = Thread::Current(); |
| 5180 return thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); | 5183 return thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); |
| 5184 #endif | |
| 5181 } | 5185 } |
| 5182 | 5186 |
| 5183 void Function::InstallOptimizedCode(const Code& code) const { | 5187 void Function::InstallOptimizedCode(const Code& code) const { |
| 5184 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); | 5188 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); |
| 5185 // We may not have previous code if FLAG_precompile is set. | 5189 // We may not have previous code if FLAG_precompile is set. |
| 5186 // Hot-reload may have already disabled the current code. | 5190 // Hot-reload may have already disabled the current code. |
| 5187 if (HasCode() && !Code::Handle(CurrentCode()).IsDisabled()) { | 5191 if (HasCode() && !Code::Handle(CurrentCode()).IsDisabled()) { |
| 5188 Code::Handle(CurrentCode()).DisableDartCode(); | 5192 Code::Handle(CurrentCode()).DisableDartCode(); |
| 5189 } | 5193 } |
| 5190 AttachCode(code); | 5194 AttachCode(code); |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5951 void Function::SetIsOptimizable(bool value) const { | 5955 void Function::SetIsOptimizable(bool value) const { |
| 5952 ASSERT(!is_native()); | 5956 ASSERT(!is_native()); |
| 5953 set_is_optimizable(value); | 5957 set_is_optimizable(value); |
| 5954 if (!value) { | 5958 if (!value) { |
| 5955 set_is_inlinable(false); | 5959 set_is_inlinable(false); |
| 5956 set_usage_counter(INT_MIN); | 5960 set_usage_counter(INT_MIN); |
| 5957 } | 5961 } |
| 5958 } | 5962 } |
| 5959 | 5963 |
| 5960 bool Function::CanBeInlined() const { | 5964 bool Function::CanBeInlined() const { |
| 5965 #if defined(PRODUCT) | |
| 5966 return is_inlinable() && !is_external() && !is_generated_body(); | |
| 5967 #else | |
| 5961 Thread* thread = Thread::Current(); | 5968 Thread* thread = Thread::Current(); |
| 5962 return is_inlinable() && !is_external() && !is_generated_body() && | 5969 return is_inlinable() && !is_external() && !is_generated_body() && |
| 5963 (!FLAG_support_debugger || | 5970 (!FLAG_support_debugger || |
| 5964 !thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone())); | 5971 !thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone())); |
| 5972 #endif | |
| 5965 } | 5973 } |
| 5966 | 5974 |
| 5967 intptr_t Function::NumParameters() const { | 5975 intptr_t Function::NumParameters() const { |
| 5968 return num_fixed_parameters() + NumOptionalParameters(); | 5976 return num_fixed_parameters() + NumOptionalParameters(); |
| 5969 } | 5977 } |
| 5970 | 5978 |
| 5971 intptr_t Function::NumImplicitParameters() const { | 5979 intptr_t Function::NumImplicitParameters() const { |
| 5972 if (kind() == RawFunction::kConstructor) { | 5980 if (kind() == RawFunction::kConstructor) { |
| 5973 // Type arguments for factory; instance for generative constructor. | 5981 // Type arguments for factory; instance for generative constructor. |
| 5974 return 1; | 5982 return 1; |
| (...skipping 7606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13581 // emitting assembly. This guarantees that every succeeding pc-offset is | 13589 // emitting assembly. This guarantees that every succeeding pc-offset is |
| 13582 // larger than the previously added one. | 13590 // larger than the previously added one. |
| 13583 for (intptr_t i = kSCallTableEntryLength; i < value.Length(); | 13591 for (intptr_t i = kSCallTableEntryLength; i < value.Length(); |
| 13584 i += kSCallTableEntryLength) { | 13592 i += kSCallTableEntryLength) { |
| 13585 ASSERT(value.At(i - kSCallTableEntryLength) < value.At(i)); | 13593 ASSERT(value.At(i - kSCallTableEntryLength) < value.At(i)); |
| 13586 } | 13594 } |
| 13587 #endif // DEBUG | 13595 #endif // DEBUG |
| 13588 } | 13596 } |
| 13589 | 13597 |
| 13590 bool Code::HasBreakpoint() const { | 13598 bool Code::HasBreakpoint() const { |
| 13599 #if defined(PRODUCT) | |
| 13600 return false; | |
| 13601 #else | |
| 13591 if (!FLAG_support_debugger) { | 13602 if (!FLAG_support_debugger) { |
| 13592 return false; | 13603 return false; |
| 13593 } | 13604 } |
| 13594 return Isolate::Current()->debugger()->HasBreakpoint(*this); | 13605 return Isolate::Current()->debugger()->HasBreakpoint(*this); |
| 13606 #endif | |
| 13595 } | 13607 } |
| 13596 | 13608 |
| 13597 RawTypedData* Code::GetDeoptInfoAtPc(uword pc, | 13609 RawTypedData* Code::GetDeoptInfoAtPc(uword pc, |
| 13598 ICData::DeoptReasonId* deopt_reason, | 13610 ICData::DeoptReasonId* deopt_reason, |
| 13599 uint32_t* deopt_flags) const { | 13611 uint32_t* deopt_flags) const { |
| 13600 #if defined(DART_PRECOMPILED_RUNTIME) | 13612 #if defined(DART_PRECOMPILED_RUNTIME) |
| 13601 ASSERT(Dart::vm_snapshot_kind() == Snapshot::kFullAOT); | 13613 ASSERT(Dart::vm_snapshot_kind() == Snapshot::kFullAOT); |
| 13602 return TypedData::null(); | 13614 return TypedData::null(); |
| 13603 #else | 13615 #else |
| 13604 ASSERT(is_optimized()); | 13616 ASSERT(is_optimized()); |
| (...skipping 8627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 22232 } | 22244 } |
| 22233 return UserTag::null(); | 22245 return UserTag::null(); |
| 22234 } | 22246 } |
| 22235 | 22247 |
| 22236 const char* UserTag::ToCString() const { | 22248 const char* UserTag::ToCString() const { |
| 22237 const String& tag_label = String::Handle(label()); | 22249 const String& tag_label = String::Handle(label()); |
| 22238 return tag_label.ToCString(); | 22250 return tag_label.ToCString(); |
| 22239 } | 22251 } |
| 22240 | 22252 |
| 22241 } // namespace dart | 22253 } // namespace dart |
| OLD | NEW |