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

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

Issue 1128803002: Lazily generate local var descriptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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
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/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 for (intptr_t i = 0; i < stackmap_table.Length(); ++i) { 883 for (intptr_t i = 0; i < stackmap_table.Length(); ++i) {
884 map ^= stackmap_table.At(i); 884 map ^= stackmap_table.At(i);
885 ISL_Print("%s\n", map.ToCString()); 885 ISL_Print("%s\n", map.ToCString());
886 } 886 }
887 } 887 }
888 ISL_Print("}\n"); 888 ISL_Print("}\n");
889 889
890 ISL_Print("Variable Descriptors for function '%s' {\n", 890 ISL_Print("Variable Descriptors for function '%s' {\n",
891 function_fullname); 891 function_fullname);
892 const LocalVarDescriptors& var_descriptors = 892 const LocalVarDescriptors& var_descriptors =
893 LocalVarDescriptors::Handle(code.var_descriptors()); 893 LocalVarDescriptors::Handle(code.GetLocalVarDescriptors());
894 intptr_t var_desc_length = 894 intptr_t var_desc_length =
895 var_descriptors.IsNull() ? 0 : var_descriptors.Length(); 895 var_descriptors.IsNull() ? 0 : var_descriptors.Length();
896 String& var_name = String::Handle(); 896 String& var_name = String::Handle();
897 for (intptr_t i = 0; i < var_desc_length; i++) { 897 for (intptr_t i = 0; i < var_desc_length; i++) {
898 var_name = var_descriptors.GetName(i); 898 var_name = var_descriptors.GetName(i);
899 RawLocalVarDescriptors::VarInfo var_info; 899 RawLocalVarDescriptors::VarInfo var_info;
900 var_descriptors.GetInfo(i, &var_info); 900 var_descriptors.GetInfo(i, &var_info);
901 const int8_t kind = var_info.kind(); 901 const int8_t kind = var_info.kind();
902 if (kind == RawLocalVarDescriptors::kSavedCurrentContext) { 902 if (kind == RawLocalVarDescriptors::kSavedCurrentContext) {
903 ISL_Print(" saved current CTX reg offset %d\n", var_info.index()); 903 ISL_Print(" saved current CTX reg offset %d\n", var_info.index());
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 // We got an error during compilation. 1122 // We got an error during compilation.
1123 error = isolate->object_store()->sticky_error(); 1123 error = isolate->object_store()->sticky_error();
1124 isolate->object_store()->clear_sticky_error(); 1124 isolate->object_store()->clear_sticky_error();
1125 return error.raw(); 1125 return error.raw();
1126 } 1126 }
1127 UNREACHABLE(); 1127 UNREACHABLE();
1128 return Error::null(); 1128 return Error::null();
1129 } 1129 }
1130 1130
1131 1131
1132 void Compiler::ComputeLocalVarDescriptors(const Code& code) {
hausner 2015/05/06 16:39:54 This code is now duplicated (also present in the F
srdjan 2015/05/06 20:00:47 Removed it from here; FlowGraphCompiler::FinalizeV
1133 ASSERT(!code.is_optimized());
1134 const Function& function = Function::Handle(code.function());
1135 ParsedFunction* parsed_function = new ParsedFunction(
1136 Thread::Current(), Function::ZoneHandle(function.raw()));
1137 LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle();
1138 if (function.IsIrregexpFunction()) {
1139 UNREACHABLE(); // Special parsing needed, not yet implemented.
1140 var_descs = LocalVarDescriptors::New(1);
hausner 2015/05/06 16:39:54 Should the code after UNREACHABLE() remain?
srdjan 2015/05/06 20:00:47 Removed, will add it back once functionality imple
1141 RawLocalVarDescriptors::VarInfo info;
1142 info.set_kind(RawLocalVarDescriptors::kSavedCurrentContext);
1143 info.scope_id = 0;
1144 info.begin_pos = 0;
1145 info.end_pos = 0;
1146 info.set_index(parsed_function->current_context_var()->index());
1147 var_descs.SetVar(0, Symbols::CurrentContextVar(), &info);
1148 } else {
1149 Parser::ParseFunction(parsed_function);
1150 parsed_function->AllocateVariables();
1151 var_descs =
1152 parsed_function->node_sequence()->scope()->GetVarDescriptors(
1153 parsed_function->function());
hausner 2015/05/06 16:39:54 Could you not use function here instead of parsed_
srdjan 2015/05/06 20:00:47 Done.
1154 }
1155 code.set_var_descriptors(var_descs);
1156 }
1157
1158
1132 RawError* Compiler::CompileAllFunctions(const Class& cls) { 1159 RawError* Compiler::CompileAllFunctions(const Class& cls) {
1133 Thread* thread = Thread::Current(); 1160 Thread* thread = Thread::Current();
1134 Zone* zone = thread->zone(); 1161 Zone* zone = thread->zone();
1135 Error& error = Error::Handle(zone); 1162 Error& error = Error::Handle(zone);
1136 Array& functions = Array::Handle(zone, cls.functions()); 1163 Array& functions = Array::Handle(zone, cls.functions());
1137 Function& func = Function::Handle(zone); 1164 Function& func = Function::Handle(zone);
1138 // Class dynamic lives in the vm isolate. Its array fields cannot be set to 1165 // Class dynamic lives in the vm isolate. Its array fields cannot be set to
1139 // an empty array. 1166 // an empty array.
1140 if (functions.IsNull()) { 1167 if (functions.IsNull()) {
1141 ASSERT(cls.IsDynamicClass()); 1168 ASSERT(cls.IsDynamicClass());
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 const Object& result = 1300 const Object& result =
1274 PassiveObject::Handle(isolate->object_store()->sticky_error()); 1301 PassiveObject::Handle(isolate->object_store()->sticky_error());
1275 isolate->object_store()->clear_sticky_error(); 1302 isolate->object_store()->clear_sticky_error();
1276 return result.raw(); 1303 return result.raw();
1277 } 1304 }
1278 UNREACHABLE(); 1305 UNREACHABLE();
1279 return Object::null(); 1306 return Object::null();
1280 } 1307 }
1281 1308
1282 } // namespace dart 1309 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.h ('k') | runtime/vm/debugger.cc » ('j') | runtime/vm/flow_graph_compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698