| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, | 330 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, |
| 331 Label* back_edge_target) { | 331 Label* back_edge_target) { |
| 332 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 332 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
| 333 Label ok; | 333 Label ok; |
| 334 | 334 |
| 335 int weight = 1; | 335 int weight = 1; |
| 336 if (FLAG_weighted_back_edges) { | 336 if (FLAG_weighted_back_edges) { |
| 337 ASSERT(back_edge_target->is_bound()); | 337 ASSERT(back_edge_target->is_bound()); |
| 338 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); | 338 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); |
| 339 weight = Min(kMaxBackEdgeWeight, | 339 weight = Min(kMaxBackEdgeWeight, |
| 340 Max(1, distance / kBackEdgeDistanceUnit)); | 340 Max(1, distance / kCodeSizeMultiplier)); |
| 341 } | 341 } |
| 342 EmitProfilingCounterDecrement(weight); | 342 EmitProfilingCounterDecrement(weight); |
| 343 __ j(positive, &ok, Label::kNear); | 343 __ j(positive, &ok, Label::kNear); |
| 344 InterruptStub stub; | 344 InterruptStub stub; |
| 345 __ CallStub(&stub); | 345 __ CallStub(&stub); |
| 346 | 346 |
| 347 // Record a mapping of this PC offset to the OSR id. This is used to find | 347 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 348 // the AST id from the unoptimized code in order to use it as a key into | 348 // the AST id from the unoptimized code in order to use it as a key into |
| 349 // the deoptimization input data found in the optimized code. | 349 // the deoptimization input data found in the optimized code. |
| 350 RecordBackEdge(stmt->OsrEntryId()); | 350 RecordBackEdge(stmt->OsrEntryId()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 371 __ CallRuntime(Runtime::kTraceExit, 1); | 371 __ CallRuntime(Runtime::kTraceExit, 1); |
| 372 } | 372 } |
| 373 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { | 373 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { |
| 374 // Pretend that the exit is a backwards jump to the entry. | 374 // Pretend that the exit is a backwards jump to the entry. |
| 375 int weight = 1; | 375 int weight = 1; |
| 376 if (info_->ShouldSelfOptimize()) { | 376 if (info_->ShouldSelfOptimize()) { |
| 377 weight = FLAG_interrupt_budget / FLAG_self_opt_count; | 377 weight = FLAG_interrupt_budget / FLAG_self_opt_count; |
| 378 } else if (FLAG_weighted_back_edges) { | 378 } else if (FLAG_weighted_back_edges) { |
| 379 int distance = masm_->pc_offset(); | 379 int distance = masm_->pc_offset(); |
| 380 weight = Min(kMaxBackEdgeWeight, | 380 weight = Min(kMaxBackEdgeWeight, |
| 381 Max(1, distance / kBackEdgeDistanceUnit)); | 381 Max(1, distance / kCodeSizeMultiplier)); |
| 382 } | 382 } |
| 383 EmitProfilingCounterDecrement(weight); | 383 EmitProfilingCounterDecrement(weight); |
| 384 Label ok; | 384 Label ok; |
| 385 __ j(positive, &ok, Label::kNear); | 385 __ j(positive, &ok, Label::kNear); |
| 386 __ push(rax); | 386 __ push(rax); |
| 387 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { | 387 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { |
| 388 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 388 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 389 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); | 389 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); |
| 390 } else { | 390 } else { |
| 391 InterruptStub stub; | 391 InterruptStub stub; |
| (...skipping 4488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4880 *context_length = 0; | 4880 *context_length = 0; |
| 4881 return previous_; | 4881 return previous_; |
| 4882 } | 4882 } |
| 4883 | 4883 |
| 4884 | 4884 |
| 4885 #undef __ | 4885 #undef __ |
| 4886 | 4886 |
| 4887 } } // namespace v8::internal | 4887 } } // namespace v8::internal |
| 4888 | 4888 |
| 4889 #endif // V8_TARGET_ARCH_X64 | 4889 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |