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

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); 25 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic.");
26 DECLARE_FLAG(int, optimization_counter_threshold); 26 DECLARE_FLAG(int, optimization_counter_threshold);
27 DECLARE_FLAG(int, reoptimization_counter_threshold); 27 DECLARE_FLAG(int, reoptimization_counter_threshold);
28 DECLARE_FLAG(bool, print_ast);
29 DECLARE_FLAG(bool, print_scopes);
30 DECLARE_FLAG(bool, enable_type_checks); 28 DECLARE_FLAG(bool, enable_type_checks);
31 DECLARE_FLAG(bool, eliminate_type_checks); 29 DECLARE_FLAG(bool, eliminate_type_checks);
32 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 30 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
33 31
34 32
35 FlowGraphCompiler::~FlowGraphCompiler() { 33 FlowGraphCompiler::~FlowGraphCompiler() {
36 // BlockInfos are zone-allocated, so their destructors are not called. 34 // BlockInfos are zone-allocated, so their destructors are not called.
37 // Verify the labels explicitly here. 35 // Verify the labels explicitly here.
38 for (int i = 0; i < block_info_.length(); ++i) { 36 for (int i = 0; i < block_info_.length(); ++i) {
39 ASSERT(!block_info_[i]->jump_label()->IsLinked()); 37 ASSERT(!block_info_[i]->jump_label()->IsLinked());
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 const intptr_t slot_base = parsed_function().first_stack_local_index(); 1170 const intptr_t slot_base = parsed_function().first_stack_local_index();
1173 const Immediate& raw_null = 1171 const Immediate& raw_null =
1174 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1172 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1175 __ movl(EAX, raw_null); 1173 __ movl(EAX, raw_null);
1176 for (intptr_t i = 0; i < num_locals; ++i) { 1174 for (intptr_t i = 0; i < num_locals; ++i) {
1177 // Subtract index i (locals lie at lower addresses than EBP). 1175 // Subtract index i (locals lie at lower addresses than EBP).
1178 __ movl(Address(EBP, (slot_base - i) * kWordSize), EAX); 1176 __ movl(Address(EBP, (slot_base - i) * kWordSize), EAX);
1179 } 1177 }
1180 } 1178 }
1181 1179
1182 if (FLAG_print_scopes) {
1183 // Print the function scope (again) after generating the prologue in order
1184 // to see annotations such as allocation indices of locals.
1185 if (FLAG_print_ast) {
1186 // Second printing.
1187 OS::Print("Annotated ");
1188 }
1189 AstPrinter::PrintFunctionScope(parsed_function());
1190 }
1191
1192 ASSERT(!block_order().is_empty()); 1180 ASSERT(!block_order().is_empty());
1193 VisitBlocks(); 1181 VisitBlocks();
1194 1182
1195 __ int3(); 1183 __ int3();
1196 GenerateDeferredCode(); 1184 GenerateDeferredCode();
1197 // Emit function patching code. This will be swapped with the first 5 bytes 1185 // Emit function patching code. This will be swapped with the first 5 bytes
1198 // at entry point. 1186 // at entry point.
1199 AddCurrentDescriptor(PcDescriptors::kPatchCode, 1187 AddCurrentDescriptor(PcDescriptors::kPatchCode,
1200 Isolate::kNoDeoptId, 1188 Isolate::kNoDeoptId,
1201 0); // No token position. 1189 0); // No token position.
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 __ movups(reg, Address(ESP, 0)); 1916 __ movups(reg, Address(ESP, 0));
1929 __ addl(ESP, Immediate(kFpuRegisterSize)); 1917 __ addl(ESP, Immediate(kFpuRegisterSize));
1930 } 1918 }
1931 1919
1932 1920
1933 #undef __ 1921 #undef __
1934 1922
1935 } // namespace dart 1923 } // namespace dart
1936 1924
1937 #endif // defined TARGET_ARCH_IA32 1925 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698