| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // significantly by Google Inc. | 34 // significantly by Google Inc. |
| 35 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 35 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 36 | 36 |
| 37 #include "v8.h" | 37 #include "v8.h" |
| 38 | 38 |
| 39 #include "assembler-arm-inl.h" | 39 #include "assembler-arm-inl.h" |
| 40 #include "serialize.h" | 40 #include "serialize.h" |
| 41 | 41 |
| 42 namespace v8 { namespace internal { | 42 namespace v8 { namespace internal { |
| 43 | 43 |
| 44 DEFINE_bool(debug_code, false, | |
| 45 "generate extra code (comments, assertions) for debugging"); | |
| 46 | |
| 47 | |
| 48 // ----------------------------------------------------------------------------- | 44 // ----------------------------------------------------------------------------- |
| 49 // Implementation of Register and CRegister | 45 // Implementation of Register and CRegister |
| 50 | 46 |
| 51 Register no_reg = { -1 }; | 47 Register no_reg = { -1 }; |
| 52 | 48 |
| 53 Register r0 = { 0 }; | 49 Register r0 = { 0 }; |
| 54 Register r1 = { 1 }; | 50 Register r1 = { 1 }; |
| 55 Register r2 = { 2 }; | 51 Register r2 = { 2 }; |
| 56 Register r3 = { 3 }; | 52 Register r3 = { 3 }; |
| 57 Register r4 = { 4 }; | 53 Register r4 = { 4 }; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 RdMask = 15 << 12, // in str instruction | 261 RdMask = 15 << 12, // in str instruction |
| 266 CondMask = 15 << 28, | 262 CondMask = 15 << 28, |
| 267 OpCodeMask = 15 << 21, // in data-processing instructions | 263 OpCodeMask = 15 << 21, // in data-processing instructions |
| 268 Imm24Mask = (1 << 24) - 1, | 264 Imm24Mask = (1 << 24) - 1, |
| 269 Off12Mask = (1 << 12) - 1, | 265 Off12Mask = (1 << 12) - 1, |
| 270 // Reserved condition | 266 // Reserved condition |
| 271 nv = 15 << 28 | 267 nv = 15 << 28 |
| 272 }; | 268 }; |
| 273 | 269 |
| 274 | 270 |
| 275 DEFINE_bool(push_pop_elimination, true, | |
| 276 "eliminate redundant push/pops in assembly code"); | |
| 277 DEFINE_bool(print_push_pop_elimination, false, | |
| 278 "print elimination of redundant push/pops in assembly code"); | |
| 279 | |
| 280 // add(sp, sp, 4) instruction (aka Pop()) | 271 // add(sp, sp, 4) instruction (aka Pop()) |
| 281 static const Instr kPopInstruction = | 272 static const Instr kPopInstruction = |
| 282 al | 4 * B21 | 4 | LeaveCC | I | sp.code() * B16 | sp.code() * B12; | 273 al | 4 * B21 | 4 | LeaveCC | I | sp.code() * B16 | sp.code() * B12; |
| 283 // str(r, MemOperand(sp, 4, NegPreIndex), al) instruction (aka push(r)) | 274 // str(r, MemOperand(sp, 4, NegPreIndex), al) instruction (aka push(r)) |
| 284 // register r is not encoded. | 275 // register r is not encoded. |
| 285 static const Instr kPushRegPattern = | 276 static const Instr kPushRegPattern = |
| 286 al | B26 | 4 | NegPreIndex | sp.code() * B16; | 277 al | B26 | 4 | NegPreIndex | sp.code() * B16; |
| 287 // ldr(r, MemOperand(sp, 4, PostIndex), al) instruction (aka pop(r)) | 278 // ldr(r, MemOperand(sp, 4, PostIndex), al) instruction (aka pop(r)) |
| 288 // register r is not encoded. | 279 // register r is not encoded. |
| 289 static const Instr kPopRegPattern = | 280 static const Instr kPopRegPattern = |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 } | 453 } |
| 463 PrintF("%s%s\n", b, c); | 454 PrintF("%s%s\n", b, c); |
| 464 next(&l); | 455 next(&l); |
| 465 } | 456 } |
| 466 } else { | 457 } else { |
| 467 PrintF("label in inconsistent state (pos = %d)\n", L->pos_); | 458 PrintF("label in inconsistent state (pos = %d)\n", L->pos_); |
| 468 } | 459 } |
| 469 } | 460 } |
| 470 | 461 |
| 471 | 462 |
| 472 DEFINE_bool(eliminate_jumps, true, "eliminate jumps to jumps in assembly code"); | |
| 473 DEFINE_bool(print_jump_elimination, false, | |
| 474 "print elimination of jumps to jumps in assembly code"); | |
| 475 | |
| 476 void Assembler::bind_to(Label* L, int pos) { | 463 void Assembler::bind_to(Label* L, int pos) { |
| 477 ASSERT(0 <= pos && pos <= pc_offset()); // must have a valid binding position | 464 ASSERT(0 <= pos && pos <= pc_offset()); // must have a valid binding position |
| 478 while (L->is_linked()) { | 465 while (L->is_linked()) { |
| 479 int fixup_pos = L->pos(); | 466 int fixup_pos = L->pos(); |
| 480 next(L); // call next before overwriting link with target at fixup_pos | 467 next(L); // call next before overwriting link with target at fixup_pos |
| 481 target_at_put(fixup_pos, pos); | 468 target_at_put(fixup_pos, pos); |
| 482 } | 469 } |
| 483 L->bind_to(pos); | 470 L->bind_to(pos); |
| 484 | 471 |
| 485 // do not eliminate jump instructions before the last bound position | 472 // do not eliminate jump instructions before the last bound position |
| (...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 bind(&after_pool); | 1546 bind(&after_pool); |
| 1560 } | 1547 } |
| 1561 | 1548 |
| 1562 // Since a constant pool was just emitted, move the check offset forward by | 1549 // Since a constant pool was just emitted, move the check offset forward by |
| 1563 // the standard interval. | 1550 // the standard interval. |
| 1564 next_buffer_check_ = pc_offset() + kCheckConstInterval; | 1551 next_buffer_check_ = pc_offset() + kCheckConstInterval; |
| 1565 } | 1552 } |
| 1566 | 1553 |
| 1567 | 1554 |
| 1568 } } // namespace v8::internal | 1555 } } // namespace v8::internal |
| OLD | NEW |