OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 | 258 |
259 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) { | 259 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) { |
260 Comment cmnt(masm_, "[ Stack check"); | 260 Comment cmnt(masm_, "[ Stack check"); |
261 NearLabel ok; | 261 NearLabel ok; |
262 ExternalReference stack_limit = ExternalReference::address_of_stack_limit(); | 262 ExternalReference stack_limit = ExternalReference::address_of_stack_limit(); |
263 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 263 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
264 __ j(above_equal, &ok, taken); | 264 __ j(above_equal, &ok, taken); |
265 StackCheckStub stub; | 265 StackCheckStub stub; |
266 __ CallStub(&stub); | 266 __ CallStub(&stub); |
| 267 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 268 // the AST id from the unoptimized code in order to use it as a key into |
| 269 // the deoptimization input data found in the optimized code. |
| 270 RecordStackCheck(stmt->OsrEntryId()); |
| 271 |
| 272 // Loop stack checks can be patched to perform on-stack replacement. In |
| 273 // order to decide whether or not to perform OSR we embed the loop depth |
| 274 // in a test instruction after the call so we can extract it from the OSR |
| 275 // builtin. |
| 276 ASSERT(loop_depth() > 0); |
| 277 __ test(eax, Immediate(Min(loop_depth(), Code::kMaxLoopNestingMarker))); |
| 278 |
267 __ bind(&ok); | 279 __ bind(&ok); |
268 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 280 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
| 281 // Record a mapping of the OSR id to this PC. This is used if the OSR |
| 282 // entry becomes the target of a bailout. We don't expect it to be, but |
| 283 // we want it to work if it is. |
269 PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS); | 284 PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS); |
270 RecordStackCheck(stmt->OsrEntryId()); | |
271 // Loop stack checks can be patched to perform on-stack | |
272 // replacement. In order to decide whether or not to perform OSR we | |
273 // embed the loop depth in a test instruction after the call so we | |
274 // can extract it from the OSR builtin. | |
275 ASSERT(loop_depth() > 0); | |
276 __ test(eax, Immediate(Min(loop_depth(), Code::kMaxLoopNestingMarker))); | |
277 } | 285 } |
278 | 286 |
279 | 287 |
280 void FullCodeGenerator::EmitReturnSequence() { | 288 void FullCodeGenerator::EmitReturnSequence() { |
281 Comment cmnt(masm_, "[ Return sequence"); | 289 Comment cmnt(masm_, "[ Return sequence"); |
282 if (return_label_.is_bound()) { | 290 if (return_label_.is_bound()) { |
283 __ jmp(&return_label_); | 291 __ jmp(&return_label_); |
284 } else { | 292 } else { |
285 // Common return label | 293 // Common return label |
286 __ bind(&return_label_); | 294 __ bind(&return_label_); |
(...skipping 3972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4259 // And return. | 4267 // And return. |
4260 __ ret(0); | 4268 __ ret(0); |
4261 } | 4269 } |
4262 | 4270 |
4263 | 4271 |
4264 #undef __ | 4272 #undef __ |
4265 | 4273 |
4266 } } // namespace v8::internal | 4274 } } // namespace v8::internal |
4267 | 4275 |
4268 #endif // V8_TARGET_ARCH_IA32 | 4276 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |