Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: runtime/vm/object.cc

Issue 243583008: Undo r35207 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 25 matching lines...) Expand all
36 #include "vm/object_id_ring.h" 36 #include "vm/object_id_ring.h"
37 #include "vm/object_store.h" 37 #include "vm/object_store.h"
38 #include "vm/parser.h" 38 #include "vm/parser.h"
39 #include "vm/reusable_handles.h" 39 #include "vm/reusable_handles.h"
40 #include "vm/runtime_entry.h" 40 #include "vm/runtime_entry.h"
41 #include "vm/scopes.h" 41 #include "vm/scopes.h"
42 #include "vm/stack_frame.h" 42 #include "vm/stack_frame.h"
43 #include "vm/symbols.h" 43 #include "vm/symbols.h"
44 #include "vm/tags.h" 44 #include "vm/tags.h"
45 #include "vm/timer.h" 45 #include "vm/timer.h"
46 #include "vm/trace_buffer.h"
47 #include "vm/unicode.h" 46 #include "vm/unicode.h"
48 47
49 namespace dart { 48 namespace dart {
50 49
51 DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000, 50 DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000,
52 "Huge method cutoff in unoptimized code size (in bytes)."); 51 "Huge method cutoff in unoptimized code size (in bytes).");
53 DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000, 52 DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000,
54 "Huge method cutoff in tokens: Disables optimizations for huge methods."); 53 "Huge method cutoff in tokens: Disables optimizations for huge methods.");
55 DEFINE_FLAG(bool, overlap_type_arguments, true, 54 DEFINE_FLAG(bool, overlap_type_arguments, true,
56 "When possible, partially or fully overlap the type arguments of a type " 55 "When possible, partially or fully overlap the type arguments of a type "
(...skipping 5826 matching lines...) Expand 10 before | Expand all | Expand 10 after
5883 result.set_end_token_pos(token_pos); 5882 result.set_end_token_pos(token_pos);
5884 result.set_num_fixed_parameters(0); 5883 result.set_num_fixed_parameters(0);
5885 result.set_num_optional_parameters(0); 5884 result.set_num_optional_parameters(0);
5886 result.set_usage_counter(0); 5885 result.set_usage_counter(0);
5887 result.set_deoptimization_counter(0); 5886 result.set_deoptimization_counter(0);
5888 result.set_optimized_instruction_count(0); 5887 result.set_optimized_instruction_count(0);
5889 result.set_optimized_call_site_count(0); 5888 result.set_optimized_call_site_count(0);
5890 result.set_is_optimizable(is_native ? false : true); 5889 result.set_is_optimizable(is_native ? false : true);
5891 result.set_is_inlinable(true); 5890 result.set_is_inlinable(true);
5892 result.set_allows_hoisting_check_class(true); 5891 result.set_allows_hoisting_check_class(true);
5893 result.set_log(new TraceBuffer());
5894 if (kind == RawFunction::kClosureFunction) { 5892 if (kind == RawFunction::kClosureFunction) {
5895 const ClosureData& data = ClosureData::Handle(ClosureData::New()); 5893 const ClosureData& data = ClosureData::Handle(ClosureData::New());
5896 result.set_data(data); 5894 result.set_data(data);
5897 } 5895 }
5898 5896
5899 // TODO(zra): Remove when arm64 is ready. 5897 // TODO(zra): Remove when arm64 is ready.
5900 #if !defined(TARGET_ARCH_ARM64) 5898 #if !defined(TARGET_ARCH_ARM64)
5901 result.set_code(Code::Handle(StubCode::LazyCompile_entry()->code())); 5899 result.set_code(Code::Handle(StubCode::LazyCompile_entry()->code()));
5902 #else 5900 #else
5903 result.set_code(Code::Handle()); 5901 result.set_code(Code::Handle());
5904 #endif 5902 #endif
5905 return result.raw(); 5903 return result.raw();
5906 } 5904 }
5907 5905
5908 5906
5909 RawFunction* Function::Clone(const Class& new_owner) const { 5907 RawFunction* Function::Clone(const Class& new_owner) const {
5910 ASSERT(!IsConstructor()); 5908 ASSERT(!IsConstructor());
5911 Function& clone = Function::Handle(); 5909 Function& clone = Function::Handle();
5912 clone ^= Object::Clone(*this, Heap::kOld); 5910 clone ^= Object::Clone(*this, Heap::kOld);
5913 const Class& origin = Class::Handle(this->origin()); 5911 const Class& origin = Class::Handle(this->origin());
5914 const PatchClass& clone_owner = 5912 const PatchClass& clone_owner =
5915 PatchClass::Handle(PatchClass::New(new_owner, origin)); 5913 PatchClass::Handle(PatchClass::New(new_owner, origin));
5916 clone.set_owner(clone_owner); 5914 clone.set_owner(clone_owner);
5917 clone.ClearCode(); 5915 clone.ClearCode();
5918 clone.set_usage_counter(0); 5916 clone.set_usage_counter(0);
5919 clone.set_deoptimization_counter(0); 5917 clone.set_deoptimization_counter(0);
5920 clone.set_optimized_instruction_count(0); 5918 clone.set_optimized_instruction_count(0);
5921 clone.set_optimized_call_site_count(0); 5919 clone.set_optimized_call_site_count(0);
5922 clone.set_log(new TraceBuffer());
5923 return clone.raw(); 5920 return clone.raw();
5924 } 5921 }
5925 5922
5926 5923
5927 RawFunction* Function::NewClosureFunction(const String& name, 5924 RawFunction* Function::NewClosureFunction(const String& name,
5928 const Function& parent, 5925 const Function& parent,
5929 intptr_t token_pos) { 5926 intptr_t token_pos) {
5930 ASSERT(!parent.IsNull()); 5927 ASSERT(!parent.IsNull());
5931 // Use the owner defining the parent function and not the class containing it. 5928 // Use the owner defining the parent function and not the class containing it.
5932 const Object& parent_owner = Object::Handle(parent.raw_ptr()->owner_); 5929 const Object& parent_owner = Object::Handle(parent.raw_ptr()->owner_);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
6446 } 6443 }
6447 const char* kind_string = Function::KindToCString(kind()); 6444 const char* kind_string = Function::KindToCString(kind());
6448 jsobj.AddProperty("kind", kind_string); 6445 jsobj.AddProperty("kind", kind_string);
6449 if (ref) { 6446 if (ref) {
6450 return; 6447 return;
6451 } 6448 }
6452 jsobj.AddProperty("is_static", is_static()); 6449 jsobj.AddProperty("is_static", is_static());
6453 jsobj.AddProperty("is_const", is_const()); 6450 jsobj.AddProperty("is_const", is_const());
6454 jsobj.AddProperty("is_optimizable", is_optimizable()); 6451 jsobj.AddProperty("is_optimizable", is_optimizable());
6455 jsobj.AddProperty("is_inlinable", IsInlineable()); 6452 jsobj.AddProperty("is_inlinable", IsInlineable());
6456 jsobj.AddProperty("code", Object::Handle(unoptimized_code())); 6453 jsobj.AddProperty("unoptimized_code", Object::Handle(unoptimized_code()));
6457 if (HasOptimizedCode()) {
6458 jsobj.AddProperty("optimizedCode", Object::Handle(CurrentCode()));
6459 }
6460 jsobj.AddProperty("usage_counter", usage_counter()); 6454 jsobj.AddProperty("usage_counter", usage_counter());
6461 jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count()); 6455 jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count());
6456 jsobj.AddProperty("code", Object::Handle(CurrentCode()));
6462 jsobj.AddProperty("deoptimizations", 6457 jsobj.AddProperty("deoptimizations",
6463 static_cast<intptr_t>(deoptimization_counter())); 6458 static_cast<intptr_t>(deoptimization_counter()));
6464 6459
6465 const Script& script = Script::Handle(this->script()); 6460 const Script& script = Script::Handle(this->script());
6466 if (!script.IsNull()) { 6461 if (!script.IsNull()) {
6467 jsobj.AddProperty("script", script); 6462 jsobj.AddProperty("script", script);
6468 jsobj.AddProperty("tokenPos", token_pos()); 6463 jsobj.AddProperty("tokenPos", token_pos());
6469 jsobj.AddProperty("endTokenPos", end_token_pos()); 6464 jsobj.AddProperty("endTokenPos", end_token_pos());
6470 } 6465 }
6471 if (log() != NULL) {
6472 JSONObject l(&jsobj, "log");
6473 log()->PrintToJSONObject(&l);
6474 }
6475 } 6466 }
6476 6467
6477 6468
6478 void ClosureData::set_context_scope(const ContextScope& value) const { 6469 void ClosureData::set_context_scope(const ContextScope& value) const {
6479 StorePointer(&raw_ptr()->context_scope_, value.raw()); 6470 StorePointer(&raw_ptr()->context_scope_, value.raw());
6480 } 6471 }
6481 6472
6482 6473
6483 void ClosureData::set_implicit_static_closure(const Instance& closure) const { 6474 void ClosureData::set_implicit_static_closure(const Instance& closure) const {
6484 ASSERT(!closure.IsNull()); 6475 ASSERT(!closure.IsNull());
(...skipping 11984 matching lines...) Expand 10 before | Expand all | Expand 10 after
18469 return tag_label.ToCString(); 18460 return tag_label.ToCString();
18470 } 18461 }
18471 18462
18472 18463
18473 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const { 18464 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const {
18474 Instance::PrintToJSONStream(stream, ref); 18465 Instance::PrintToJSONStream(stream, ref);
18475 } 18466 }
18476 18467
18477 18468
18478 } // namespace dart 18469 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698