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

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

Issue 51123003: VM: Fix checked mode crash (issue 13831). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/globals.h" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
11 #include "vm/compiler.h" 11 #include "vm/compiler.h"
12 #include "vm/dart_entry.h" 12 #include "vm/dart_entry.h"
13 #include "vm/deopt_instructions.h" 13 #include "vm/deopt_instructions.h"
14 #include "vm/il_printer.h" 14 #include "vm/il_printer.h"
15 #include "vm/locations.h" 15 #include "vm/locations.h"
16 #include "vm/object_store.h" 16 #include "vm/object_store.h"
17 #include "vm/parser.h" 17 #include "vm/parser.h"
18 #include "vm/stack_frame.h" 18 #include "vm/stack_frame.h"
19 #include "vm/stub_code.h" 19 #include "vm/stub_code.h"
20 #include "vm/symbols.h" 20 #include "vm/symbols.h"
21 21
22 namespace dart { 22 namespace dart {
23 23
24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); 24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization.");
25 DECLARE_FLAG(int, optimization_counter_threshold); 25 DECLARE_FLAG(int, optimization_counter_threshold);
26 DECLARE_FLAG(int, reoptimization_counter_threshold); 26 DECLARE_FLAG(int, reoptimization_counter_threshold);
27 DECLARE_FLAG(bool, print_ast);
28 DECLARE_FLAG(bool, print_scopes);
29 DECLARE_FLAG(bool, enable_type_checks); 27 DECLARE_FLAG(bool, enable_type_checks);
30 DECLARE_FLAG(bool, eliminate_type_checks); 28 DECLARE_FLAG(bool, eliminate_type_checks);
31 29
32 30
33 FlowGraphCompiler::~FlowGraphCompiler() { 31 FlowGraphCompiler::~FlowGraphCompiler() {
34 // BlockInfos are zone-allocated, so their destructors are not called. 32 // BlockInfos are zone-allocated, so their destructors are not called.
35 // Verify the labels explicitly here. 33 // Verify the labels explicitly here.
36 for (int i = 0; i < block_info_.length(); ++i) { 34 for (int i = 0; i < block_info_.length(); ++i) {
37 ASSERT(!block_info_[i]->jump_label()->IsLinked()); 35 ASSERT(!block_info_[i]->jump_label()->IsLinked());
38 } 36 }
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 if (!is_optimizing() && (num_locals > 0)) { 1162 if (!is_optimizing() && (num_locals > 0)) {
1165 __ Comment("Initialize spill slots"); 1163 __ Comment("Initialize spill slots");
1166 const intptr_t slot_base = parsed_function().first_stack_local_index(); 1164 const intptr_t slot_base = parsed_function().first_stack_local_index();
1167 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); 1165 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null()));
1168 for (intptr_t i = 0; i < num_locals; ++i) { 1166 for (intptr_t i = 0; i < num_locals; ++i) {
1169 // Subtract index i (locals lie at lower addresses than FP). 1167 // Subtract index i (locals lie at lower addresses than FP).
1170 __ str(R0, Address(FP, (slot_base - i) * kWordSize)); 1168 __ str(R0, Address(FP, (slot_base - i) * kWordSize));
1171 } 1169 }
1172 } 1170 }
1173 1171
1174 if (FLAG_print_scopes) {
1175 // Print the function scope (again) after generating the prologue in order
1176 // to see annotations such as allocation indices of locals.
1177 if (FLAG_print_ast) {
1178 // Second printing.
1179 OS::Print("Annotated ");
1180 }
1181 AstPrinter::PrintFunctionScope(parsed_function());
1182 }
1183
1184 VisitBlocks(); 1172 VisitBlocks();
1185 1173
1186 __ bkpt(0); 1174 __ bkpt(0);
1187 GenerateDeferredCode(); 1175 GenerateDeferredCode();
1188 // Emit function patching code. This will be swapped with the first 3 1176 // Emit function patching code. This will be swapped with the first 3
1189 // instructions at entry point. 1177 // instructions at entry point.
1190 AddCurrentDescriptor(PcDescriptors::kPatchCode, 1178 AddCurrentDescriptor(PcDescriptors::kPatchCode,
1191 Isolate::kNoDeoptId, 1179 Isolate::kNoDeoptId,
1192 0); // No token position. 1180 0); // No token position.
1193 __ BranchPatchable(&StubCode::FixCallersTargetLabel()); 1181 __ BranchPatchable(&StubCode::FixCallersTargetLabel());
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 DRegister dreg = EvenDRegisterOf(reg); 1912 DRegister dreg = EvenDRegisterOf(reg);
1925 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1913 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1926 } 1914 }
1927 1915
1928 1916
1929 #undef __ 1917 #undef __
1930 1918
1931 } // namespace dart 1919 } // namespace dart
1932 1920
1933 #endif // defined TARGET_ARCH_ARM 1921 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698