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

Side by Side Diff: src/arm/fast-codegen-arm.cc

Issue 362003: Fix issue 491: constantpool dump violates ARM debugger assertion for return p... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month 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 | « src/arm/debug-arm.cc ('k') | src/debug.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "codegen-inl.h" 30 #include "codegen-inl.h"
31 #include "debug.h"
31 #include "fast-codegen.h" 32 #include "fast-codegen.h"
32 #include "parser.h" 33 #include "parser.h"
33 34
34 namespace v8 { 35 namespace v8 {
35 namespace internal { 36 namespace internal {
36 37
37 #define __ ACCESS_MASM(masm_) 38 #define __ ACCESS_MASM(masm_)
38 39
39 // Generate code for a JS function. On entry to the function the receiver 40 // Generate code for a JS function. On entry to the function the receiver
40 // and arguments have been pushed on the stack left to right. The actual 41 // and arguments have been pushed on the stack left to right. The actual
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (return_label_.is_bound()) { 112 if (return_label_.is_bound()) {
112 __ b(&return_label_); 113 __ b(&return_label_);
113 } else { 114 } else {
114 __ bind(&return_label_); 115 __ bind(&return_label_);
115 if (FLAG_trace) { 116 if (FLAG_trace) {
116 // Push the return value on the stack as the parameter. 117 // Push the return value on the stack as the parameter.
117 // Runtime::TraceExit returns its parameter in r0. 118 // Runtime::TraceExit returns its parameter in r0.
118 __ push(r0); 119 __ push(r0);
119 __ CallRuntime(Runtime::kTraceExit, 1); 120 __ CallRuntime(Runtime::kTraceExit, 1);
120 } 121 }
121 #ifdef DEBUG 122
122 // Add a label for checking the size of the code used for returning. 123 // Add a label for checking the size of the code used for returning.
123 Label check_exit_codesize; 124 Label check_exit_codesize;
124 masm_->bind(&check_exit_codesize); 125 masm_->bind(&check_exit_codesize);
125 #endif 126
127 // Calculate the exact length of the return sequence and make sure that
128 // the constant pool is not emitted inside of the return sequence.
129 int num_parameters = function_->scope()->num_parameters();
130 int32_t sp_delta = (num_parameters + 1) * kPointerSize;
131 int return_sequence_length = Debug::kARMJSReturnSequenceLength;
132 if (!masm_->ImmediateFitsAddrMode1Instruction(sp_delta)) {
133 // Additional mov instruction generated.
134 return_sequence_length++;
135 }
136 masm_->BlockConstPoolFor(return_sequence_length);
137
126 CodeGenerator::RecordPositions(masm_, position); 138 CodeGenerator::RecordPositions(masm_, position);
127 __ RecordJSReturn(); 139 __ RecordJSReturn();
128 __ mov(sp, fp); 140 __ mov(sp, fp);
129 __ ldm(ia_w, sp, fp.bit() | lr.bit()); 141 __ ldm(ia_w, sp, fp.bit() | lr.bit());
130 int num_parameters = function_->scope()->num_parameters(); 142 __ add(sp, sp, Operand(sp_delta));
131 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize));
132 __ Jump(lr); 143 __ Jump(lr);
133 #ifdef DEBUG 144
134 // Check that the size of the code used for returning matches what is 145 // Check that the size of the code used for returning matches what is
135 // expected by the debugger. The add instruction above is an addressing 146 // expected by the debugger. The add instruction above is an addressing
136 // mode 1 instruction where there are restrictions on which immediate values 147 // mode 1 instruction where there are restrictions on which immediate values
137 // can be encoded in the instruction and which immediate values requires 148 // can be encoded in the instruction and which immediate values requires
138 // use of an additional instruction for moving the immediate to a temporary 149 // use of an additional instruction for moving the immediate to a temporary
139 // register. 150 // register.
140 int expected_return_sequence_length = CodeGenerator::kJSReturnSequenceLength;
141 if (!masm_->ImmediateFitsAddrMode1Instruction((num_parameters + 1) *
142 kPointerSize)) {
143 // Additional mov instruction generated.
144 expected_return_sequence_length++;
145 }
146 ASSERT_EQ(expected_return_sequence_length, 151 ASSERT_EQ(expected_return_sequence_length,
147 masm_->InstructionsGeneratedSince(&check_exit_codesize)); 152 masm_->InstructionsGeneratedSince(&check_exit_codesize));
148 #endif
149 } 153 }
150 } 154 }
151 155
152 156
153 void FastCodeGenerator::Move(Expression::Context context, Register source) { 157 void FastCodeGenerator::Move(Expression::Context context, Register source) {
154 switch (context) { 158 switch (context) {
155 case Expression::kUninitialized: 159 case Expression::kUninitialized:
156 UNREACHABLE(); 160 UNREACHABLE();
157 case Expression::kEffect: 161 case Expression::kEffect:
158 break; 162 break;
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 true_label_ = saved_true; 1291 true_label_ = saved_true;
1288 false_label_ = saved_false; 1292 false_label_ = saved_false;
1289 // Convert current context to test context: End post-test code. 1293 // Convert current context to test context: End post-test code.
1290 } 1294 }
1291 1295
1292 1296
1293 #undef __ 1297 #undef __
1294 1298
1295 1299
1296 } } // namespace v8::internal 1300 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/debug-arm.cc ('k') | src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698