| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 356 |
| 357 | 357 |
| 358 void FullCodeGenerator::EmitProfilingCounterReset() { | 358 void FullCodeGenerator::EmitProfilingCounterReset() { |
| 359 int reset_value = FLAG_interrupt_budget; | 359 int reset_value = FLAG_interrupt_budget; |
| 360 __ Move(rbx, profiling_counter_, RelocInfo::EMBEDDED_OBJECT); | 360 __ Move(rbx, profiling_counter_, RelocInfo::EMBEDDED_OBJECT); |
| 361 __ Move(kScratchRegister, Smi::FromInt(reset_value)); | 361 __ Move(kScratchRegister, Smi::FromInt(reset_value)); |
| 362 __ movp(FieldOperand(rbx, Cell::kValueOffset), kScratchRegister); | 362 __ movp(FieldOperand(rbx, Cell::kValueOffset), kScratchRegister); |
| 363 } | 363 } |
| 364 | 364 |
| 365 | 365 |
| 366 static const byte kJnsOffset = kPointerSize == kInt64Size ? 0x1d : 0x14; |
| 367 |
| 368 |
| 366 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, | 369 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, |
| 367 Label* back_edge_target) { | 370 Label* back_edge_target) { |
| 368 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 371 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
| 369 Label ok; | 372 Label ok; |
| 370 | 373 |
| 371 ASSERT(back_edge_target->is_bound()); | 374 ASSERT(back_edge_target->is_bound()); |
| 372 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); | 375 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); |
| 373 int weight = Min(kMaxBackEdgeWeight, | 376 int weight = Min(kMaxBackEdgeWeight, |
| 374 Max(1, distance / kCodeSizeMultiplier)); | 377 Max(1, distance / kCodeSizeMultiplier)); |
| 375 EmitProfilingCounterDecrement(weight); | 378 EmitProfilingCounterDecrement(weight); |
| 379 |
| 376 __ j(positive, &ok, Label::kNear); | 380 __ j(positive, &ok, Label::kNear); |
| 377 __ call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); | 381 { |
| 382 PredictableCodeSizeScope predictible_code_size_scope(masm_, kJnsOffset); |
| 383 DontEmitDebugCodeScope dont_emit_debug_code_scope(masm_); |
| 384 __ call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); |
| 378 | 385 |
| 379 // Record a mapping of this PC offset to the OSR id. This is used to find | 386 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 380 // the AST id from the unoptimized code in order to use it as a key into | 387 // the AST id from the unoptimized code in order to use it as a key into |
| 381 // the deoptimization input data found in the optimized code. | 388 // the deoptimization input data found in the optimized code. |
| 382 RecordBackEdge(stmt->OsrEntryId()); | 389 RecordBackEdge(stmt->OsrEntryId()); |
| 383 | 390 |
| 384 EmitProfilingCounterReset(); | 391 EmitProfilingCounterReset(); |
| 392 } |
| 393 __ bind(&ok); |
| 385 | 394 |
| 386 __ bind(&ok); | |
| 387 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 395 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
| 388 // Record a mapping of the OSR id to this PC. This is used if the OSR | 396 // Record a mapping of the OSR id to this PC. This is used if the OSR |
| 389 // entry becomes the target of a bailout. We don't expect it to be, but | 397 // entry becomes the target of a bailout. We don't expect it to be, but |
| 390 // we want it to work if it is. | 398 // we want it to work if it is. |
| 391 PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS); | 399 PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS); |
| 392 } | 400 } |
| 393 | 401 |
| 394 | 402 |
| 395 void FullCodeGenerator::EmitReturnSequence() { | 403 void FullCodeGenerator::EmitReturnSequence() { |
| 396 Comment cmnt(masm_, "[ Return sequence"); | 404 Comment cmnt(masm_, "[ Return sequence"); |
| (...skipping 4440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4837 *stack_depth = 0; | 4845 *stack_depth = 0; |
| 4838 *context_length = 0; | 4846 *context_length = 0; |
| 4839 return previous_; | 4847 return previous_; |
| 4840 } | 4848 } |
| 4841 | 4849 |
| 4842 | 4850 |
| 4843 #undef __ | 4851 #undef __ |
| 4844 | 4852 |
| 4845 | 4853 |
| 4846 static const byte kJnsInstruction = 0x79; | 4854 static const byte kJnsInstruction = 0x79; |
| 4847 static const byte kJnsOffset = kPointerSize == kInt64Size ? 0x1d : 0x14; | |
| 4848 static const byte kNopByteOne = 0x66; | 4855 static const byte kNopByteOne = 0x66; |
| 4849 static const byte kNopByteTwo = 0x90; | 4856 static const byte kNopByteTwo = 0x90; |
| 4850 #ifdef DEBUG | 4857 #ifdef DEBUG |
| 4851 static const byte kCallInstruction = 0xe8; | 4858 static const byte kCallInstruction = 0xe8; |
| 4852 #endif | 4859 #endif |
| 4853 | 4860 |
| 4854 | 4861 |
| 4855 void BackEdgeTable::PatchAt(Code* unoptimized_code, | 4862 void BackEdgeTable::PatchAt(Code* unoptimized_code, |
| 4856 Address pc, | 4863 Address pc, |
| 4857 BackEdgeState target_state, | 4864 BackEdgeState target_state, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4917 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4924 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4918 Assembler::target_address_at(call_target_address, | 4925 Assembler::target_address_at(call_target_address, |
| 4919 unoptimized_code)); | 4926 unoptimized_code)); |
| 4920 return OSR_AFTER_STACK_CHECK; | 4927 return OSR_AFTER_STACK_CHECK; |
| 4921 } | 4928 } |
| 4922 | 4929 |
| 4923 | 4930 |
| 4924 } } // namespace v8::internal | 4931 } } // namespace v8::internal |
| 4925 | 4932 |
| 4926 #endif // V8_TARGET_ARCH_X64 | 4933 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |