| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, | 335 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, |
| 336 Label* back_edge_target) { | 336 Label* back_edge_target) { |
| 337 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 337 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
| 338 Label ok; | 338 Label ok; |
| 339 | 339 |
| 340 int weight = 1; | 340 int weight = 1; |
| 341 if (FLAG_weighted_back_edges) { | 341 if (FLAG_weighted_back_edges) { |
| 342 ASSERT(back_edge_target->is_bound()); | 342 ASSERT(back_edge_target->is_bound()); |
| 343 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); | 343 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); |
| 344 weight = Min(kMaxBackEdgeWeight, | 344 weight = Min(kMaxBackEdgeWeight, |
| 345 Max(1, distance / kBackEdgeDistanceUnit)); | 345 Max(1, distance / kCodeSizeMultiplier)); |
| 346 } | 346 } |
| 347 EmitProfilingCounterDecrement(weight); | 347 EmitProfilingCounterDecrement(weight); |
| 348 __ j(positive, &ok, Label::kNear); | 348 __ j(positive, &ok, Label::kNear); |
| 349 InterruptStub stub; | 349 InterruptStub stub; |
| 350 __ CallStub(&stub); | 350 __ CallStub(&stub); |
| 351 | 351 |
| 352 // Record a mapping of this PC offset to the OSR id. This is used to find | 352 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 353 // the AST id from the unoptimized code in order to use it as a key into | 353 // the AST id from the unoptimized code in order to use it as a key into |
| 354 // the deoptimization input data found in the optimized code. | 354 // the deoptimization input data found in the optimized code. |
| 355 RecordBackEdge(stmt->OsrEntryId()); | 355 RecordBackEdge(stmt->OsrEntryId()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 377 __ CallRuntime(Runtime::kTraceExit, 1); | 377 __ CallRuntime(Runtime::kTraceExit, 1); |
| 378 } | 378 } |
| 379 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { | 379 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { |
| 380 // Pretend that the exit is a backwards jump to the entry. | 380 // Pretend that the exit is a backwards jump to the entry. |
| 381 int weight = 1; | 381 int weight = 1; |
| 382 if (info_->ShouldSelfOptimize()) { | 382 if (info_->ShouldSelfOptimize()) { |
| 383 weight = FLAG_interrupt_budget / FLAG_self_opt_count; | 383 weight = FLAG_interrupt_budget / FLAG_self_opt_count; |
| 384 } else if (FLAG_weighted_back_edges) { | 384 } else if (FLAG_weighted_back_edges) { |
| 385 int distance = masm_->pc_offset(); | 385 int distance = masm_->pc_offset(); |
| 386 weight = Min(kMaxBackEdgeWeight, | 386 weight = Min(kMaxBackEdgeWeight, |
| 387 Max(1, distance / kBackEdgeDistanceUnit)); | 387 Max(1, distance / kCodeSizeMultiplier)); |
| 388 } | 388 } |
| 389 EmitProfilingCounterDecrement(weight); | 389 EmitProfilingCounterDecrement(weight); |
| 390 Label ok; | 390 Label ok; |
| 391 __ j(positive, &ok, Label::kNear); | 391 __ j(positive, &ok, Label::kNear); |
| 392 __ push(eax); | 392 __ push(eax); |
| 393 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { | 393 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { |
| 394 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 394 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 395 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); | 395 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); |
| 396 } else { | 396 } else { |
| 397 InterruptStub stub; | 397 InterruptStub stub; |
| (...skipping 4495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4893 *stack_depth = 0; | 4893 *stack_depth = 0; |
| 4894 *context_length = 0; | 4894 *context_length = 0; |
| 4895 return previous_; | 4895 return previous_; |
| 4896 } | 4896 } |
| 4897 | 4897 |
| 4898 #undef __ | 4898 #undef __ |
| 4899 | 4899 |
| 4900 } } // namespace v8::internal | 4900 } } // namespace v8::internal |
| 4901 | 4901 |
| 4902 #endif // V8_TARGET_ARCH_IA32 | 4902 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |