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 5566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5577 | 5577 |
5578 | 5578 |
5579 void Function::SetIsNativeAutoSetupScope(bool value) const { | 5579 void Function::SetIsNativeAutoSetupScope(bool value) const { |
5580 ASSERT(is_native()); | 5580 ASSERT(is_native()); |
5581 set_is_optimizable(value); | 5581 set_is_optimizable(value); |
5582 } | 5582 } |
5583 | 5583 |
5584 | 5584 |
5585 bool Function::CanBeInlined() const { | 5585 bool Function::CanBeInlined() const { |
5586 return is_inlinable() && | 5586 return is_inlinable() && |
5587 !is_async_closure() && | 5587 !is_generated_body() && |
5588 HasCode() && | 5588 HasCode() && |
5589 !Isolate::Current()->debugger()->HasBreakpoint(*this); | 5589 !Isolate::Current()->debugger()->HasBreakpoint(*this); |
5590 } | 5590 } |
5591 | 5591 |
5592 | 5592 |
5593 intptr_t Function::NumParameters() const { | 5593 intptr_t Function::NumParameters() const { |
5594 return num_fixed_parameters() + NumOptionalParameters(); | 5594 return num_fixed_parameters() + NumOptionalParameters(); |
5595 } | 5595 } |
5596 | 5596 |
5597 | 5597 |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6104 result.set_modifier(RawFunction::kNoModifier); | 6104 result.set_modifier(RawFunction::kNoModifier); |
6105 result.set_is_static(is_static); | 6105 result.set_is_static(is_static); |
6106 result.set_is_const(is_const); | 6106 result.set_is_const(is_const); |
6107 result.set_is_abstract(is_abstract); | 6107 result.set_is_abstract(is_abstract); |
6108 result.set_is_external(is_external); | 6108 result.set_is_external(is_external); |
6109 result.set_is_native(is_native); | 6109 result.set_is_native(is_native); |
6110 result.set_is_reflectable(true); // Will be computed later. | 6110 result.set_is_reflectable(true); // Will be computed later. |
6111 result.set_is_debuggable(true); // Will be computed later. | 6111 result.set_is_debuggable(true); // Will be computed later. |
6112 result.set_is_intrinsic(false); | 6112 result.set_is_intrinsic(false); |
6113 result.set_is_redirecting(false); | 6113 result.set_is_redirecting(false); |
6114 result.set_is_async_closure(false); | 6114 result.set_is_generated_body(false); |
6115 result.set_always_inline(false); | 6115 result.set_always_inline(false); |
6116 result.set_is_polymorphic_target(false); | 6116 result.set_is_polymorphic_target(false); |
6117 result.set_owner(owner); | 6117 result.set_owner(owner); |
6118 result.set_token_pos(token_pos); | 6118 result.set_token_pos(token_pos); |
6119 result.set_end_token_pos(token_pos); | 6119 result.set_end_token_pos(token_pos); |
6120 result.set_num_fixed_parameters(0); | 6120 result.set_num_fixed_parameters(0); |
6121 result.set_num_optional_parameters(0); | 6121 result.set_num_optional_parameters(0); |
6122 result.set_usage_counter(0); | 6122 result.set_usage_counter(0); |
6123 result.set_deoptimization_counter(0); | 6123 result.set_deoptimization_counter(0); |
6124 result.set_regexp_cid(kIllegalCid); | 6124 result.set_regexp_cid(kIllegalCid); |
(...skipping 6656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12781 | 12781 |
12782 | 12782 |
12783 void ContextScope::SetContextLevelAt(intptr_t scope_index, | 12783 void ContextScope::SetContextLevelAt(intptr_t scope_index, |
12784 intptr_t context_level) const { | 12784 intptr_t context_level) const { |
12785 StoreSmi(&(VariableDescAddr(scope_index)->context_level), | 12785 StoreSmi(&(VariableDescAddr(scope_index)->context_level), |
12786 Smi::New(context_level)); | 12786 Smi::New(context_level)); |
12787 } | 12787 } |
12788 | 12788 |
12789 | 12789 |
12790 const char* ContextScope::ToCString() const { | 12790 const char* ContextScope::ToCString() const { |
12791 return "ContextScope"; | 12791 const char* format = |
| 12792 "%s\nvar %s token-pos %" Pd " ctx lvl %" Pd " index %" Pd ""; |
| 12793 const char* prev_cstr = "ContextScope:"; |
| 12794 String& name = String::Handle(); |
| 12795 for (int i = 0; i < num_variables(); i++) { |
| 12796 name = NameAt(i); |
| 12797 const char* cname = name.ToCString(); |
| 12798 intptr_t pos = TokenIndexAt(i); |
| 12799 intptr_t idx = ContextIndexAt(i); |
| 12800 intptr_t lvl = ContextLevelAt(i); |
| 12801 intptr_t len = |
| 12802 OS::SNPrint(NULL, 0, format, prev_cstr, cname, pos, lvl, idx) + 1; |
| 12803 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 12804 OS::SNPrint(chars, len, format, prev_cstr, cname, pos, lvl, idx); |
| 12805 prev_cstr = chars; |
| 12806 } |
| 12807 return prev_cstr; |
12792 } | 12808 } |
12793 | 12809 |
12794 | 12810 |
12795 void ContextScope::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12811 void ContextScope::PrintJSONImpl(JSONStream* stream, bool ref) const { |
12796 Object::PrintJSONImpl(stream, ref); | 12812 Object::PrintJSONImpl(stream, ref); |
12797 } | 12813 } |
12798 | 12814 |
12799 | 12815 |
12800 RawArray* MegamorphicCache::buckets() const { | 12816 RawArray* MegamorphicCache::buckets() const { |
12801 return raw_ptr()->buckets_; | 12817 return raw_ptr()->buckets_; |
(...skipping 7748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20550 return tag_label.ToCString(); | 20566 return tag_label.ToCString(); |
20551 } | 20567 } |
20552 | 20568 |
20553 | 20569 |
20554 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20570 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20555 Instance::PrintJSONImpl(stream, ref); | 20571 Instance::PrintJSONImpl(stream, ref); |
20556 } | 20572 } |
20557 | 20573 |
20558 | 20574 |
20559 } // namespace dart | 20575 } // namespace dart |
OLD | NEW |