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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 if (return_label_.is_bound()) { | 373 if (return_label_.is_bound()) { |
374 __ jmp(&return_label_); | 374 __ jmp(&return_label_); |
375 } else { | 375 } else { |
376 // Common return label | 376 // Common return label |
377 __ bind(&return_label_); | 377 __ bind(&return_label_); |
378 if (FLAG_trace) { | 378 if (FLAG_trace) { |
379 __ push(eax); | 379 __ push(eax); |
380 __ CallRuntime(Runtime::kTraceExit, 1); | 380 __ CallRuntime(Runtime::kTraceExit, 1); |
381 } | 381 } |
382 // Pretend that the exit is a backwards jump to the entry. | 382 // Pretend that the exit is a backwards jump to the entry. |
383 int weight = 1; | 383 int distance = masm_->pc_offset(); |
384 if (info_->ShouldSelfOptimize()) { | 384 int weight = |
385 weight = FLAG_interrupt_budget / FLAG_self_opt_count; | 385 Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); |
386 } else { | |
387 int distance = masm_->pc_offset(); | |
388 weight = Min(kMaxBackEdgeWeight, | |
389 Max(1, distance / kCodeSizeMultiplier)); | |
390 } | |
391 EmitProfilingCounterDecrement(weight); | 386 EmitProfilingCounterDecrement(weight); |
392 Label ok; | 387 Label ok; |
393 __ j(positive, &ok, Label::kNear); | 388 __ j(positive, &ok, Label::kNear); |
394 __ push(eax); | 389 __ push(eax); |
395 __ call(isolate()->builtins()->InterruptCheck(), | 390 __ call(isolate()->builtins()->InterruptCheck(), |
396 RelocInfo::CODE_TARGET); | 391 RelocInfo::CODE_TARGET); |
397 __ pop(eax); | 392 __ pop(eax); |
398 EmitProfilingCounterReset(); | 393 EmitProfilingCounterReset(); |
399 __ bind(&ok); | 394 __ bind(&ok); |
400 #ifdef DEBUG | 395 #ifdef DEBUG |
(...skipping 4761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5162 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5157 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5163 Assembler::target_address_at(call_target_address, | 5158 Assembler::target_address_at(call_target_address, |
5164 unoptimized_code)); | 5159 unoptimized_code)); |
5165 return OSR_AFTER_STACK_CHECK; | 5160 return OSR_AFTER_STACK_CHECK; |
5166 } | 5161 } |
5167 | 5162 |
5168 | 5163 |
5169 } } // namespace v8::internal | 5164 } } // namespace v8::internal |
5170 | 5165 |
5171 #endif // V8_TARGET_ARCH_X87 | 5166 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |