| OLD | NEW |
| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 __ movq(Address(RBP, exception_var().index() * kWordSize), | 1430 __ movq(Address(RBP, exception_var().index() * kWordSize), |
| 1431 kExceptionObjectReg); | 1431 kExceptionObjectReg); |
| 1432 __ movq(Address(RBP, stacktrace_var().index() * kWordSize), | 1432 __ movq(Address(RBP, stacktrace_var().index() * kWordSize), |
| 1433 kStackTraceObjectReg); | 1433 kStackTraceObjectReg); |
| 1434 } | 1434 } |
| 1435 | 1435 |
| 1436 | 1436 |
| 1437 LocationSummary* CheckStackOverflowComp::MakeLocationSummary() const { | 1437 LocationSummary* CheckStackOverflowComp::MakeLocationSummary() const { |
| 1438 const intptr_t kNumInputs = 0; | 1438 const intptr_t kNumInputs = 0; |
| 1439 const intptr_t kNumTemps = 1; | 1439 const intptr_t kNumTemps = 1; |
| 1440 // TODO(vegorov): spilling is required only on an infrequently executed path. | |
| 1441 LocationSummary* summary = | 1440 LocationSummary* summary = |
| 1442 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 1441 new LocationSummary(kNumInputs, |
| 1443 // All registers are blocked for a call. Instructions marked at calls can use | 1442 kNumTemps, |
| 1444 // only fixed register temps. | 1443 LocationSummary::kCallOnSlowPath); |
| 1445 summary->set_temp(0, Location::RegisterLocation(RAX)); | 1444 summary->set_temp(0, Location::RequiresRegister()); |
| 1446 return summary; | 1445 return summary; |
| 1447 } | 1446 } |
| 1448 | 1447 |
| 1449 | 1448 |
| 1449 class CheckStackOverflowSlowPath : public SlowPathCode { |
| 1450 public: |
| 1451 explicit CheckStackOverflowSlowPath(CheckStackOverflowComp* computation) |
| 1452 : computation_(computation) { } |
| 1453 |
| 1454 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1455 __ Bind(entry_label()); |
| 1456 compiler->SaveLiveRegisters(computation_->locs()); |
| 1457 compiler->GenerateCallRuntime(computation_->deopt_id(), |
| 1458 computation_->token_pos(), |
| 1459 computation_->try_index(), |
| 1460 kStackOverflowRuntimeEntry, |
| 1461 computation_->locs()->stack_bitmap()); |
| 1462 compiler->RestoreLiveRegisters(computation_->locs()); |
| 1463 __ jmp(exit_label()); |
| 1464 } |
| 1465 |
| 1466 private: |
| 1467 CheckStackOverflowComp* computation_; |
| 1468 }; |
| 1469 |
| 1470 |
| 1450 void CheckStackOverflowComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1471 void CheckStackOverflowComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1472 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); |
| 1473 compiler->AddSlowPathCode(slow_path); |
| 1474 |
| 1451 Register temp = locs()->temp(0).reg(); | 1475 Register temp = locs()->temp(0).reg(); |
| 1452 // Generate stack overflow check. | 1476 // Generate stack overflow check. |
| 1453 __ movq(temp, Immediate(Isolate::Current()->stack_limit_address())); | 1477 __ movq(temp, Immediate(Isolate::Current()->stack_limit_address())); |
| 1454 __ cmpq(RSP, Address(temp, 0)); | 1478 __ cmpq(RSP, Address(temp, 0)); |
| 1455 Label no_stack_overflow; | 1479 __ j(BELOW_EQUAL, slow_path->entry_label()); |
| 1456 __ j(ABOVE, &no_stack_overflow, Assembler::kNearJump); | 1480 __ Bind(slow_path->exit_label()); |
| 1457 compiler->GenerateCallRuntime(deopt_id(), | |
| 1458 token_pos(), | |
| 1459 try_index(), | |
| 1460 kStackOverflowRuntimeEntry, | |
| 1461 locs()->stack_bitmap()); | |
| 1462 __ Bind(&no_stack_overflow); | |
| 1463 } | 1481 } |
| 1464 | 1482 |
| 1465 | 1483 |
| 1466 LocationSummary* BinaryOpComp::MakeLocationSummary() const { | 1484 LocationSummary* BinaryOpComp::MakeLocationSummary() const { |
| 1467 const intptr_t kNumInputs = 2; | 1485 const intptr_t kNumInputs = 2; |
| 1468 | 1486 |
| 1469 // Double operation are handled in DoubleBinaryOpComp. | 1487 // Double operation are handled in DoubleBinaryOpComp. |
| 1470 ASSERT(operands_type() != kDoubleOperands); | 1488 ASSERT(operands_type() != kDoubleOperands); |
| 1471 | 1489 |
| 1472 if (operands_type() == kMintOperands) { | 1490 if (operands_type() == kMintOperands) { |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2210 locs()->stack_bitmap()); | 2228 locs()->stack_bitmap()); |
| 2211 __ CompareObject(RAX, compiler->bool_true()); | 2229 __ CompareObject(RAX, compiler->bool_true()); |
| 2212 EmitBranchOnCondition(compiler, branch_condition); | 2230 EmitBranchOnCondition(compiler, branch_condition); |
| 2213 } | 2231 } |
| 2214 | 2232 |
| 2215 } // namespace dart | 2233 } // namespace dart |
| 2216 | 2234 |
| 2217 #undef __ | 2235 #undef __ |
| 2218 | 2236 |
| 2219 #endif // defined TARGET_ARCH_X64 | 2237 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |