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

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

Issue 335443002: Setup R10/EDX to be valid Oops before stub calls (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | 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"
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 const ICData& ic_data) { 1176 const ICData& ic_data) {
1177 uword label_address = 0; 1177 uword label_address = 0;
1178 if (ic_data.NumArgsTested() == 0) { 1178 if (ic_data.NumArgsTested() == 0) {
1179 label_address = StubCode::ZeroArgsUnoptimizedStaticCallEntryPoint(); 1179 label_address = StubCode::ZeroArgsUnoptimizedStaticCallEntryPoint();
1180 } else if (ic_data.NumArgsTested() == 2) { 1180 } else if (ic_data.NumArgsTested() == 2) {
1181 label_address = StubCode::TwoArgsUnoptimizedStaticCallEntryPoint(); 1181 label_address = StubCode::TwoArgsUnoptimizedStaticCallEntryPoint();
1182 } else { 1182 } else {
1183 UNIMPLEMENTED(); 1183 UNIMPLEMENTED();
1184 } 1184 }
1185 ExternalLabel target_label(label_address); 1185 ExternalLabel target_label(label_address);
1186 __ movl(EDX, Immediate(0));
1186 __ LoadObject(ECX, ic_data); 1187 __ LoadObject(ECX, ic_data);
1187 GenerateDartCall(deopt_id, 1188 GenerateDartCall(deopt_id,
1188 token_pos, 1189 token_pos,
1189 &target_label, 1190 &target_label,
1190 PcDescriptors::kUnoptStaticCall, 1191 PcDescriptors::kUnoptStaticCall,
1191 locs); 1192 locs);
1192 __ Drop(argument_count); 1193 __ Drop(argument_count);
1194 #if defined(DEBUG)
1195 __ movl(EDX, Immediate(1)); // Garbage that looks like an object.
1196 #endif
1193 } 1197 }
1194 1198
1195 1199
1196 void FlowGraphCompiler::EmitEdgeCounter() { 1200 void FlowGraphCompiler::EmitEdgeCounter() {
1197 // We do not check for overflow when incrementing the edge counter. The 1201 // We do not check for overflow when incrementing the edge counter. The
1198 // function should normally be optimized long before the counter can 1202 // function should normally be optimized long before the counter can
1199 // overflow; and though we do not reset the counters when we optimize or 1203 // overflow; and though we do not reset the counters when we optimize or
1200 // deoptimize, there is a bound on the number of 1204 // deoptimize, there is a bound on the number of
1201 // optimization/deoptimization cycles we will attempt. 1205 // optimization/deoptimization cycles we will attempt.
1202 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); 1206 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
(...skipping 30 matching lines...) Expand all
1233 } 1237 }
1234 1238
1235 1239
1236 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, 1240 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label,
1237 const ICData& ic_data, 1241 const ICData& ic_data,
1238 intptr_t argument_count, 1242 intptr_t argument_count,
1239 intptr_t deopt_id, 1243 intptr_t deopt_id,
1240 intptr_t token_pos, 1244 intptr_t token_pos,
1241 LocationSummary* locs) { 1245 LocationSummary* locs) {
1242 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); 1246 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
1247 __ movl(EDX, Immediate(0));
1243 __ LoadObject(ECX, ic_data); 1248 __ LoadObject(ECX, ic_data);
1244 GenerateDartCall(deopt_id, 1249 GenerateDartCall(deopt_id,
1245 token_pos, 1250 token_pos,
1246 target_label, 1251 target_label,
1247 PcDescriptors::kIcCall, 1252 PcDescriptors::kIcCall,
1248 locs); 1253 locs);
1249 __ Drop(argument_count); 1254 __ Drop(argument_count);
1255 #if defined(DEBUG)
1256 __ movl(EDX, Immediate(1)); // Garbage that looks like an object.
1257 #endif
1250 } 1258 }
1251 1259
1252 1260
1253 void FlowGraphCompiler::EmitMegamorphicInstanceCall( 1261 void FlowGraphCompiler::EmitMegamorphicInstanceCall(
1254 const ICData& ic_data, 1262 const ICData& ic_data,
1255 intptr_t argument_count, 1263 intptr_t argument_count,
1256 intptr_t deopt_id, 1264 intptr_t deopt_id,
1257 intptr_t token_pos, 1265 intptr_t token_pos,
1258 LocationSummary* locs) { 1266 LocationSummary* locs) {
1259 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); 1267 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, 1377 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left,
1370 Register right, 1378 Register right,
1371 bool needs_number_check, 1379 bool needs_number_check,
1372 intptr_t token_pos) { 1380 intptr_t token_pos) {
1373 if (needs_number_check) { 1381 if (needs_number_check) {
1374 __ pushl(left); 1382 __ pushl(left);
1375 __ pushl(right); 1383 __ pushl(right);
1376 if (is_optimizing()) { 1384 if (is_optimizing()) {
1377 __ call(&StubCode::OptimizedIdenticalWithNumberCheckLabel()); 1385 __ call(&StubCode::OptimizedIdenticalWithNumberCheckLabel());
1378 } else { 1386 } else {
1387 __ movl(EDX, Immediate(0));
1388 __ movl(ECX, Immediate(0));
1379 __ call(&StubCode::UnoptimizedIdenticalWithNumberCheckLabel()); 1389 __ call(&StubCode::UnoptimizedIdenticalWithNumberCheckLabel());
1380 } 1390 }
1381 if (token_pos != Scanner::kNoSourcePos) { 1391 if (token_pos != Scanner::kNoSourcePos) {
1382 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, 1392 AddCurrentDescriptor(PcDescriptors::kRuntimeCall,
1383 Isolate::kNoDeoptId, 1393 Isolate::kNoDeoptId,
1384 token_pos); 1394 token_pos);
1385 } 1395 }
1396 #if defined(DEBUG)
1397 if (!is_optimizing()) {
1398 // Do this *after* adding the pc descriptor!
1399 __ movl(EDX, Immediate(1)); // Garbage that looks like an object.
1400 __ movl(ECX, Immediate(1));
1401 }
1402 #endif
1386 // Stub returns result in flags (result of a cmpl, we need ZF computed). 1403 // Stub returns result in flags (result of a cmpl, we need ZF computed).
1387 __ popl(right); 1404 __ popl(right);
1388 __ popl(left); 1405 __ popl(left);
1389 } else { 1406 } else {
1390 __ cmpl(left, right); 1407 __ cmpl(left, right);
1391 } 1408 }
1392 } 1409 }
1393 1410
1394 1411
1395 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and 1412 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 __ movups(reg, Address(ESP, 0)); 1757 __ movups(reg, Address(ESP, 0));
1741 __ addl(ESP, Immediate(kFpuRegisterSize)); 1758 __ addl(ESP, Immediate(kFpuRegisterSize));
1742 } 1759 }
1743 1760
1744 1761
1745 #undef __ 1762 #undef __
1746 1763
1747 } // namespace dart 1764 } // namespace dart
1748 1765
1749 #endif // defined TARGET_ARCH_IA32 1766 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698