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

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

Issue 10823308: Implement basic support for deferred slow path code with calls that save and restore live registers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address Kevin's comments Created 8 years, 4 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) 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/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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 __ movl(Address(EBP, exception_var().index() * kWordSize), 1422 __ movl(Address(EBP, exception_var().index() * kWordSize),
1423 kExceptionObjectReg); 1423 kExceptionObjectReg);
1424 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), 1424 __ movl(Address(EBP, stacktrace_var().index() * kWordSize),
1425 kStackTraceObjectReg); 1425 kStackTraceObjectReg);
1426 } 1426 }
1427 1427
1428 1428
1429 LocationSummary* CheckStackOverflowComp::MakeLocationSummary() const { 1429 LocationSummary* CheckStackOverflowComp::MakeLocationSummary() const {
1430 const intptr_t kNumInputs = 0; 1430 const intptr_t kNumInputs = 0;
1431 const intptr_t kNumTemps = 0; 1431 const intptr_t kNumTemps = 0;
1432 // TODO(vegorov): spilling is required only on an infrequently executed path.
1433 LocationSummary* summary = 1432 LocationSummary* summary =
1434 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 1433 new LocationSummary(kNumInputs,
1434 kNumTemps,
1435 LocationSummary::kCallOnSlowPath);
1435 return summary; 1436 return summary;
1436 } 1437 }
1437 1438
1438 1439
1440 class CheckStackOverflowSlowPath : public SlowPathCode {
1441 public:
1442 explicit CheckStackOverflowSlowPath(CheckStackOverflowComp* computation)
1443 : computation_(computation) { }
1444
1445 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1446 __ Bind(entry_label());
1447 compiler->SaveLiveRegisters(computation_->locs());
1448 compiler->GenerateCallRuntime(computation_->deopt_id(),
1449 computation_->token_pos(),
1450 computation_->try_index(),
1451 kStackOverflowRuntimeEntry,
1452 computation_->locs()->stack_bitmap());
1453 compiler->RestoreLiveRegisters(computation_->locs());
1454 __ jmp(exit_label());
1455 }
1456
1457 private:
1458 CheckStackOverflowComp* computation_;
1459 };
1460
1461
1439 void CheckStackOverflowComp::EmitNativeCode(FlowGraphCompiler* compiler) { 1462 void CheckStackOverflowComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1463 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this);
1464 compiler->AddSlowPathCode(slow_path);
1465
1440 __ cmpl(ESP, 1466 __ cmpl(ESP,
1441 Address::Absolute(Isolate::Current()->stack_limit_address())); 1467 Address::Absolute(Isolate::Current()->stack_limit_address()));
1442 Label no_stack_overflow; 1468 __ j(BELOW_EQUAL, slow_path->entry_label());
1443 __ j(ABOVE, &no_stack_overflow); 1469 __ Bind(slow_path->exit_label());
1444 compiler->GenerateCallRuntime(deopt_id(),
1445 token_pos(),
1446 try_index(),
1447 kStackOverflowRuntimeEntry,
1448 locs()->stack_bitmap());
1449 __ Bind(&no_stack_overflow);
1450 } 1470 }
1451 1471
1452 1472
1453 LocationSummary* BinaryOpComp::MakeLocationSummary() const { 1473 LocationSummary* BinaryOpComp::MakeLocationSummary() const {
1454 const intptr_t kNumInputs = 2; 1474 const intptr_t kNumInputs = 2;
1455 1475
1456 // Double operation are handled in DoubleBinaryOpComp. 1476 // Double operation are handled in DoubleBinaryOpComp.
1457 ASSERT(operands_type() != kDoubleOperands); 1477 ASSERT(operands_type() != kDoubleOperands);
1458 1478
1459 if (operands_type() == kMintOperands) { 1479 if (operands_type() == kMintOperands) {
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 locs()->stack_bitmap()); 2223 locs()->stack_bitmap());
2204 __ CompareObject(EAX, compiler->bool_true()); 2224 __ CompareObject(EAX, compiler->bool_true());
2205 EmitBranchOnCondition(compiler, branch_condition); 2225 EmitBranchOnCondition(compiler, branch_condition);
2206 } 2226 }
2207 2227
2208 } // namespace dart 2228 } // namespace dart
2209 2229
2210 #undef __ 2230 #undef __
2211 2231
2212 #endif // defined TARGET_ARCH_X64 2232 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698