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

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

Issue 25050004: Add a is_recognized bit to function kind field. Improves performance of method recognizer and thus … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 // Finish the initialization by compiling the bootstrap scripts containing the 1168 // Finish the initialization by compiling the bootstrap scripts containing the
1169 // base interfaces and the implementation of the internal classes. 1169 // base interfaces and the implementation of the internal classes.
1170 const Error& error = Error::Handle(Bootstrap::LoadandCompileScripts()); 1170 const Error& error = Error::Handle(Bootstrap::LoadandCompileScripts());
1171 if (!error.IsNull()) { 1171 if (!error.IsNull()) {
1172 return error.raw(); 1172 return error.raw();
1173 } 1173 }
1174 1174
1175 ClassFinalizer::VerifyBootstrapClasses(); 1175 ClassFinalizer::VerifyBootstrapClasses();
1176 MarkInvisibleFunctions(); 1176 MarkInvisibleFunctions();
1177 1177
1178 // Set up the intrinsic state of all functions (core, math and scalar list). 1178 // Set up the intrinsic state of all functions (core, math and typed data).
1179 Intrinsifier::InitializeState(); 1179 Intrinsifier::InitializeState();
1180 1180
1181 // Set up recognized state of all functions (core, math and typed data).
1182 MethodRecognizer::InitializeState();
1183
1181 return Error::null(); 1184 return Error::null();
1182 } 1185 }
1183 1186
1184 1187
1185 void Object::InitFromSnapshot(Isolate* isolate) { 1188 void Object::InitFromSnapshot(Isolate* isolate) {
1186 TIMERSCOPE(time_bootstrap); 1189 TIMERSCOPE(time_bootstrap);
1187 ObjectStore* object_store = isolate->object_store(); 1190 ObjectStore* object_store = isolate->object_store();
1188 1191
1189 Class& cls = Class::Handle(); 1192 Class& cls = Class::Handle();
1190 1193
(...skipping 2937 matching lines...) Expand 10 before | Expand all | Expand 10 after
4128 void Function::set_kind(RawFunction::Kind value) const { 4131 void Function::set_kind(RawFunction::Kind value) const {
4129 set_kind_tag(KindBits::update(value, raw_ptr()->kind_tag_)); 4132 set_kind_tag(KindBits::update(value, raw_ptr()->kind_tag_));
4130 } 4133 }
4131 4134
4132 4135
4133 void Function::set_is_intrinsic(bool value) const { 4136 void Function::set_is_intrinsic(bool value) const {
4134 set_kind_tag(IntrinsicBit::update(value, raw_ptr()->kind_tag_)); 4137 set_kind_tag(IntrinsicBit::update(value, raw_ptr()->kind_tag_));
4135 } 4138 }
4136 4139
4137 4140
4141 void Function::set_is_recognized(bool value) const {
4142 set_kind_tag(RecognizedBit::update(value, raw_ptr()->kind_tag_));
4143 }
4144
4145
4138 void Function::set_is_static(bool value) const { 4146 void Function::set_is_static(bool value) const {
4139 set_kind_tag(StaticBit::update(value, raw_ptr()->kind_tag_)); 4147 set_kind_tag(StaticBit::update(value, raw_ptr()->kind_tag_));
4140 } 4148 }
4141 4149
4142 4150
4143 void Function::set_is_const(bool value) const { 4151 void Function::set_is_const(bool value) const {
4144 set_kind_tag(ConstBit::update(value, raw_ptr()->kind_tag_)); 4152 set_kind_tag(ConstBit::update(value, raw_ptr()->kind_tag_));
4145 } 4153 }
4146 4154
4147 4155
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
4701 result.set_parameter_types(Object::empty_array()); 4709 result.set_parameter_types(Object::empty_array());
4702 result.set_parameter_names(Object::empty_array()); 4710 result.set_parameter_names(Object::empty_array());
4703 result.set_name(name); 4711 result.set_name(name);
4704 result.set_kind(kind); 4712 result.set_kind(kind);
4705 result.set_is_static(is_static); 4713 result.set_is_static(is_static);
4706 result.set_is_const(is_const); 4714 result.set_is_const(is_const);
4707 result.set_is_abstract(is_abstract); 4715 result.set_is_abstract(is_abstract);
4708 result.set_is_external(is_external); 4716 result.set_is_external(is_external);
4709 result.set_is_visible(true); // Will be computed later. 4717 result.set_is_visible(true); // Will be computed later.
4710 result.set_is_intrinsic(false); 4718 result.set_is_intrinsic(false);
4719 result.set_is_recognized(false);
4711 result.set_owner(owner); 4720 result.set_owner(owner);
4712 result.set_token_pos(token_pos); 4721 result.set_token_pos(token_pos);
4713 result.set_end_token_pos(token_pos); 4722 result.set_end_token_pos(token_pos);
4714 result.set_num_fixed_parameters(0); 4723 result.set_num_fixed_parameters(0);
4715 result.set_num_optional_parameters(0); 4724 result.set_num_optional_parameters(0);
4716 result.set_usage_counter(0); 4725 result.set_usage_counter(0);
4717 result.set_deoptimization_counter(0); 4726 result.set_deoptimization_counter(0);
4718 result.set_optimized_instruction_count(0); 4727 result.set_optimized_instruction_count(0);
4719 result.set_optimized_call_site_count(0); 4728 result.set_optimized_call_site_count(0);
4720 result.set_is_optimizable(true); 4729 result.set_is_optimizable(true);
(...skipping 3269 matching lines...) Expand 10 before | Expand all | Expand 10 after
7990 7999
7991 8000
7992 struct FpDiff { 8001 struct FpDiff {
7993 FpDiff(int32_t old_, int32_t new_): old_fp(old_), new_fp(new_) {} 8002 FpDiff(int32_t old_, int32_t new_): old_fp(old_), new_fp(new_) {}
7994 int32_t old_fp; 8003 int32_t old_fp;
7995 int32_t new_fp; 8004 int32_t new_fp;
7996 }; 8005 };
7997 8006
7998 8007
7999 8008
8000 // Return Function::null() if function does not exist in lib. 8009 // Return Function::null() if function does not exist in libs.
8001 static RawFunction* GetFunction(const GrowableArray<Library*>& libs, 8010 RawFunction* Library::GetFunction(const GrowableArray<Library*>& libs,
8002 const char* class_name, 8011 const char* class_name,
8003 const char* function_name) { 8012 const char* function_name) {
8004 Function& func = Function::Handle(); 8013 Function& func = Function::Handle();
8005 String& class_str = String::Handle(); 8014 String& class_str = String::Handle();
8006 String& func_str = String::Handle(); 8015 String& func_str = String::Handle();
8007 Class& cls = Class::Handle(); 8016 Class& cls = Class::Handle();
8008 for (intptr_t l = 0; l < libs.length(); l++) { 8017 for (intptr_t l = 0; l < libs.length(); l++) {
8009 const Library& lib = *libs[l]; 8018 const Library& lib = *libs[l];
8010 if (strcmp(class_name, "::") == 0) { 8019 if (strcmp(class_name, "::") == 0) {
8011 func_str = Symbols::New(function_name); 8020 func_str = Symbols::New(function_name);
8012 func = lib.LookupFunctionAllowPrivate(func_str); 8021 func = lib.LookupFunctionAllowPrivate(func_str);
8013 } else { 8022 } else {
(...skipping 7157 matching lines...) Expand 10 before | Expand all | Expand 10 after
15171 return "_MirrorReference"; 15180 return "_MirrorReference";
15172 } 15181 }
15173 15182
15174 15183
15175 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15184 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15176 JSONObject jsobj(stream); 15185 JSONObject jsobj(stream);
15177 } 15186 }
15178 15187
15179 15188
15180 } // namespace dart 15189 } // 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