| 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 (!FLAG_support_debugger) { | 5176 #if defined(PRODUCT) |
| 5177 return false; | 5177 return false; |
| 5178 } | 5178 #else |
| 5179 Thread* thread = Thread::Current(); | 5179 Thread* thread = Thread::Current(); |
| 5180 return thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); | 5180 return thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); |
| 5181 #endif |
| 5181 } | 5182 } |
| 5182 | 5183 |
| 5183 void Function::InstallOptimizedCode(const Code& code) const { | 5184 void Function::InstallOptimizedCode(const Code& code) const { |
| 5184 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); | 5185 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); |
| 5185 // We may not have previous code if FLAG_precompile is set. | 5186 // We may not have previous code if FLAG_precompile is set. |
| 5186 // Hot-reload may have already disabled the current code. | 5187 // Hot-reload may have already disabled the current code. |
| 5187 if (HasCode() && !Code::Handle(CurrentCode()).IsDisabled()) { | 5188 if (HasCode() && !Code::Handle(CurrentCode()).IsDisabled()) { |
| 5188 Code::Handle(CurrentCode()).DisableDartCode(); | 5189 Code::Handle(CurrentCode()).DisableDartCode(); |
| 5189 } | 5190 } |
| 5190 AttachCode(code); | 5191 AttachCode(code); |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5951 void Function::SetIsOptimizable(bool value) const { | 5952 void Function::SetIsOptimizable(bool value) const { |
| 5952 ASSERT(!is_native()); | 5953 ASSERT(!is_native()); |
| 5953 set_is_optimizable(value); | 5954 set_is_optimizable(value); |
| 5954 if (!value) { | 5955 if (!value) { |
| 5955 set_is_inlinable(false); | 5956 set_is_inlinable(false); |
| 5956 set_usage_counter(INT_MIN); | 5957 set_usage_counter(INT_MIN); |
| 5957 } | 5958 } |
| 5958 } | 5959 } |
| 5959 | 5960 |
| 5960 bool Function::CanBeInlined() const { | 5961 bool Function::CanBeInlined() const { |
| 5962 #if defined(PRODUCT) |
| 5963 return is_inlinable() && !is_external() && !is_generated_body(); |
| 5964 #else |
| 5961 Thread* thread = Thread::Current(); | 5965 Thread* thread = Thread::Current(); |
| 5962 return is_inlinable() && !is_external() && !is_generated_body() && | 5966 return is_inlinable() && !is_external() && !is_generated_body() && |
| 5963 (!FLAG_support_debugger || | 5967 !thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); |
| 5964 !thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone())); | 5968 #endif |
| 5965 } | 5969 } |
| 5966 | 5970 |
| 5967 intptr_t Function::NumParameters() const { | 5971 intptr_t Function::NumParameters() const { |
| 5968 return num_fixed_parameters() + NumOptionalParameters(); | 5972 return num_fixed_parameters() + NumOptionalParameters(); |
| 5969 } | 5973 } |
| 5970 | 5974 |
| 5971 intptr_t Function::NumImplicitParameters() const { | 5975 intptr_t Function::NumImplicitParameters() const { |
| 5972 if (kind() == RawFunction::kConstructor) { | 5976 if (kind() == RawFunction::kConstructor) { |
| 5973 // Type arguments for factory; instance for generative constructor. | 5977 // Type arguments for factory; instance for generative constructor. |
| 5974 return 1; | 5978 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 | 13585 // emitting assembly. This guarantees that every succeeding pc-offset is |
| 13582 // larger than the previously added one. | 13586 // larger than the previously added one. |
| 13583 for (intptr_t i = kSCallTableEntryLength; i < value.Length(); | 13587 for (intptr_t i = kSCallTableEntryLength; i < value.Length(); |
| 13584 i += kSCallTableEntryLength) { | 13588 i += kSCallTableEntryLength) { |
| 13585 ASSERT(value.At(i - kSCallTableEntryLength) < value.At(i)); | 13589 ASSERT(value.At(i - kSCallTableEntryLength) < value.At(i)); |
| 13586 } | 13590 } |
| 13587 #endif // DEBUG | 13591 #endif // DEBUG |
| 13588 } | 13592 } |
| 13589 | 13593 |
| 13590 bool Code::HasBreakpoint() const { | 13594 bool Code::HasBreakpoint() const { |
| 13591 if (!FLAG_support_debugger) { | 13595 #if defined(PRODUCT) |
| 13592 return false; | 13596 return false; |
| 13593 } | 13597 #else |
| 13594 return Isolate::Current()->debugger()->HasBreakpoint(*this); | 13598 return Isolate::Current()->debugger()->HasBreakpoint(*this); |
| 13599 #endif |
| 13595 } | 13600 } |
| 13596 | 13601 |
| 13597 RawTypedData* Code::GetDeoptInfoAtPc(uword pc, | 13602 RawTypedData* Code::GetDeoptInfoAtPc(uword pc, |
| 13598 ICData::DeoptReasonId* deopt_reason, | 13603 ICData::DeoptReasonId* deopt_reason, |
| 13599 uint32_t* deopt_flags) const { | 13604 uint32_t* deopt_flags) const { |
| 13600 #if defined(DART_PRECOMPILED_RUNTIME) | 13605 #if defined(DART_PRECOMPILED_RUNTIME) |
| 13601 ASSERT(Dart::vm_snapshot_kind() == Snapshot::kFullAOT); | 13606 ASSERT(Dart::vm_snapshot_kind() == Snapshot::kFullAOT); |
| 13602 return TypedData::null(); | 13607 return TypedData::null(); |
| 13603 #else | 13608 #else |
| 13604 ASSERT(is_optimized()); | 13609 ASSERT(is_optimized()); |
| (...skipping 8627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22232 } | 22237 } |
| 22233 return UserTag::null(); | 22238 return UserTag::null(); |
| 22234 } | 22239 } |
| 22235 | 22240 |
| 22236 const char* UserTag::ToCString() const { | 22241 const char* UserTag::ToCString() const { |
| 22237 const String& tag_label = String::Handle(label()); | 22242 const String& tag_label = String::Handle(label()); |
| 22238 return tag_label.ToCString(); | 22243 return tag_label.ToCString(); |
| 22239 } | 22244 } |
| 22240 | 22245 |
| 22241 } // namespace dart | 22246 } // namespace dart |
| OLD | NEW |