| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 15 matching lines...) Expand all Loading... |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #if V8_TARGET_ARCH_A64 | 30 #if V8_TARGET_ARCH_A64 |
| 31 | 31 |
| 32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
| 33 #include "codegen.h" | 33 #include "codegen.h" |
| 34 #include "cpu-profiler.h" | 34 #include "cpu-profiler.h" |
| 35 #include "debug.h" | 35 #include "debug.h" |
| 36 #include "isolate-inl.h" |
| 36 #include "runtime.h" | 37 #include "runtime.h" |
| 37 | 38 |
| 38 namespace v8 { | 39 namespace v8 { |
| 39 namespace internal { | 40 namespace internal { |
| 40 | 41 |
| 41 // Define a fake double underscore to use with the ASM_UNIMPLEMENTED macros. | 42 // Define a fake double underscore to use with the ASM_UNIMPLEMENTED macros. |
| 42 #define __ | 43 #define __ |
| 43 | 44 |
| 44 | 45 |
| 45 MacroAssembler::MacroAssembler(Isolate* arg_isolate, | 46 MacroAssembler::MacroAssembler(Isolate* arg_isolate, |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 // but if we keep it matching StackPointer, the simulator can detect memory | 625 // but if we keep it matching StackPointer, the simulator can detect memory |
| 625 // accesses in the now-free part of the stack. | 626 // accesses in the now-free part of the stack. |
| 626 Mov(csp, StackPointer()); | 627 Mov(csp, StackPointer()); |
| 627 } | 628 } |
| 628 } | 629 } |
| 629 | 630 |
| 630 | 631 |
| 631 void MacroAssembler::PushMultipleTimes(int count, Register src) { | 632 void MacroAssembler::PushMultipleTimes(int count, Register src) { |
| 632 int size = src.SizeInBytes(); | 633 int size = src.SizeInBytes(); |
| 633 | 634 |
| 635 // TODO(all): Use a loop when optimizing for size. |
| 636 TODO_UNIMPLEMENTED("PushMultipleTimes: Support --optimize-for-size."); |
| 637 |
| 634 PrepareForPush(count, size); | 638 PrepareForPush(count, size); |
| 635 // Push up to four registers at a time if possible because if the current | 639 // Push up to four registers at a time if possible because if the current |
| 636 // stack pointer is csp and the register size is 32, registers must be pushed | 640 // stack pointer is csp and the register size is 32, registers must be pushed |
| 637 // in blocks of four in order to maintain the 16-byte alignment for csp. | 641 // in blocks of four in order to maintain the 16-byte alignment for csp. |
| 638 while (count >= 4) { | 642 while (count >= 4) { |
| 639 PushHelper(4, size, src, src, src, src); | 643 PushHelper(4, size, src, src, src, src); |
| 640 count -= 4; | 644 count -= 4; |
| 641 } | 645 } |
| 642 if (count >= 2) { | 646 if (count >= 2) { |
| 643 PushHelper(2, size, src, src, NoReg, NoReg); | 647 PushHelper(2, size, src, src, NoReg, NoReg); |
| (...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2564 if (frame_mode == BUILD_STUB_FRAME) { | 2568 if (frame_mode == BUILD_STUB_FRAME) { |
| 2565 ASSERT(StackPointer().Is(jssp)); | 2569 ASSERT(StackPointer().Is(jssp)); |
| 2566 // TODO(jbramley): Does x1 contain a JSFunction here, or does it already | 2570 // TODO(jbramley): Does x1 contain a JSFunction here, or does it already |
| 2567 // have the special STUB smi? | 2571 // have the special STUB smi? |
| 2568 __ Mov(Tmp0(), Operand(Smi::FromInt(StackFrame::STUB))); | 2572 __ Mov(Tmp0(), Operand(Smi::FromInt(StackFrame::STUB))); |
| 2569 // Compiled stubs don't age, and so they don't need the predictable code | 2573 // Compiled stubs don't age, and so they don't need the predictable code |
| 2570 // ageing sequence. | 2574 // ageing sequence. |
| 2571 __ Push(lr, fp, cp, Tmp0()); | 2575 __ Push(lr, fp, cp, Tmp0()); |
| 2572 __ Add(fp, jssp, 2 * kPointerSize); | 2576 __ Add(fp, jssp, 2 * kPointerSize); |
| 2573 } else { | 2577 } else { |
| 2574 TODO_UNIMPLEMENTED("Prologue: Implement FLAG_optimize_for_size."); | 2578 TODO_UNIMPLEMENTED("Prologue: Support IsCodePreAgingActive()."); |
| 2575 __ EmitFrameSetupForCodeAgePatching(); | 2579 __ EmitFrameSetupForCodeAgePatching(); |
| 2576 } | 2580 } |
| 2577 } | 2581 } |
| 2578 | 2582 |
| 2579 | 2583 |
| 2580 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 2584 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
| 2581 ASSERT(jssp.Is(StackPointer())); | 2585 ASSERT(jssp.Is(StackPointer())); |
| 2582 Push(lr, fp, cp); | 2586 Push(lr, fp, cp); |
| 2583 Mov(Tmp1(), Operand(Smi::FromInt(type))); | 2587 Mov(Tmp1(), Operand(Smi::FromInt(type))); |
| 2584 Mov(Tmp0(), Operand(CodeObject())); | 2588 Mov(Tmp0(), Operand(CodeObject())); |
| (...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4063 | 4067 |
| 4064 void MacroAssembler::JumpIfBlack(Register object, | 4068 void MacroAssembler::JumpIfBlack(Register object, |
| 4065 Register scratch0, | 4069 Register scratch0, |
| 4066 Register scratch1, | 4070 Register scratch1, |
| 4067 Label* on_black) { | 4071 Label* on_black) { |
| 4068 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); | 4072 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); |
| 4069 HasColor(object, scratch0, scratch1, on_black, 1, 0); // kBlackBitPattern. | 4073 HasColor(object, scratch0, scratch1, on_black, 1, 0); // kBlackBitPattern. |
| 4070 } | 4074 } |
| 4071 | 4075 |
| 4072 | 4076 |
| 4077 void MacroAssembler::JumpIfDictionaryInPrototypeChain( |
| 4078 Register object, |
| 4079 Register scratch0, |
| 4080 Register scratch1, |
| 4081 Label* found) { |
| 4082 ASSERT(!AreAliased(object, scratch0, scratch1)); |
| 4083 Factory* factory = isolate()->factory(); |
| 4084 Register current = scratch0; |
| 4085 Label loop_again; |
| 4086 |
| 4087 // Scratch contains elements pointer. |
| 4088 Mov(current, object); |
| 4089 |
| 4090 // Loop based on the map going up the prototype chain. |
| 4091 Bind(&loop_again); |
| 4092 Ldr(current, FieldMemOperand(current, HeapObject::kMapOffset)); |
| 4093 Ldrb(scratch1, FieldMemOperand(current, Map::kBitField2Offset)); |
| 4094 Ubfx(scratch1, scratch1, Map::kElementsKindShift, Map::kElementsKindBitCount); |
| 4095 CompareAndBranch(scratch1, DICTIONARY_ELEMENTS, eq, found); |
| 4096 Ldr(current, FieldMemOperand(current, Map::kPrototypeOffset)); |
| 4097 CompareAndBranch(current, Operand(factory->null_value()), ne, &loop_again); |
| 4098 } |
| 4099 |
| 4100 |
| 4073 void MacroAssembler::GetRelocatedValueLocation(Register ldr_location, | 4101 void MacroAssembler::GetRelocatedValueLocation(Register ldr_location, |
| 4074 Register result) { | 4102 Register result) { |
| 4075 ASSERT(!result.Is(ldr_location)); | 4103 ASSERT(!result.Is(ldr_location)); |
| 4076 const uint32_t kLdrLitOffset_lsb = 5; | 4104 const uint32_t kLdrLitOffset_lsb = 5; |
| 4077 const uint32_t kLdrLitOffset_width = 19; | 4105 const uint32_t kLdrLitOffset_width = 19; |
| 4078 Ldr(result, MemOperand(ldr_location)); | 4106 Ldr(result, MemOperand(ldr_location)); |
| 4079 if (emit_debug_code()) { | 4107 if (emit_debug_code()) { |
| 4080 And(result, result, LoadLiteralFMask); | 4108 And(result, result, LoadLiteralFMask); |
| 4081 Cmp(result, LoadLiteralFixed); | 4109 Cmp(result, LoadLiteralFixed); |
| 4082 Check(eq, kTheInstructionToPatchShouldBeAnLdrLiteral); | 4110 Check(eq, kTheInstructionToPatchShouldBeAnLdrLiteral); |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4712 } | 4740 } |
| 4713 } | 4741 } |
| 4714 | 4742 |
| 4715 | 4743 |
| 4716 #undef __ | 4744 #undef __ |
| 4717 | 4745 |
| 4718 | 4746 |
| 4719 } } // namespace v8::internal | 4747 } } // namespace v8::internal |
| 4720 | 4748 |
| 4721 #endif // V8_TARGET_ARCH_A64 | 4749 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |