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 = "%s\nvar %s token-pos %ld ctx lvl %ld index %ld"; |
srdjan
2015/02/04 19:29:12
I am not sure %ld will fly on all platforms. Maybe
hausner
2015/02/04 22:09:24
Right. Done.
| |
12792 const char* prev_cstr = "ContextScope:"; | |
12793 String& name = String::Handle(); | |
12794 for (int i = 0; i < num_variables(); i++) { | |
12795 name = NameAt(i); | |
12796 const char* cname = name.ToCString(); | |
12797 intptr_t pos = TokenIndexAt(i); | |
12798 intptr_t idx = ContextIndexAt(i); | |
12799 intptr_t lvl = ContextLevelAt(i); | |
12800 intptr_t len = | |
12801 OS::SNPrint(NULL, 0, format, prev_cstr, cname, pos, lvl, idx) + 1; | |
12802 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | |
12803 OS::SNPrint(chars, len, format, prev_cstr, cname, pos, lvl, idx); | |
12804 prev_cstr = chars; | |
12805 } | |
12806 return prev_cstr; | |
12792 } | 12807 } |
12793 | 12808 |
12794 | 12809 |
12795 void ContextScope::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12810 void ContextScope::PrintJSONImpl(JSONStream* stream, bool ref) const { |
12796 Object::PrintJSONImpl(stream, ref); | 12811 Object::PrintJSONImpl(stream, ref); |
12797 } | 12812 } |
12798 | 12813 |
12799 | 12814 |
12800 RawArray* MegamorphicCache::buckets() const { | 12815 RawArray* MegamorphicCache::buckets() const { |
12801 return raw_ptr()->buckets_; | 12816 return raw_ptr()->buckets_; |
(...skipping 7763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
20565 return tag_label.ToCString(); | 20580 return tag_label.ToCString(); |
20566 } | 20581 } |
20567 | 20582 |
20568 | 20583 |
20569 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20584 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20570 Instance::PrintJSONImpl(stream, ref); | 20585 Instance::PrintJSONImpl(stream, ref); |
20571 } | 20586 } |
20572 | 20587 |
20573 | 20588 |
20574 } // namespace dart | 20589 } // namespace dart |
OLD | NEW |