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

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

Issue 14362008: Implement catch on ARM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 77 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
78 Register result = locs()->in(0).reg(); 78 Register result = locs()->in(0).reg();
79 ASSERT(result == R0); 79 ASSERT(result == R0);
80 #if defined(DEBUG) 80 #if defined(DEBUG)
81 // TODO(srdjan): Fix for functions with finally clause. 81 // TODO(srdjan): Fix for functions with finally clause.
82 // A finally clause may leave a previously pushed return value if it 82 // A finally clause may leave a previously pushed return value if it
83 // has its own return instruction. Method that have finally are currently 83 // has its own return instruction. Method that have finally are currently
84 // not optimized. 84 // not optimized.
85 if (!compiler->HasFinally()) { 85 if (!compiler->HasFinally()) {
86 __ Comment("Stack Check"); 86 __ Comment("Stack Check");
87 const int sp_fp_dist = compiler->StackSize() + (-kFirstLocalSlotIndex - 1); 87 const intptr_t fp_sp_dist =
88 __ sub(R2, FP, ShifterOperand(SP)); 88 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize;
89 __ CompareImmediate(R2, sp_fp_dist * kWordSize); 89 ASSERT(fp_sp_dist <= 0);
90 __ sub(R2, SP, ShifterOperand(FP));
91 __ CompareImmediate(R2, fp_sp_dist);
90 __ bkpt(0, NE); 92 __ bkpt(0, NE);
91 } 93 }
92 #endif 94 #endif
93 __ LeaveDartFrame(); 95 __ LeaveDartFrame();
94 __ Ret(); 96 __ Ret();
95 97
96 // Generate 2 NOP instructions so that the debugger can patch the return 98 // Generate 2 NOP instructions so that the debugger can patch the return
97 // pattern (1 instruction) with a call to the debug stub (3 instructions). 99 // pattern (1 instruction) with a call to the debug stub (3 instructions).
98 __ nop(); 100 __ nop();
99 __ nop(); 101 __ nop();
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 return NULL; 1486 return NULL;
1485 } 1487 }
1486 1488
1487 1489
1488 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1490 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1489 UNIMPLEMENTED(); 1491 UNIMPLEMENTED();
1490 } 1492 }
1491 1493
1492 1494
1493 LocationSummary* CatchEntryInstr::MakeLocationSummary() const { 1495 LocationSummary* CatchEntryInstr::MakeLocationSummary() const {
1494 UNIMPLEMENTED(); 1496 return LocationSummary::Make(0,
1495 return NULL; 1497 Location::NoLocation(),
1498 LocationSummary::kNoCall);
1496 } 1499 }
1497 1500
1498 1501
1502 // Restore stack and initialize the two exception variables:
1503 // exception and stack trace variables.
1499 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1504 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1500 UNIMPLEMENTED(); 1505 // Restore SP from FP as we are coming from a throw and the code for
1506 // popping arguments has not been run.
1507 const intptr_t fp_sp_dist =
1508 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize;
1509 ASSERT(fp_sp_dist <= 0);
1510 __ AddImmediate(SP, FP, fp_sp_dist);
1511
1512 ASSERT(!exception_var().is_captured());
1513 ASSERT(!stacktrace_var().is_captured());
1514 __ StoreToOffset(kStoreWord, kExceptionObjectReg,
1515 FP, exception_var().index() * kWordSize);
1516 __ StoreToOffset(kStoreWord, kStackTraceObjectReg,
1517 FP, stacktrace_var().index() * kWordSize);
1518
1519 // Restore the pool pointer.
1520 __ LoadPoolPointer();
1501 } 1521 }
1502 1522
1503 1523
1504 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary() const { 1524 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary() const {
1505 const intptr_t kNumInputs = 0; 1525 const intptr_t kNumInputs = 0;
1506 const intptr_t kNumTemps = 0; 1526 const intptr_t kNumTemps = 0;
1507 LocationSummary* summary = 1527 LocationSummary* summary =
1508 new LocationSummary(kNumInputs, 1528 new LocationSummary(kNumInputs,
1509 kNumTemps, 1529 kNumTemps,
1510 LocationSummary::kCallOnSlowPath); 1530 LocationSummary::kCallOnSlowPath);
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2064 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2045 UNIMPLEMENTED(); 2065 UNIMPLEMENTED();
2046 } 2066 }
2047 2067
2048 2068
2049 LocationSummary* ThrowInstr::MakeLocationSummary() const { 2069 LocationSummary* ThrowInstr::MakeLocationSummary() const {
2050 return new LocationSummary(0, 0, LocationSummary::kCall); 2070 return new LocationSummary(0, 0, LocationSummary::kCall);
2051 } 2071 }
2052 2072
2053 2073
2054
2055 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2074 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2056 compiler->GenerateCallRuntime(token_pos(), 2075 compiler->GenerateCallRuntime(token_pos(),
2057 deopt_id(), 2076 deopt_id(),
2058 kThrowRuntimeEntry, 2077 kThrowRuntimeEntry,
2059 locs()); 2078 locs());
2060 __ bkpt(0); 2079 __ bkpt(0);
2061 } 2080 }
2062 2081
2063 2082
2064 LocationSummary* ReThrowInstr::MakeLocationSummary() const { 2083 LocationSummary* ReThrowInstr::MakeLocationSummary() const {
2065 UNIMPLEMENTED(); 2084 return new LocationSummary(0, 0, LocationSummary::kCall);
2066 return NULL;
2067 } 2085 }
2068 2086
2069 2087
2070 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2088 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2071 UNIMPLEMENTED(); 2089 compiler->GenerateCallRuntime(token_pos(),
2090 deopt_id(),
2091 kReThrowRuntimeEntry,
2092 locs());
2093 __ bkpt(0);
2072 } 2094 }
2073 2095
2074 2096
2075 LocationSummary* GotoInstr::MakeLocationSummary() const { 2097 LocationSummary* GotoInstr::MakeLocationSummary() const {
2076 return new LocationSummary(0, 0, LocationSummary::kNoCall); 2098 return new LocationSummary(0, 0, LocationSummary::kNoCall);
2077 } 2099 }
2078 2100
2079 2101
2080 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2102 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2081 // Add deoptimization descriptor for deoptimizing instructions 2103 // Add deoptimization descriptor for deoptimizing instructions
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 &label, 2338 &label,
2317 PcDescriptors::kOther, 2339 PcDescriptors::kOther,
2318 locs()); 2340 locs());
2319 __ Drop(2); // Discard type arguments and receiver. 2341 __ Drop(2); // Discard type arguments and receiver.
2320 } 2342 }
2321 2343
2322 } // namespace dart 2344 } // namespace dart
2323 2345
2324 #endif // defined TARGET_ARCH_ARM 2346 #endif // defined TARGET_ARCH_ARM
2325 2347
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698