OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/disasm.h" | 10 #include "src/disasm.h" |
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1547 // | 1547 // |
1548 | 1548 |
1549 CHECK(compiled_code_->is_hydrogen_stub()); | 1549 CHECK(compiled_code_->is_hydrogen_stub()); |
1550 int major_key = compiled_code_->major_key(); | 1550 int major_key = compiled_code_->major_key(); |
1551 CodeStubInterfaceDescriptor* descriptor = | 1551 CodeStubInterfaceDescriptor* descriptor = |
1552 isolate_->code_stub_interface_descriptor(major_key); | 1552 isolate_->code_stub_interface_descriptor(major_key); |
1553 | 1553 |
1554 // The output frame must have room for all pushed register parameters | 1554 // The output frame must have room for all pushed register parameters |
1555 // and the standard stack frame slots. Include space for an argument | 1555 // and the standard stack frame slots. Include space for an argument |
1556 // object to the callee and optionally the space to pass the argument | 1556 // object to the callee and optionally the space to pass the argument |
1557 // object to the stub failure handler. | 1557 // object to the stub failure handler. The descriptor's first register |
1558 CHECK_GE(descriptor->register_param_count(), 0); | 1558 // parameter is the context register, which we deal with separately. |
1559 int height_in_bytes = kPointerSize * descriptor->register_param_count() + | 1559 int param_count = descriptor->register_param_count() - 1; |
danno
2014/07/16 13:19:59
Use GetEnvironmentParameterLength(), then comment
mvstanton
2014/07/17 09:04:05
Done.
| |
1560 sizeof(Arguments) + kPointerSize; | 1560 CHECK_GE(param_count, 0); |
1561 | |
1562 int height_in_bytes = kPointerSize * param_count + sizeof(Arguments) + | |
1563 kPointerSize; | |
1561 int fixed_frame_size = StandardFrameConstants::kFixedFrameSize; | 1564 int fixed_frame_size = StandardFrameConstants::kFixedFrameSize; |
1562 int input_frame_size = input_->GetFrameSize(); | 1565 int input_frame_size = input_->GetFrameSize(); |
1563 int output_frame_size = height_in_bytes + fixed_frame_size; | 1566 int output_frame_size = height_in_bytes + fixed_frame_size; |
1564 if (trace_scope_ != NULL) { | 1567 if (trace_scope_ != NULL) { |
1565 PrintF(trace_scope_->file(), | 1568 PrintF(trace_scope_->file(), |
1566 " translating %s => StubFailureTrampolineStub, height=%d\n", | 1569 " translating %s => StubFailureTrampolineStub, height=%d\n", |
1567 CodeStub::MajorName(static_cast<CodeStub::Major>(major_key), false), | 1570 CodeStub::MajorName(static_cast<CodeStub::Major>(major_key), false), |
1568 height_in_bytes); | 1571 height_in_bytes); |
1569 } | 1572 } |
1570 | 1573 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1692 output_frame->SetFrameSlot(output_frame_offset, value); | 1695 output_frame->SetFrameSlot(output_frame_offset, value); |
1693 if (trace_scope_ != NULL) { | 1696 if (trace_scope_ != NULL) { |
1694 PrintF(trace_scope_->file(), | 1697 PrintF(trace_scope_->file(), |
1695 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1698 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1696 V8PRIxPTR " ; args*\n", | 1699 V8PRIxPTR " ; args*\n", |
1697 top_address + output_frame_offset, output_frame_offset, value); | 1700 top_address + output_frame_offset, output_frame_offset, value); |
1698 } | 1701 } |
1699 | 1702 |
1700 // Copy the register parameters to the failure frame. | 1703 // Copy the register parameters to the failure frame. |
1701 int arguments_length_offset = -1; | 1704 int arguments_length_offset = -1; |
1702 for (int i = 0; i < descriptor->register_param_count(); ++i) { | 1705 for (int i = 0; i < param_count; ++i) { |
1703 output_frame_offset -= kPointerSize; | 1706 output_frame_offset -= kPointerSize; |
1704 DoTranslateCommand(iterator, 0, output_frame_offset); | 1707 DoTranslateCommand(iterator, 0, output_frame_offset); |
1705 | 1708 |
1706 if (!arg_count_known && descriptor->IsParameterCountRegister(i)) { | 1709 // In the frame we only have descriptor->ParameterRegisters [1..param_count] |
1710 // because we don't include the context register. Adjust our index into | |
1711 // the descriptor parameter array accordingly. | |
danno
2014/07/16 13:19:59
Why not move this up to the loop iteration? e.g.
mvstanton
2014/07/17 09:04:05
Well, I would have to make the terminating conditi
| |
1712 if (!arg_count_known && descriptor->IsParameterCountRegister(i + 1)) { | |
1707 arguments_length_offset = output_frame_offset; | 1713 arguments_length_offset = output_frame_offset; |
1708 } | 1714 } |
1709 } | 1715 } |
1710 | 1716 |
1711 CHECK_EQ(output_frame_offset, 0); | 1717 CHECK_EQ(output_frame_offset, 0); |
1712 | 1718 |
1713 if (!arg_count_known) { | 1719 if (!arg_count_known) { |
1714 CHECK_GE(arguments_length_offset, 0); | 1720 CHECK_GE(arguments_length_offset, 0); |
1715 // We know it's a smi because 1) the code stub guarantees the stack | 1721 // We know it's a smi because 1) the code stub guarantees the stack |
1716 // parameter count is in smi range, and 2) the DoTranslateCommand in the | 1722 // parameter count is in smi range, and 2) the DoTranslateCommand in the |
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3585 } | 3591 } |
3586 | 3592 |
3587 | 3593 |
3588 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3594 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
3589 v->VisitPointer(BitCast<Object**>(&function_)); | 3595 v->VisitPointer(BitCast<Object**>(&function_)); |
3590 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3596 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
3591 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3597 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
3592 } | 3598 } |
3593 | 3599 |
3594 } } // namespace v8::internal | 3600 } } // namespace v8::internal |
OLD | NEW |