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 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 // --{ mov esp, ebp }----------------------------------------------------------- | 1446 // --{ mov esp, ebp }----------------------------------------------------------- |
1447 // | FP | RET | args | caller frame | | 1447 // | FP | RET | args | caller frame | |
1448 // ^ esp,ebp | 1448 // ^ esp,ebp |
1449 | 1449 |
1450 // --{ pop ebp }---------------------------------------------------------------- | 1450 // --{ pop ebp }---------------------------------------------------------------- |
1451 // | RET | args | caller frame | | 1451 // | RET | args | caller frame | |
1452 // ^ esp ^ ebp | 1452 // ^ esp ^ ebp |
1453 | 1453 |
1454 | 1454 |
1455 void CodeGenerator::AssemblePrologue() { | 1455 void CodeGenerator::AssemblePrologue() { |
1456 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1456 const CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1457 if (descriptor->IsCFunctionCall()) { | 1457 if (descriptor->IsCFunctionCall()) { |
1458 // Assemble a prologue similar the to cdecl calling convention. | 1458 // Assemble a prologue similar the to cdecl calling convention. |
1459 __ push(ebp); | 1459 __ push(ebp); |
1460 __ mov(ebp, esp); | 1460 __ mov(ebp, esp); |
1461 } else if (descriptor->IsJSFunctionCall()) { | 1461 } else if (descriptor->IsJSFunctionCall()) { |
1462 // TODO(turbofan): this prologue is redundant with OSR, but still needed for | 1462 // TODO(turbofan): this prologue is redundant with OSR, but still needed for |
1463 // code aging. | 1463 // code aging. |
1464 __ Prologue(this->info()->GeneratePreagedPrologue()); | 1464 __ Prologue(this->info()->GeneratePreagedPrologue()); |
1465 } else if (frame()->needs_frame()) { | 1465 } else if (frame()->needs_frame()) { |
1466 __ StubPrologue(); | 1466 __ StubPrologue(); |
(...skipping 28 matching lines...) Expand all Loading... |
1495 if (!((1 << i) & saves)) continue; | 1495 if (!((1 << i) & saves)) continue; |
1496 __ push(Register::from_code(i)); | 1496 __ push(Register::from_code(i)); |
1497 ++pushed; | 1497 ++pushed; |
1498 } | 1498 } |
1499 frame()->AllocateSavedCalleeRegisterSlots(pushed); | 1499 frame()->AllocateSavedCalleeRegisterSlots(pushed); |
1500 } | 1500 } |
1501 } | 1501 } |
1502 | 1502 |
1503 | 1503 |
1504 void CodeGenerator::AssembleReturn() { | 1504 void CodeGenerator::AssembleReturn() { |
1505 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1505 const CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1506 | 1506 |
1507 const RegList saves = descriptor->CalleeSavedRegisters(); | 1507 const RegList saves = descriptor->CalleeSavedRegisters(); |
1508 // Restore registers. | 1508 // Restore registers. |
1509 if (saves != 0) { | 1509 if (saves != 0) { |
1510 for (int i = 0; i < Register::kNumRegisters; i++) { | 1510 for (int i = 0; i < Register::kNumRegisters; i++) { |
1511 if (!((1 << i) & saves)) continue; | 1511 if (!((1 << i) & saves)) continue; |
1512 __ pop(Register::from_code(i)); | 1512 __ pop(Register::from_code(i)); |
1513 } | 1513 } |
1514 } | 1514 } |
1515 | 1515 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 1734 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
1735 __ Nop(padding_size); | 1735 __ Nop(padding_size); |
1736 } | 1736 } |
1737 } | 1737 } |
1738 | 1738 |
1739 #undef __ | 1739 #undef __ |
1740 | 1740 |
1741 } // namespace compiler | 1741 } // namespace compiler |
1742 } // namespace internal | 1742 } // namespace internal |
1743 } // namespace v8 | 1743 } // namespace v8 |
OLD | NEW |