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/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 namespace { | 2117 namespace { |
2118 | 2118 |
2119 static const int kQuadWordSize = 16; | 2119 static const int kQuadWordSize = 16; |
2120 | 2120 |
2121 } // namespace | 2121 } // namespace |
2122 | 2122 |
2123 void CodeGenerator::FinishFrame(Frame* frame) { | 2123 void CodeGenerator::FinishFrame(Frame* frame) { |
2124 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2124 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
2125 | 2125 |
2126 const RegList saves_fp = descriptor->CalleeSavedFPRegisters(); | 2126 const RegList saves_fp = descriptor->CalleeSavedFPRegisters(); |
2127 if (saves_fp != 0) { | 2127 if (saves_fp != 0) { // Save callee-saved XMM registers. |
2128 frame->AlignSavedCalleeRegisterSlots(); | 2128 frame->AlignFrame(); |
2129 if (saves_fp != 0) { // Save callee-saved XMM registers. | 2129 uint32_t count = base::bits::CountPopulation32(saves_fp); |
2130 const uint32_t saves_fp_count = base::bits::CountPopulation32(saves_fp); | 2130 frame->AllocateSavedCalleeRegisterSlots(count * |
2131 frame->AllocateSavedCalleeRegisterSlots(saves_fp_count * | 2131 (kQuadWordSize / kPointerSize)); |
2132 (kQuadWordSize / kPointerSize)); | |
2133 } | |
2134 } | 2132 } |
2135 const RegList saves = descriptor->CalleeSavedRegisters(); | 2133 const RegList saves = descriptor->CalleeSavedRegisters(); |
2136 if (saves != 0) { // Save callee-saved registers. | 2134 if (saves != 0) { // Save callee-saved registers. |
2137 int count = 0; | 2135 uint32_t count = base::bits::CountPopulation32(saves); |
2138 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { | |
2139 if (((1 << i) & saves)) { | |
2140 ++count; | |
2141 } | |
2142 } | |
2143 frame->AllocateSavedCalleeRegisterSlots(count); | 2136 frame->AllocateSavedCalleeRegisterSlots(count); |
2144 } | 2137 } |
2145 } | 2138 } |
2146 | 2139 |
2147 void CodeGenerator::AssembleConstructFrame() { | 2140 void CodeGenerator::AssembleConstructFrame() { |
2148 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2141 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
2149 if (frame_access_state()->has_frame()) { | 2142 if (frame_access_state()->has_frame()) { |
2150 if (descriptor->IsCFunctionCall()) { | 2143 if (descriptor->IsCFunctionCall()) { |
2151 __ pushq(rbp); | 2144 __ pushq(rbp); |
2152 __ movq(rbp, rsp); | 2145 __ movq(rbp, rsp); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2453 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2461 __ Nop(padding_size); | 2454 __ Nop(padding_size); |
2462 } | 2455 } |
2463 } | 2456 } |
2464 | 2457 |
2465 #undef __ | 2458 #undef __ |
2466 | 2459 |
2467 } // namespace compiler | 2460 } // namespace compiler |
2468 } // namespace internal | 2461 } // namespace internal |
2469 } // namespace v8 | 2462 } // namespace v8 |
OLD | NEW |