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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 if (return_label_.is_bound()) { | 376 if (return_label_.is_bound()) { |
377 __ jmp(&return_label_); | 377 __ jmp(&return_label_); |
378 } else { | 378 } else { |
379 // Common return label | 379 // Common return label |
380 __ bind(&return_label_); | 380 __ bind(&return_label_); |
381 if (FLAG_trace) { | 381 if (FLAG_trace) { |
382 __ push(eax); | 382 __ push(eax); |
383 __ CallRuntime(Runtime::kTraceExit, 1); | 383 __ CallRuntime(Runtime::kTraceExit, 1); |
384 } | 384 } |
385 // Pretend that the exit is a backwards jump to the entry. | 385 // Pretend that the exit is a backwards jump to the entry. |
386 int weight = 1; | 386 int distance = masm_->pc_offset(); |
387 if (info_->ShouldSelfOptimize()) { | 387 int weight = |
388 weight = FLAG_interrupt_budget / FLAG_self_opt_count; | 388 Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); |
389 } else { | |
390 int distance = masm_->pc_offset(); | |
391 weight = Min(kMaxBackEdgeWeight, | |
392 Max(1, distance / kCodeSizeMultiplier)); | |
393 } | |
394 EmitProfilingCounterDecrement(weight); | 389 EmitProfilingCounterDecrement(weight); |
395 Label ok; | 390 Label ok; |
396 __ j(positive, &ok, Label::kNear); | 391 __ j(positive, &ok, Label::kNear); |
397 __ push(eax); | 392 __ push(eax); |
398 __ call(isolate()->builtins()->InterruptCheck(), | 393 __ call(isolate()->builtins()->InterruptCheck(), |
399 RelocInfo::CODE_TARGET); | 394 RelocInfo::CODE_TARGET); |
400 __ pop(eax); | 395 __ pop(eax); |
401 EmitProfilingCounterReset(); | 396 EmitProfilingCounterReset(); |
402 __ bind(&ok); | 397 __ bind(&ok); |
403 #ifdef DEBUG | 398 #ifdef DEBUG |
(...skipping 4772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5176 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5171 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5177 Assembler::target_address_at(call_target_address, | 5172 Assembler::target_address_at(call_target_address, |
5178 unoptimized_code)); | 5173 unoptimized_code)); |
5179 return OSR_AFTER_STACK_CHECK; | 5174 return OSR_AFTER_STACK_CHECK; |
5180 } | 5175 } |
5181 | 5176 |
5182 | 5177 |
5183 } } // namespace v8::internal | 5178 } } // namespace v8::internal |
5184 | 5179 |
5185 #endif // V8_TARGET_ARCH_IA32 | 5180 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |