| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 Comment cmnt(masm_, "[ Return sequence"); | 379 Comment cmnt(masm_, "[ Return sequence"); |
| 380 if (return_label_.is_bound()) { | 380 if (return_label_.is_bound()) { |
| 381 __ jmp(&return_label_); | 381 __ jmp(&return_label_); |
| 382 } else { | 382 } else { |
| 383 __ bind(&return_label_); | 383 __ bind(&return_label_); |
| 384 if (FLAG_trace) { | 384 if (FLAG_trace) { |
| 385 __ Push(rax); | 385 __ Push(rax); |
| 386 __ CallRuntime(Runtime::kTraceExit, 1); | 386 __ CallRuntime(Runtime::kTraceExit, 1); |
| 387 } | 387 } |
| 388 // Pretend that the exit is a backwards jump to the entry. | 388 // Pretend that the exit is a backwards jump to the entry. |
| 389 int weight = 1; | 389 int distance = masm_->pc_offset(); |
| 390 if (info_->ShouldSelfOptimize()) { | 390 int weight = |
| 391 weight = FLAG_interrupt_budget / FLAG_self_opt_count; | 391 Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); |
| 392 } else { | |
| 393 int distance = masm_->pc_offset(); | |
| 394 weight = Min(kMaxBackEdgeWeight, | |
| 395 Max(1, distance / kCodeSizeMultiplier)); | |
| 396 } | |
| 397 EmitProfilingCounterDecrement(weight); | 392 EmitProfilingCounterDecrement(weight); |
| 398 Label ok; | 393 Label ok; |
| 399 __ j(positive, &ok, Label::kNear); | 394 __ j(positive, &ok, Label::kNear); |
| 400 __ Push(rax); | 395 __ Push(rax); |
| 401 __ call(isolate()->builtins()->InterruptCheck(), | 396 __ call(isolate()->builtins()->InterruptCheck(), |
| 402 RelocInfo::CODE_TARGET); | 397 RelocInfo::CODE_TARGET); |
| 403 __ Pop(rax); | 398 __ Pop(rax); |
| 404 EmitProfilingCounterReset(); | 399 EmitProfilingCounterReset(); |
| 405 __ bind(&ok); | 400 __ bind(&ok); |
| 406 #ifdef DEBUG | 401 #ifdef DEBUG |
| (...skipping 4785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5192 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5187 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5193 Assembler::target_address_at(call_target_address, | 5188 Assembler::target_address_at(call_target_address, |
| 5194 unoptimized_code)); | 5189 unoptimized_code)); |
| 5195 return OSR_AFTER_STACK_CHECK; | 5190 return OSR_AFTER_STACK_CHECK; |
| 5196 } | 5191 } |
| 5197 | 5192 |
| 5198 | 5193 |
| 5199 } } // namespace v8::internal | 5194 } } // namespace v8::internal |
| 5200 | 5195 |
| 5201 #endif // V8_TARGET_ARCH_X64 | 5196 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |