OLD | NEW |
---|---|
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 frame_->Enter(); | 169 frame_->Enter(); |
170 // tos: code slot | 170 // tos: code slot |
171 #ifdef DEBUG | 171 #ifdef DEBUG |
172 if (strlen(FLAG_stop_at) > 0 && | 172 if (strlen(FLAG_stop_at) > 0 && |
173 fun->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 173 fun->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
174 frame_->SpillAll(); | 174 frame_->SpillAll(); |
175 __ stop("stop-at"); | 175 __ stop("stop-at"); |
176 } | 176 } |
177 #endif | 177 #endif |
178 | 178 |
179 // Allocate space for locals and initialize them. | 179 // Allocate space for locals and initialize them. This also checks |
180 // for stack overflow. | |
180 frame_->AllocateStackSlots(); | 181 frame_->AllocateStackSlots(); |
181 // Initialize the function return target after the locals are set | 182 // Initialize the function return target after the locals are set |
182 // up, because it needs the expected frame height from the frame. | 183 // up, because it needs the expected frame height from the frame. |
183 function_return_.set_direction(JumpTarget::BIDIRECTIONAL); | 184 function_return_.set_direction(JumpTarget::BIDIRECTIONAL); |
184 function_return_is_shadowed_ = false; | 185 function_return_is_shadowed_ = false; |
185 | 186 |
186 VirtualFrame::SpilledScope spilled_scope; | 187 VirtualFrame::SpilledScope spilled_scope; |
187 if (scope_->num_heap_slots() > 0) { | 188 if (scope_->num_heap_slots() > 0) { |
188 // Allocate local context. | 189 // Allocate local context. |
189 // Get outer context and create a new context based on it. | 190 // Get outer context and create a new context based on it. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 ProcessDeclarations(scope_->declarations()); | 272 ProcessDeclarations(scope_->declarations()); |
272 // Bail out if a stack-overflow exception occurred when processing | 273 // Bail out if a stack-overflow exception occurred when processing |
273 // declarations. | 274 // declarations. |
274 if (HasStackOverflow()) return; | 275 if (HasStackOverflow()) return; |
275 } | 276 } |
276 | 277 |
277 if (FLAG_trace) { | 278 if (FLAG_trace) { |
278 frame_->CallRuntime(Runtime::kTraceEnter, 0); | 279 frame_->CallRuntime(Runtime::kTraceEnter, 0); |
279 // Ignore the return value. | 280 // Ignore the return value. |
280 } | 281 } |
281 CheckStack(); | |
282 | 282 |
283 // Compile the body of the function in a vanilla state. Don't | 283 // Compile the body of the function in a vanilla state. Don't |
284 // bother compiling all the code if the scope has an illegal | 284 // bother compiling all the code if the scope has an illegal |
285 // redeclaration. | 285 // redeclaration. |
286 if (!scope_->HasIllegalRedeclaration()) { | 286 if (!scope_->HasIllegalRedeclaration()) { |
287 Comment cmnt(masm_, "[ function body"); | 287 Comment cmnt(masm_, "[ function body"); |
288 #ifdef DEBUG | 288 #ifdef DEBUG |
289 bool is_builtin = Bootstrapper::IsActive(); | 289 bool is_builtin = Bootstrapper::IsActive(); |
290 bool should_trace = | 290 bool should_trace = |
291 is_builtin ? FLAG_trace_builtin_calls : FLAG_trace_calls; | 291 is_builtin ? FLAG_trace_builtin_calls : FLAG_trace_calls; |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1104 target->Branch(cc); | 1104 target->Branch(cc); |
1105 cc_reg_ = al; | 1105 cc_reg_ = al; |
1106 } | 1106 } |
1107 | 1107 |
1108 | 1108 |
1109 void CodeGenerator::CheckStack() { | 1109 void CodeGenerator::CheckStack() { |
1110 VirtualFrame::SpilledScope spilled_scope; | 1110 VirtualFrame::SpilledScope spilled_scope; |
1111 if (FLAG_check_stack) { | 1111 if (FLAG_check_stack) { |
1112 Comment cmnt(masm_, "[ check stack"); | 1112 Comment cmnt(masm_, "[ check stack"); |
1113 __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 1113 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
1114 __ cmp(sp, Operand(ip)); | 1114 // Put the lr setup insn in the delay slot. The '4' is added to the |
Mads Ager (chromium)
2009/08/31 09:33:10
insn -> instruction
| |
1115 // implicit 8 that always apples to operations with pc and gives a return | |
Mads Ager (chromium)
2009/08/31 09:33:10
applies?
| |
1116 // address 12 bytes down. | |
1117 masm_->add(lr, pc, Operand(4)); | |
Mads Ager (chromium)
2009/08/31 09:33:10
Is this just 4 bytes or is it really kPointerSize?
Erik Corry
2009/08/31 11:07:57
Fixed to be sizeof(Instr). If we move to thumb2 w
| |
1118 masm_->cmp(sp, Operand(ip)); | |
1115 StackCheckStub stub; | 1119 StackCheckStub stub; |
1116 __ CallStub(&stub, lo); // Call the stub if lower. | 1120 // Call the stub if lower. |
1121 masm_->mov(pc, | |
1122 Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()), | |
1123 RelocInfo::CODE_TARGET), | |
1124 LeaveCC, | |
1125 lo); | |
1117 } | 1126 } |
1118 } | 1127 } |
1119 | 1128 |
1120 | 1129 |
1121 void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) { | 1130 void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) { |
1122 #ifdef DEBUG | 1131 #ifdef DEBUG |
1123 int original_height = frame_->height(); | 1132 int original_height = frame_->height(); |
1124 #endif | 1133 #endif |
1125 VirtualFrame::SpilledScope spilled_scope; | 1134 VirtualFrame::SpilledScope spilled_scope; |
1126 for (int i = 0; frame_ != NULL && i < statements->length(); i++) { | 1135 for (int i = 0; frame_ != NULL && i < statements->length(); i++) { |
(...skipping 5130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6257 int CompareStub::MinorKey() { | 6266 int CompareStub::MinorKey() { |
6258 // Encode the two parameters in a unique 16 bit value. | 6267 // Encode the two parameters in a unique 16 bit value. |
6259 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); | 6268 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); |
6260 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); | 6269 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); |
6261 } | 6270 } |
6262 | 6271 |
6263 | 6272 |
6264 #undef __ | 6273 #undef __ |
6265 | 6274 |
6266 } } // namespace v8::internal | 6275 } } // namespace v8::internal |
OLD | NEW |