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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 if (info_->ShouldSelfOptimize() && !FLAG_retry_self_opt) { | 318 if (info_->ShouldSelfOptimize() && !FLAG_retry_self_opt) { |
319 // Self-optimization is a one-off thing: if it fails, don't try again. | 319 // Self-optimization is a one-off thing: if it fails, don't try again. |
320 reset_value = Smi::kMaxValue; | 320 reset_value = Smi::kMaxValue; |
321 } | 321 } |
322 __ mov(ebx, Immediate(profiling_counter_)); | 322 __ mov(ebx, Immediate(profiling_counter_)); |
323 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), | 323 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), |
324 Immediate(Smi::FromInt(reset_value))); | 324 Immediate(Smi::FromInt(reset_value))); |
325 } | 325 } |
326 | 326 |
327 | 327 |
328 static const int kMaxBackEdgeWeight = 127; | 328 const int FullCodeGenerator::kMaxBackEdgeWeight = 127; |
329 static const int kBackEdgeDistanceDivisor = 100; | 329 const int FullCodeGenerator::kBackEdgeDistanceUnit = 100; |
330 | 330 |
331 | 331 |
332 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, | 332 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, |
333 Label* back_edge_target) { | 333 Label* back_edge_target) { |
334 Comment cmnt(masm_, "[ Stack check"); | 334 Comment cmnt(masm_, "[ Stack check"); |
335 Label ok; | 335 Label ok; |
336 | 336 |
337 if (FLAG_count_based_interrupts) { | 337 if (FLAG_count_based_interrupts) { |
338 int weight = 1; | 338 int weight = 1; |
339 if (FLAG_weighted_back_edges) { | 339 if (FLAG_weighted_back_edges) { |
340 ASSERT(back_edge_target->is_bound()); | 340 ASSERT(back_edge_target->is_bound()); |
341 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); | 341 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); |
342 weight = Min(kMaxBackEdgeWeight, | 342 weight = Min(kMaxBackEdgeWeight, |
343 Max(1, distance / kBackEdgeDistanceDivisor)); | 343 Max(1, distance / kBackEdgeDistanceUnit)); |
344 } | 344 } |
345 EmitProfilingCounterDecrement(weight); | 345 EmitProfilingCounterDecrement(weight); |
346 __ j(positive, &ok, Label::kNear); | 346 __ j(positive, &ok, Label::kNear); |
347 InterruptStub stub; | 347 InterruptStub stub; |
348 __ CallStub(&stub); | 348 __ CallStub(&stub); |
349 } else { | 349 } else { |
350 // Count based interrupts happen often enough when they are enabled | 350 // Count based interrupts happen often enough when they are enabled |
351 // that the additional stack checks are not necessary (they would | 351 // that the additional stack checks are not necessary (they would |
352 // only check for interrupts). | 352 // only check for interrupts). |
353 ExternalReference stack_limit = | 353 ExternalReference stack_limit = |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 __ CallRuntime(Runtime::kTraceExit, 1); | 395 __ CallRuntime(Runtime::kTraceExit, 1); |
396 } | 396 } |
397 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { | 397 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { |
398 // Pretend that the exit is a backwards jump to the entry. | 398 // Pretend that the exit is a backwards jump to the entry. |
399 int weight = 1; | 399 int weight = 1; |
400 if (info_->ShouldSelfOptimize()) { | 400 if (info_->ShouldSelfOptimize()) { |
401 weight = FLAG_interrupt_budget / FLAG_self_opt_count; | 401 weight = FLAG_interrupt_budget / FLAG_self_opt_count; |
402 } else if (FLAG_weighted_back_edges) { | 402 } else if (FLAG_weighted_back_edges) { |
403 int distance = masm_->pc_offset(); | 403 int distance = masm_->pc_offset(); |
404 weight = Min(kMaxBackEdgeWeight, | 404 weight = Min(kMaxBackEdgeWeight, |
405 Max(1, distance / kBackEdgeDistanceDivisor)); | 405 Max(1, distance / kBackEdgeDistanceUnit)); |
406 } | 406 } |
407 EmitProfilingCounterDecrement(weight); | 407 EmitProfilingCounterDecrement(weight); |
408 Label ok; | 408 Label ok; |
409 __ j(positive, &ok, Label::kNear); | 409 __ j(positive, &ok, Label::kNear); |
410 __ push(eax); | 410 __ push(eax); |
411 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { | 411 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { |
412 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 412 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
413 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); | 413 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); |
414 } else { | 414 } else { |
415 InterruptStub stub; | 415 InterruptStub stub; |
(...skipping 4136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4552 *stack_depth = 0; | 4552 *stack_depth = 0; |
4553 *context_length = 0; | 4553 *context_length = 0; |
4554 return previous_; | 4554 return previous_; |
4555 } | 4555 } |
4556 | 4556 |
4557 #undef __ | 4557 #undef __ |
4558 | 4558 |
4559 } } // namespace v8::internal | 4559 } } // namespace v8::internal |
4560 | 4560 |
4561 #endif // V8_TARGET_ARCH_IA32 | 4561 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |