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

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

Issue 1162033005: Fix http://dartbug.com/23578: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update to ToT. Created 5 years, 6 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
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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 ASSERT(CodePatcher::CodeIsPatchable(code)); 783 ASSERT(CodePatcher::CodeIsPatchable(code));
784 } 784 }
785 if (parsed_function->HasDeferredPrefixes()) { 785 if (parsed_function->HasDeferredPrefixes()) {
786 ZoneGrowableArray<const LibraryPrefix*>* prefixes = 786 ZoneGrowableArray<const LibraryPrefix*>* prefixes =
787 parsed_function->deferred_prefixes(); 787 parsed_function->deferred_prefixes();
788 for (intptr_t i = 0; i < prefixes->length(); i++) { 788 for (intptr_t i = 0; i < prefixes->length(); i++) {
789 (*prefixes)[i]->RegisterDependentCode(code); 789 (*prefixes)[i]->RegisterDependentCode(code);
790 } 790 }
791 } 791 }
792 } 792 }
793 // Mark that this isolate now has compiled code.
794 isolate->set_has_compiled(true);
795 // Exit the loop and the function with the correct result value.
793 is_compiled = true; 796 is_compiled = true;
794 done = true; 797 done = true;
795 } else { 798 } else {
796 // We bailed out or we encountered an error. 799 // We bailed out or we encountered an error.
797 const Error& error = Error::Handle( 800 const Error& error = Error::Handle(
798 isolate->object_store()->sticky_error()); 801 isolate->object_store()->sticky_error());
799 802
800 if (error.raw() == Object::branch_offset_error().raw()) { 803 if (error.raw() == Object::branch_offset_error().raw()) {
801 // Compilation failed due to an out of range branch offset in the 804 // Compilation failed due to an out of range branch offset in the
802 // assembler. We try again (done = false) with far branches enabled. 805 // assembler. We try again (done = false) with far branches enabled.
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 for (int i = 0; i < functions.Length(); i++) { 1187 for (int i = 0; i < functions.Length(); i++) {
1185 func ^= functions.At(i); 1188 func ^= functions.At(i);
1186 ASSERT(!func.IsNull()); 1189 ASSERT(!func.IsNull());
1187 if (!func.HasCode() && 1190 if (!func.HasCode() &&
1188 !func.is_abstract() && 1191 !func.is_abstract() &&
1189 !func.IsRedirectingFactory()) { 1192 !func.IsRedirectingFactory()) {
1190 error = CompileFunction(thread, func); 1193 error = CompileFunction(thread, func);
1191 if (!error.IsNull()) { 1194 if (!error.IsNull()) {
1192 return error.raw(); 1195 return error.raw();
1193 } 1196 }
1197 func.ClearICDataArray();
1194 func.ClearCode(); 1198 func.ClearCode();
1195 } 1199 }
1196 } 1200 }
1197 // Inner functions get added to the closures array. As part of compilation 1201 // Inner functions get added to the closures array. As part of compilation
1198 // more closures can be added to the end of the array. Compile all the 1202 // more closures can be added to the end of the array. Compile all the
1199 // closures until we have reached the end of the "worklist". 1203 // closures until we have reached the end of the "worklist".
1200 GrowableObjectArray& closures = 1204 GrowableObjectArray& closures =
1201 GrowableObjectArray::Handle(zone, cls.closures()); 1205 GrowableObjectArray::Handle(zone, cls.closures());
1202 if (!closures.IsNull()) { 1206 if (!closures.IsNull()) {
1203 for (int i = 0; i < closures.Length(); i++) { 1207 for (int i = 0; i < closures.Length(); i++) {
1204 func ^= closures.At(i); 1208 func ^= closures.At(i);
1205 if (!func.HasCode()) { 1209 if (!func.HasCode()) {
1206 error = CompileFunction(thread, func); 1210 error = CompileFunction(thread, func);
1207 if (!error.IsNull()) { 1211 if (!error.IsNull()) {
1208 return error.raw(); 1212 return error.raw();
1209 } 1213 }
1214 func.ClearICDataArray();
1210 func.ClearCode(); 1215 func.ClearCode();
1211 } 1216 }
1212 } 1217 }
1213 } 1218 }
1214 return error.raw(); 1219 return error.raw();
1215 } 1220 }
1216 1221
1217 1222
1218 static void CreateLocalVarDescriptors(const ParsedFunction& parsed_function) { 1223 static void CreateLocalVarDescriptors(const ParsedFunction& parsed_function) {
1219 const Function& func = parsed_function.function(); 1224 const Function& func = parsed_function.function();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 const Object& result = 1329 const Object& result =
1325 PassiveObject::Handle(isolate->object_store()->sticky_error()); 1330 PassiveObject::Handle(isolate->object_store()->sticky_error());
1326 isolate->object_store()->clear_sticky_error(); 1331 isolate->object_store()->clear_sticky_error();
1327 return result.raw(); 1332 return result.raw();
1328 } 1333 }
1329 UNREACHABLE(); 1334 UNREACHABLE();
1330 return Object::null(); 1335 return Object::null();
1331 } 1336 }
1332 1337
1333 } // namespace dart 1338 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698