| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 VisitDeclarations(scope()->declarations()); | 281 VisitDeclarations(scope()->declarations()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 { Comment cmnt(masm_, "[ Stack check"); | 284 { Comment cmnt(masm_, "[ Stack check"); |
| 285 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); | 285 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); |
| 286 Label ok; | 286 Label ok; |
| 287 ExternalReference stack_limit = | 287 ExternalReference stack_limit = |
| 288 ExternalReference::address_of_stack_limit(isolate()); | 288 ExternalReference::address_of_stack_limit(isolate()); |
| 289 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 289 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 290 __ j(above_equal, &ok, Label::kNear); | 290 __ j(above_equal, &ok, Label::kNear); |
| 291 StackCheckStub stub; | 291 __ call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET); |
| 292 __ CallStub(&stub); | |
| 293 __ bind(&ok); | 292 __ bind(&ok); |
| 294 } | 293 } |
| 295 | 294 |
| 296 { Comment cmnt(masm_, "[ Body"); | 295 { Comment cmnt(masm_, "[ Body"); |
| 297 ASSERT(loop_depth() == 0); | 296 ASSERT(loop_depth() == 0); |
| 298 VisitStatements(function()->body()); | 297 VisitStatements(function()->body()); |
| 299 ASSERT(loop_depth() == 0); | 298 ASSERT(loop_depth() == 0); |
| 300 } | 299 } |
| 301 } | 300 } |
| 302 | 301 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 339 |
| 341 int weight = 1; | 340 int weight = 1; |
| 342 if (FLAG_weighted_back_edges) { | 341 if (FLAG_weighted_back_edges) { |
| 343 ASSERT(back_edge_target->is_bound()); | 342 ASSERT(back_edge_target->is_bound()); |
| 344 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); | 343 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); |
| 345 weight = Min(kMaxBackEdgeWeight, | 344 weight = Min(kMaxBackEdgeWeight, |
| 346 Max(1, distance / kCodeSizeMultiplier)); | 345 Max(1, distance / kCodeSizeMultiplier)); |
| 347 } | 346 } |
| 348 EmitProfilingCounterDecrement(weight); | 347 EmitProfilingCounterDecrement(weight); |
| 349 __ j(positive, &ok, Label::kNear); | 348 __ j(positive, &ok, Label::kNear); |
| 350 InterruptStub stub; | 349 __ call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); |
| 351 __ CallStub(&stub); | |
| 352 | 350 |
| 353 // Record a mapping of this PC offset to the OSR id. This is used to find | 351 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 354 // the AST id from the unoptimized code in order to use it as a key into | 352 // the AST id from the unoptimized code in order to use it as a key into |
| 355 // the deoptimization input data found in the optimized code. | 353 // the deoptimization input data found in the optimized code. |
| 356 RecordBackEdge(stmt->OsrEntryId()); | 354 RecordBackEdge(stmt->OsrEntryId()); |
| 357 | 355 |
| 358 EmitProfilingCounterReset(); | 356 EmitProfilingCounterReset(); |
| 359 | 357 |
| 360 __ bind(&ok); | 358 __ bind(&ok); |
| 361 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 359 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 388 Max(1, distance / kCodeSizeMultiplier)); | 386 Max(1, distance / kCodeSizeMultiplier)); |
| 389 } | 387 } |
| 390 EmitProfilingCounterDecrement(weight); | 388 EmitProfilingCounterDecrement(weight); |
| 391 Label ok; | 389 Label ok; |
| 392 __ j(positive, &ok, Label::kNear); | 390 __ j(positive, &ok, Label::kNear); |
| 393 __ push(eax); | 391 __ push(eax); |
| 394 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { | 392 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { |
| 395 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 393 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 396 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); | 394 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); |
| 397 } else { | 395 } else { |
| 398 InterruptStub stub; | 396 __ call(isolate()->builtins()->InterruptCheck(), |
| 399 __ CallStub(&stub); | 397 RelocInfo::CODE_TARGET); |
| 400 } | 398 } |
| 401 __ pop(eax); | 399 __ pop(eax); |
| 402 EmitProfilingCounterReset(); | 400 EmitProfilingCounterReset(); |
| 403 __ bind(&ok); | 401 __ bind(&ok); |
| 404 } | 402 } |
| 405 #ifdef DEBUG | 403 #ifdef DEBUG |
| 406 // Add a label for checking the size of the code used for returning. | 404 // Add a label for checking the size of the code used for returning. |
| 407 Label check_exit_codesize; | 405 Label check_exit_codesize; |
| 408 masm_->bind(&check_exit_codesize); | 406 masm_->bind(&check_exit_codesize); |
| 409 #endif | 407 #endif |
| (...skipping 4480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4890 *stack_depth = 0; | 4888 *stack_depth = 0; |
| 4891 *context_length = 0; | 4889 *context_length = 0; |
| 4892 return previous_; | 4890 return previous_; |
| 4893 } | 4891 } |
| 4894 | 4892 |
| 4895 #undef __ | 4893 #undef __ |
| 4896 | 4894 |
| 4897 } } // namespace v8::internal | 4895 } } // namespace v8::internal |
| 4898 | 4896 |
| 4899 #endif // V8_TARGET_ARCH_IA32 | 4897 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |