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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 4909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4920 void PatchClass::set_source_class(const Class& value) const { | 4920 void PatchClass::set_source_class(const Class& value) const { |
| 4921 StorePointer(&raw_ptr()->source_class_, value.raw()); | 4921 StorePointer(&raw_ptr()->source_class_, value.raw()); |
| 4922 } | 4922 } |
| 4923 | 4923 |
| 4924 | 4924 |
| 4925 bool Function::HasBreakpoint() const { | 4925 bool Function::HasBreakpoint() const { |
| 4926 return Isolate::Current()->debugger()->HasBreakpoint(*this); | 4926 return Isolate::Current()->debugger()->HasBreakpoint(*this); |
| 4927 } | 4927 } |
| 4928 | 4928 |
| 4929 | 4929 |
| 4930 void Function::set_code(const Code& value) const { | 4930 void Function::SetCode(const Code& value) const { |
| 4931 StorePointer(&raw_ptr()->code_, value.raw()); | 4931 StorePointer(&raw_ptr()->instructions_, value.instructions()); |
| 4932 } | 4932 } |
| 4933 | 4933 |
| 4934 void Function::AttachCode(const Code& value) const { | 4934 void Function::AttachCode(const Code& value) const { |
| 4935 set_code(value); | 4935 SetCode(value); |
| 4936 ASSERT(Function::Handle(value.function()).IsNull() || | 4936 ASSERT(Function::Handle(value.function()).IsNull() || |
| 4937 (value.function() == this->raw())); | 4937 (value.function() == this->raw())); |
| 4938 value.set_owner(*this); | 4938 value.set_owner(*this); |
| 4939 } | 4939 } |
| 4940 | 4940 |
| 4941 | 4941 |
| 4942 bool Function::HasCode() const { | 4942 bool Function::HasCode() const { |
| 4943 ASSERT(raw_ptr()->code_ != Code::null()); | 4943 ASSERT(raw_ptr()->instructions_ != Instructions::null()); |
| 4944 return raw_ptr()->code_ != StubCode::LazyCompile_entry()->code(); | 4944 return raw_ptr()->instructions_ != |
| 4945 StubCode::LazyCompile_entry()->code()->ptr()->instructions_; | |
| 4945 } | 4946 } |
| 4946 | 4947 |
| 4947 | 4948 |
| 4948 void Function::ClearCode() const { | 4949 void Function::ClearCode() const { |
| 4949 StorePointer(&raw_ptr()->code_, StubCode::LazyCompile_entry()->code()); | |
| 4950 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); | 4950 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); |
| 4951 StorePointer(&raw_ptr()->instructions_, | |
| 4952 Code::Handle(StubCode::LazyCompile_entry()->code()).instructions()); | |
| 4951 } | 4953 } |
| 4952 | 4954 |
| 4953 | 4955 |
| 4954 void Function::SwitchToUnoptimizedCode() const { | 4956 void Function::SwitchToUnoptimizedCode() const { |
| 4955 ASSERT(HasOptimizedCode()); | 4957 ASSERT(HasOptimizedCode()); |
| 4956 const Code& current_code = Code::Handle(CurrentCode()); | 4958 const Code& current_code = Code::Handle(CurrentCode()); |
| 4957 | 4959 |
| 4958 if (FLAG_trace_disabling_optimized_code) { | 4960 if (FLAG_trace_disabling_optimized_code) { |
| 4959 OS::Print("Disabling optimized code: '%s' entry: %#" Px "\n", | 4961 OS::Print("Disabling optimized code: '%s' entry: %#" Px "\n", |
| 4960 ToFullyQualifiedCString(), | 4962 ToFullyQualifiedCString(), |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5969 result.set_end_token_pos(token_pos); | 5971 result.set_end_token_pos(token_pos); |
| 5970 result.set_num_fixed_parameters(0); | 5972 result.set_num_fixed_parameters(0); |
| 5971 result.set_num_optional_parameters(0); | 5973 result.set_num_optional_parameters(0); |
| 5972 result.set_usage_counter(0); | 5974 result.set_usage_counter(0); |
| 5973 result.set_deoptimization_counter(0); | 5975 result.set_deoptimization_counter(0); |
| 5974 result.set_optimized_instruction_count(0); | 5976 result.set_optimized_instruction_count(0); |
| 5975 result.set_optimized_call_site_count(0); | 5977 result.set_optimized_call_site_count(0); |
| 5976 result.set_is_optimizable(is_native ? false : true); | 5978 result.set_is_optimizable(is_native ? false : true); |
| 5977 result.set_is_inlinable(true); | 5979 result.set_is_inlinable(true); |
| 5978 result.set_allows_hoisting_check_class(true); | 5980 result.set_allows_hoisting_check_class(true); |
| 5979 result.set_code(Code::Handle(StubCode::LazyCompile_entry()->code())); | 5981 result.SetCode(Code::Handle(StubCode::LazyCompile_entry()->code())); |
| 5980 if (kind == RawFunction::kClosureFunction) { | 5982 if (kind == RawFunction::kClosureFunction) { |
| 5981 const ClosureData& data = ClosureData::Handle(ClosureData::New()); | 5983 const ClosureData& data = ClosureData::Handle(ClosureData::New()); |
| 5982 result.set_data(data); | 5984 result.set_data(data); |
| 5983 } | 5985 } |
| 5984 | 5986 |
| 5985 return result.raw(); | 5987 return result.raw(); |
| 5986 } | 5988 } |
| 5987 | 5989 |
| 5988 | 5990 |
| 5989 RawFunction* Function::Clone(const Class& new_owner) const { | 5991 RawFunction* Function::Clone(const Class& new_owner) const { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6294 const Object& obj = Object::Handle(raw_ptr()->owner_); | 6296 const Object& obj = Object::Handle(raw_ptr()->owner_); |
| 6295 if (obj.IsClass()) { | 6297 if (obj.IsClass()) { |
| 6296 return Class::Cast(obj).script(); | 6298 return Class::Cast(obj).script(); |
| 6297 } | 6299 } |
| 6298 ASSERT(obj.IsPatchClass()); | 6300 ASSERT(obj.IsPatchClass()); |
| 6299 return PatchClass::Cast(obj).Script(); | 6301 return PatchClass::Cast(obj).Script(); |
| 6300 } | 6302 } |
| 6301 | 6303 |
| 6302 | 6304 |
| 6303 bool Function::HasOptimizedCode() const { | 6305 bool Function::HasOptimizedCode() const { |
| 6304 return HasCode() && Code::Handle(raw_ptr()->code_).is_optimized(); | 6306 return HasCode() && |
| 6307 Code::Handle(Instructions::Handle(raw_ptr()->instructions_).code()). | |
|
zra
2014/06/03 21:05:23
I haven't seen many line breaks after . in our cod
srdjan
2014/06/03 21:28:34
Done.
| |
| 6308 is_optimized(); | |
| 6305 } | 6309 } |
| 6306 | 6310 |
| 6307 | 6311 |
| 6308 RawString* Function::PrettyName() const { | 6312 RawString* Function::PrettyName() const { |
| 6309 const String& str = String::Handle(name()); | 6313 const String& str = String::Handle(name()); |
| 6310 return String::IdentifierPrettyName(str); | 6314 return String::IdentifierPrettyName(str); |
| 6311 } | 6315 } |
| 6312 | 6316 |
| 6313 | 6317 |
| 6314 RawString* Function::UserVisibleName() const { | 6318 RawString* Function::UserVisibleName() const { |
| (...skipping 12665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18980 return tag_label.ToCString(); | 18984 return tag_label.ToCString(); |
| 18981 } | 18985 } |
| 18982 | 18986 |
| 18983 | 18987 |
| 18984 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 18988 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 18985 Instance::PrintJSONImpl(stream, ref); | 18989 Instance::PrintJSONImpl(stream, ref); |
| 18986 } | 18990 } |
| 18987 | 18991 |
| 18988 | 18992 |
| 18989 } // namespace dart | 18993 } // namespace dart |
| OLD | NEW |