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 distance = masm_->pc_offset(); | 389 int weight = 1; |
390 int weight = | 390 if (info_->ShouldSelfOptimize()) { |
391 Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); | 391 weight = FLAG_interrupt_budget / FLAG_self_opt_count; |
| 392 } else { |
| 393 int distance = masm_->pc_offset(); |
| 394 weight = Min(kMaxBackEdgeWeight, |
| 395 Max(1, distance / kCodeSizeMultiplier)); |
| 396 } |
392 EmitProfilingCounterDecrement(weight); | 397 EmitProfilingCounterDecrement(weight); |
393 Label ok; | 398 Label ok; |
394 __ j(positive, &ok, Label::kNear); | 399 __ j(positive, &ok, Label::kNear); |
395 __ Push(rax); | 400 __ Push(rax); |
396 __ call(isolate()->builtins()->InterruptCheck(), | 401 __ call(isolate()->builtins()->InterruptCheck(), |
397 RelocInfo::CODE_TARGET); | 402 RelocInfo::CODE_TARGET); |
398 __ Pop(rax); | 403 __ Pop(rax); |
399 EmitProfilingCounterReset(); | 404 EmitProfilingCounterReset(); |
400 __ bind(&ok); | 405 __ bind(&ok); |
401 #ifdef DEBUG | 406 #ifdef DEBUG |
(...skipping 4785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5187 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5192 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5188 Assembler::target_address_at(call_target_address, | 5193 Assembler::target_address_at(call_target_address, |
5189 unoptimized_code)); | 5194 unoptimized_code)); |
5190 return OSR_AFTER_STACK_CHECK; | 5195 return OSR_AFTER_STACK_CHECK; |
5191 } | 5196 } |
5192 | 5197 |
5193 | 5198 |
5194 } } // namespace v8::internal | 5199 } } // namespace v8::internal |
5195 | 5200 |
5196 #endif // V8_TARGET_ARCH_X64 | 5201 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |