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

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

Issue 10824201: Verify at method exit that stack size is the same as at entry, except for methods with finally clau… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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_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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 __ LoadObject(temp, function); 88 __ LoadObject(temp, function);
89 __ pushq(result); // Preserve result. 89 __ pushq(result); // Preserve result.
90 __ pushq(temp); 90 __ pushq(temp);
91 compiler->GenerateCallRuntime(Isolate::kNoDeoptId, 91 compiler->GenerateCallRuntime(Isolate::kNoDeoptId,
92 0, 92 0,
93 CatchClauseNode::kInvalidTryIndex, 93 CatchClauseNode::kInvalidTryIndex,
94 kTraceFunctionExitRuntimeEntry); 94 kTraceFunctionExitRuntimeEntry);
95 __ popq(temp); // Remove argument. 95 __ popq(temp); // Remove argument.
96 __ popq(result); // Restore result. 96 __ popq(result); // Restore result.
97 } 97 }
98 #if defined(DEBUG)
99 // TODO(srdjan): Fix for functions with finally clause.
100 // A finally clause may leave a previously pushed return value if it
101 // has its own return instruction. Method that have finally are currently
102 // not optimized.
103 if (!compiler->HasFinally()) {
104 Label done;
105 __ movq(RDI, RBP);
106 __ subq(RDI, RSP);
107 // + 1 for Pc marker.
108 __ cmpq(RDI, Immediate((compiler->StackSize() + 1) * kWordSize));
109 __ j(EQUAL, &done, Assembler::kNearJump);
110 __ int3();
111 __ Bind(&done);
112 }
113 #endif
98 __ LeaveFrame(); 114 __ LeaveFrame();
99 __ ret(); 115 __ ret();
100 116
101 // Generate 8 bytes of NOPs so that the debugger can patch the 117 // Generate 8 bytes of NOPs so that the debugger can patch the
102 // return pattern with a call to the debug stub. 118 // return pattern with a call to the debug stub.
103 // Note that the nop(8) byte pattern is not recognized by the debugger. 119 // Note that the nop(8) byte pattern is not recognized by the debugger.
104 __ nop(1); 120 __ nop(1);
105 __ nop(1); 121 __ nop(1);
106 __ nop(1); 122 __ nop(1);
107 __ nop(1); 123 __ nop(1);
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 ASSERT(locs()->out().reg() == RAX); 2130 ASSERT(locs()->out().reg() == RAX);
2115 __ CompareObject(locs()->out().reg(), compiler->bool_true()); 2131 __ CompareObject(locs()->out().reg(), compiler->bool_true());
2116 EmitBranchOnCondition(compiler, branch_condition); 2132 EmitBranchOnCondition(compiler, branch_condition);
2117 } 2133 }
2118 2134
2119 } // namespace dart 2135 } // namespace dart
2120 2136
2121 #undef __ 2137 #undef __
2122 2138
2123 #endif // defined TARGET_ARCH_X64 2139 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698