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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 314 } |
315 __ movq(rbx, profiling_counter_, RelocInfo::EMBEDDED_OBJECT); | 315 __ movq(rbx, profiling_counter_, RelocInfo::EMBEDDED_OBJECT); |
316 __ movq(kScratchRegister, | 316 __ movq(kScratchRegister, |
317 reinterpret_cast<uint64_t>(Smi::FromInt(reset_value)), | 317 reinterpret_cast<uint64_t>(Smi::FromInt(reset_value)), |
318 RelocInfo::NONE); | 318 RelocInfo::NONE); |
319 __ movq(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), | 319 __ movq(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), |
320 kScratchRegister); | 320 kScratchRegister); |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 static const int kMaxBackEdgeWeight = 127; | 324 const int FullCodeGenerator::kMaxBackEdgeWeight = 127; |
325 static const int kBackEdgeDistanceDivisor = 162; | 325 const int FullCodeGenerator::kBackEdgeDistanceUnit = 162; |
326 | 326 |
327 | 327 |
328 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, | 328 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, |
329 Label* back_edge_target) { | 329 Label* back_edge_target) { |
330 Comment cmnt(masm_, "[ Stack check"); | 330 Comment cmnt(masm_, "[ Stack check"); |
331 Label ok; | 331 Label ok; |
332 | 332 |
333 if (FLAG_count_based_interrupts) { | 333 if (FLAG_count_based_interrupts) { |
334 int weight = 1; | 334 int weight = 1; |
335 if (FLAG_weighted_back_edges) { | 335 if (FLAG_weighted_back_edges) { |
336 ASSERT(back_edge_target->is_bound()); | 336 ASSERT(back_edge_target->is_bound()); |
337 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); | 337 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); |
338 weight = Min(kMaxBackEdgeWeight, | 338 weight = Min(kMaxBackEdgeWeight, |
339 Max(1, distance / kBackEdgeDistanceDivisor)); | 339 Max(1, distance / kBackEdgeDistanceUnit)); |
340 } | 340 } |
341 EmitProfilingCounterDecrement(weight); | 341 EmitProfilingCounterDecrement(weight); |
342 __ j(positive, &ok, Label::kNear); | 342 __ j(positive, &ok, Label::kNear); |
343 InterruptStub stub; | 343 InterruptStub stub; |
344 __ CallStub(&stub); | 344 __ CallStub(&stub); |
345 } else { | 345 } else { |
346 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | 346 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
347 __ j(above_equal, &ok, Label::kNear); | 347 __ j(above_equal, &ok, Label::kNear); |
348 StackCheckStub stub; | 348 StackCheckStub stub; |
349 __ CallStub(&stub); | 349 __ CallStub(&stub); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 __ CallRuntime(Runtime::kTraceExit, 1); | 385 __ CallRuntime(Runtime::kTraceExit, 1); |
386 } | 386 } |
387 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { | 387 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { |
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 weight = 1; |
390 if (info_->ShouldSelfOptimize()) { | 390 if (info_->ShouldSelfOptimize()) { |
391 weight = FLAG_interrupt_budget / FLAG_self_opt_count; | 391 weight = FLAG_interrupt_budget / FLAG_self_opt_count; |
392 } else if (FLAG_weighted_back_edges) { | 392 } else if (FLAG_weighted_back_edges) { |
393 int distance = masm_->pc_offset(); | 393 int distance = masm_->pc_offset(); |
394 weight = Min(kMaxBackEdgeWeight, | 394 weight = Min(kMaxBackEdgeWeight, |
395 Max(1, distance = kBackEdgeDistanceDivisor)); | 395 Max(1, distance / kBackEdgeDistanceUnit)); |
396 } | 396 } |
397 EmitProfilingCounterDecrement(weight); | 397 EmitProfilingCounterDecrement(weight); |
398 Label ok; | 398 Label ok; |
399 __ j(positive, &ok, Label::kNear); | 399 __ j(positive, &ok, Label::kNear); |
400 __ push(rax); | 400 __ push(rax); |
401 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { | 401 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { |
402 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 402 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
403 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); | 403 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); |
404 } else { | 404 } else { |
405 InterruptStub stub; | 405 InterruptStub stub; |
(...skipping 4141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4547 *context_length = 0; | 4547 *context_length = 0; |
4548 return previous_; | 4548 return previous_; |
4549 } | 4549 } |
4550 | 4550 |
4551 | 4551 |
4552 #undef __ | 4552 #undef __ |
4553 | 4553 |
4554 } } // namespace v8::internal | 4554 } } // namespace v8::internal |
4555 | 4555 |
4556 #endif // V8_TARGET_ARCH_X64 | 4556 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |