| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); | 433 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); |
| 434 intptr_t pc_value = reinterpret_cast<intptr_t>( | 434 intptr_t pc_value = reinterpret_cast<intptr_t>( |
| 435 adaptor_trampoline->instruction_start() + | 435 adaptor_trampoline->instruction_start() + |
| 436 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); | 436 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); |
| 437 output_frame->SetPc(pc_value); | 437 output_frame->SetPc(pc_value); |
| 438 } | 438 } |
| 439 | 439 |
| 440 | 440 |
| 441 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, | 441 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, |
| 442 int frame_index) { | 442 int frame_index) { |
| 443 Builtins* builtins = isolate_->builtins(); |
| 444 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); |
| 443 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); | 445 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); |
| 444 unsigned height = iterator->Next(); | 446 unsigned height = iterator->Next(); |
| 445 unsigned height_in_bytes = height * kPointerSize; | 447 unsigned height_in_bytes = height * kPointerSize; |
| 446 if (FLAG_trace_deopt) { | 448 if (FLAG_trace_deopt) { |
| 447 PrintF(" translating construct stub => height=%d\n", height_in_bytes); | 449 PrintF(" translating construct stub => height=%d\n", height_in_bytes); |
| 448 } | 450 } |
| 449 | 451 |
| 450 unsigned fixed_frame_size = 6 * kPointerSize; | 452 unsigned fixed_frame_size = 7 * kPointerSize; |
| 451 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 453 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 452 | 454 |
| 453 // Allocate and store the output frame description. | 455 // Allocate and store the output frame description. |
| 454 FrameDescription* output_frame = | 456 FrameDescription* output_frame = |
| 455 new(output_frame_size) FrameDescription(output_frame_size, function); | 457 new(output_frame_size) FrameDescription(output_frame_size, function); |
| 456 output_frame->SetFrameType(StackFrame::CONSTRUCT); | 458 output_frame->SetFrameType(StackFrame::CONSTRUCT); |
| 457 | 459 |
| 458 // Construct stub can not be topmost or bottommost. | 460 // Construct stub can not be topmost or bottommost. |
| 459 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); | 461 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); |
| 460 ASSERT(output_[frame_index] == NULL); | 462 ASSERT(output_[frame_index] == NULL); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 // A marker value is used in place of the function. | 511 // A marker value is used in place of the function. |
| 510 output_offset -= kPointerSize; | 512 output_offset -= kPointerSize; |
| 511 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); | 513 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); |
| 512 output_frame->SetFrameSlot(output_offset, value); | 514 output_frame->SetFrameSlot(output_offset, value); |
| 513 if (FLAG_trace_deopt) { | 515 if (FLAG_trace_deopt) { |
| 514 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 516 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
| 515 V8PRIxPTR " ; function (construct sentinel)\n", | 517 V8PRIxPTR " ; function (construct sentinel)\n", |
| 516 top_address + output_offset, output_offset, value); | 518 top_address + output_offset, output_offset, value); |
| 517 } | 519 } |
| 518 | 520 |
| 521 // The output frame reflects a JSConstructStubGeneric frame. |
| 522 output_offset -= kPointerSize; |
| 523 value = reinterpret_cast<intptr_t>(construct_stub); |
| 524 output_frame->SetFrameSlot(output_offset, value); |
| 525 if (FLAG_trace_deopt) { |
| 526 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
| 527 V8PRIxPTR " ; code object\n", |
| 528 top_address + output_offset, output_offset, value); |
| 529 } |
| 530 |
| 519 // Number of incoming arguments. | 531 // Number of incoming arguments. |
| 520 output_offset -= kPointerSize; | 532 output_offset -= kPointerSize; |
| 521 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); | 533 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); |
| 522 output_frame->SetFrameSlot(output_offset, value); | 534 output_frame->SetFrameSlot(output_offset, value); |
| 523 if (FLAG_trace_deopt) { | 535 if (FLAG_trace_deopt) { |
| 524 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 536 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
| 525 V8PRIxPTR " ; argc (%d)\n", | 537 V8PRIxPTR " ; argc (%d)\n", |
| 526 top_address + output_offset, output_offset, value, height - 1); | 538 top_address + output_offset, output_offset, value, height - 1); |
| 527 } | 539 } |
| 528 | 540 |
| 529 // The newly allocated object was passed as receiver in the artificial | 541 // The newly allocated object was passed as receiver in the artificial |
| 530 // constructor stub environment created by HEnvironment::CopyForInlining(). | 542 // constructor stub environment created by HEnvironment::CopyForInlining(). |
| 531 output_offset -= kPointerSize; | 543 output_offset -= kPointerSize; |
| 532 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); | 544 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); |
| 533 output_frame->SetFrameSlot(output_offset, value); | 545 output_frame->SetFrameSlot(output_offset, value); |
| 534 if (FLAG_trace_deopt) { | 546 if (FLAG_trace_deopt) { |
| 535 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 547 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
| 536 V8PRIxPTR " ; allocated receiver\n", | 548 V8PRIxPTR " ; allocated receiver\n", |
| 537 top_address + output_offset, output_offset, value); | 549 top_address + output_offset, output_offset, value); |
| 538 } | 550 } |
| 539 | 551 |
| 540 ASSERT(0 == output_offset); | 552 ASSERT(0 == output_offset); |
| 541 | 553 |
| 542 Builtins* builtins = isolate_->builtins(); | |
| 543 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); | |
| 544 intptr_t pc = reinterpret_cast<intptr_t>( | 554 intptr_t pc = reinterpret_cast<intptr_t>( |
| 545 construct_stub->instruction_start() + | 555 construct_stub->instruction_start() + |
| 546 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); | 556 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); |
| 547 output_frame->SetPc(pc); | 557 output_frame->SetPc(pc); |
| 548 } | 558 } |
| 549 | 559 |
| 550 | 560 |
| 551 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, | 561 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, |
| 552 int frame_index) { | 562 int frame_index) { |
| 553 int node_id = iterator->Next(); | 563 int node_id = iterator->Next(); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 } | 957 } |
| 948 __ bind(&done); | 958 __ bind(&done); |
| 949 } | 959 } |
| 950 | 960 |
| 951 #undef __ | 961 #undef __ |
| 952 | 962 |
| 953 | 963 |
| 954 } } // namespace v8::internal | 964 } } // namespace v8::internal |
| 955 | 965 |
| 956 #endif // V8_TARGET_ARCH_X64 | 966 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |