| OLD | NEW |
| 1 // Copyright 2011 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 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 238 } |
| 239 VisitDeclarations(scope()->declarations()); | 239 VisitDeclarations(scope()->declarations()); |
| 240 } | 240 } |
| 241 | 241 |
| 242 { Comment cmnt(masm_, "[ Stack check"); | 242 { Comment cmnt(masm_, "[ Stack check"); |
| 243 PrepareForBailoutForId(AstNode::kFunctionEntryId, NO_REGISTERS); | 243 PrepareForBailoutForId(AstNode::kFunctionEntryId, NO_REGISTERS); |
| 244 Label ok; | 244 Label ok; |
| 245 ExternalReference stack_limit = | 245 ExternalReference stack_limit = |
| 246 ExternalReference::address_of_stack_limit(isolate()); | 246 ExternalReference::address_of_stack_limit(isolate()); |
| 247 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 247 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 248 __ j(above_equal, &ok, taken, Label::kNear); | 248 __ j(above_equal, &ok, Label::kNear); |
| 249 StackCheckStub stub; | 249 StackCheckStub stub; |
| 250 __ CallStub(&stub); | 250 __ CallStub(&stub); |
| 251 __ bind(&ok); | 251 __ bind(&ok); |
| 252 } | 252 } |
| 253 | 253 |
| 254 { Comment cmnt(masm_, "[ Body"); | 254 { Comment cmnt(masm_, "[ Body"); |
| 255 ASSERT(loop_depth() == 0); | 255 ASSERT(loop_depth() == 0); |
| 256 VisitStatements(function()->body()); | 256 VisitStatements(function()->body()); |
| 257 ASSERT(loop_depth() == 0); | 257 ASSERT(loop_depth() == 0); |
| 258 } | 258 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 271 __ Set(eax, Immediate(Smi::FromInt(0))); | 271 __ Set(eax, Immediate(Smi::FromInt(0))); |
| 272 } | 272 } |
| 273 | 273 |
| 274 | 274 |
| 275 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) { | 275 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) { |
| 276 Comment cmnt(masm_, "[ Stack check"); | 276 Comment cmnt(masm_, "[ Stack check"); |
| 277 Label ok; | 277 Label ok; |
| 278 ExternalReference stack_limit = | 278 ExternalReference stack_limit = |
| 279 ExternalReference::address_of_stack_limit(isolate()); | 279 ExternalReference::address_of_stack_limit(isolate()); |
| 280 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 280 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 281 __ j(above_equal, &ok, taken, Label::kNear); | 281 __ j(above_equal, &ok, Label::kNear); |
| 282 StackCheckStub stub; | 282 StackCheckStub stub; |
| 283 __ CallStub(&stub); | 283 __ CallStub(&stub); |
| 284 // Record a mapping of this PC offset to the OSR id. This is used to find | 284 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 285 // the AST id from the unoptimized code in order to use it as a key into | 285 // the AST id from the unoptimized code in order to use it as a key into |
| 286 // the deoptimization input data found in the optimized code. | 286 // the deoptimization input data found in the optimized code. |
| 287 RecordStackCheck(stmt->OsrEntryId()); | 287 RecordStackCheck(stmt->OsrEntryId()); |
| 288 | 288 |
| 289 // Loop stack checks can be patched to perform on-stack replacement. In | 289 // Loop stack checks can be patched to perform on-stack replacement. In |
| 290 // order to decide whether or not to perform OSR we embed the loop depth | 290 // order to decide whether or not to perform OSR we embed the loop depth |
| 291 // in a test instruction after the call so we can extract it from the OSR | 291 // in a test instruction after the call so we can extract it from the OSR |
| (...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 break; | 1718 break; |
| 1719 case Token::SUB: | 1719 case Token::SUB: |
| 1720 __ sub(eax, Operand(ecx)); | 1720 __ sub(eax, Operand(ecx)); |
| 1721 __ j(overflow, &stub_call); | 1721 __ j(overflow, &stub_call); |
| 1722 break; | 1722 break; |
| 1723 case Token::MUL: { | 1723 case Token::MUL: { |
| 1724 __ SmiUntag(eax); | 1724 __ SmiUntag(eax); |
| 1725 __ imul(eax, Operand(ecx)); | 1725 __ imul(eax, Operand(ecx)); |
| 1726 __ j(overflow, &stub_call); | 1726 __ j(overflow, &stub_call); |
| 1727 __ test(eax, Operand(eax)); | 1727 __ test(eax, Operand(eax)); |
| 1728 __ j(not_zero, &done, taken, Label::kNear); | 1728 __ j(not_zero, &done, Label::kNear); |
| 1729 __ mov(ebx, edx); | 1729 __ mov(ebx, edx); |
| 1730 __ or_(ebx, Operand(ecx)); | 1730 __ or_(ebx, Operand(ecx)); |
| 1731 __ j(negative, &stub_call); | 1731 __ j(negative, &stub_call); |
| 1732 break; | 1732 break; |
| 1733 } | 1733 } |
| 1734 case Token::BIT_OR: | 1734 case Token::BIT_OR: |
| 1735 __ or_(eax, Operand(ecx)); | 1735 __ or_(eax, Operand(ecx)); |
| 1736 break; | 1736 break; |
| 1737 case Token::BIT_AND: | 1737 case Token::BIT_AND: |
| 1738 __ and_(eax, Operand(ecx)); | 1738 __ and_(eax, Operand(ecx)); |
| (...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4322 // And return. | 4322 // And return. |
| 4323 __ ret(0); | 4323 __ ret(0); |
| 4324 } | 4324 } |
| 4325 | 4325 |
| 4326 | 4326 |
| 4327 #undef __ | 4327 #undef __ |
| 4328 | 4328 |
| 4329 } } // namespace v8::internal | 4329 } } // namespace v8::internal |
| 4330 | 4330 |
| 4331 #endif // V8_TARGET_ARCH_IA32 | 4331 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |