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

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

Issue 25954003: - Harden coverage generation, by not attempting to compile (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 | « no previous file | runtime/vm/coverage.cc » ('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/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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 RawError* Compiler::CompileAllFunctions(const Class& cls) { 850 RawError* Compiler::CompileAllFunctions(const Class& cls) {
851 Error& error = Error::Handle(); 851 Error& error = Error::Handle();
852 Array& functions = Array::Handle(cls.functions()); 852 Array& functions = Array::Handle(cls.functions());
853 Function& func = Function::Handle(); 853 Function& func = Function::Handle();
854 // Class dynamic lives in the vm isolate. Its array fields cannot be set to 854 // Class dynamic lives in the vm isolate. Its array fields cannot be set to
855 // an empty array. 855 // an empty array.
856 if (functions.IsNull()) { 856 if (functions.IsNull()) {
857 ASSERT(cls.IsDynamicClass()); 857 ASSERT(cls.IsDynamicClass());
858 return error.raw(); 858 return error.raw();
859 } 859 }
860 // Compile all the regular functions.
860 for (int i = 0; i < functions.Length(); i++) { 861 for (int i = 0; i < functions.Length(); i++) {
861 func ^= functions.At(i); 862 func ^= functions.At(i);
862 ASSERT(!func.IsNull()); 863 ASSERT(!func.IsNull());
863 if (!func.HasCode() && 864 if (!func.HasCode() &&
864 !func.is_abstract() && 865 !func.is_abstract() &&
865 !func.IsRedirectingFactory()) { 866 !func.IsRedirectingFactory()) {
866 error = CompileFunction(func); 867 error = CompileFunction(func);
867 if (!error.IsNull()) { 868 if (!error.IsNull()) {
868 return error.raw(); 869 return error.raw();
869 } 870 }
870 } 871 }
871 } 872 }
873 // Inner functions get added to the closures array. As part of compilation
874 // more closures can be added to the end of the array. Compile all the
875 // closures until we have reached the end of the "worklist".
876 GrowableObjectArray& closures =
877 GrowableObjectArray::Handle(cls.closures());
878 if (!closures.IsNull()) {
879 for (int i = 0; i < closures.Length(); i++) {
880 func ^= closures.At(i);
881 if (!func.HasCode()) {
882 error = CompileFunction(func);
883 if (!error.IsNull()) {
884 return error.raw();
885 }
886 }
887 }
888 }
872 return error.raw(); 889 return error.raw();
873 } 890 }
874 891
875 892
876 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { 893 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
877 Isolate* isolate = Isolate::Current(); 894 Isolate* isolate = Isolate::Current();
878 LongJump* base = isolate->long_jump_base(); 895 LongJump* base = isolate->long_jump_base();
879 LongJump jump; 896 LongJump jump;
880 isolate->set_long_jump_base(&jump); 897 isolate->set_long_jump_base(&jump);
881 if (setjmp(*jump.Set()) == 0) { 898 if (setjmp(*jump.Set()) == 0) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 Object::Handle(isolate->object_store()->sticky_error()); 943 Object::Handle(isolate->object_store()->sticky_error());
927 isolate->object_store()->clear_sticky_error(); 944 isolate->object_store()->clear_sticky_error();
928 isolate->set_long_jump_base(base); 945 isolate->set_long_jump_base(base);
929 return result.raw(); 946 return result.raw();
930 } 947 }
931 UNREACHABLE(); 948 UNREACHABLE();
932 return Object::null(); 949 return Object::null();
933 } 950 }
934 951
935 } // namespace dart 952 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/coverage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698