OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 5054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5065 movp(scratch1, FieldOperand(current, Map::kBitField2Offset)); | 5065 movp(scratch1, FieldOperand(current, Map::kBitField2Offset)); |
5066 DecodeField<Map::ElementsKindBits>(scratch1); | 5066 DecodeField<Map::ElementsKindBits>(scratch1); |
5067 cmpp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 5067 cmpp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
5068 j(equal, found); | 5068 j(equal, found); |
5069 movp(current, FieldOperand(current, Map::kPrototypeOffset)); | 5069 movp(current, FieldOperand(current, Map::kPrototypeOffset)); |
5070 CompareRoot(current, Heap::kNullValueRootIndex); | 5070 CompareRoot(current, Heap::kNullValueRootIndex); |
5071 j(not_equal, &loop_again); | 5071 j(not_equal, &loop_again); |
5072 } | 5072 } |
5073 | 5073 |
5074 | 5074 |
| 5075 void MacroAssembler::AdaptUnoptimizedFrameForOsrEntry( |
| 5076 int unoptimized_slot_count, Register scratch0, Register scratch1) { |
| 5077 if (unoptimized_slot_count > 0) { |
| 5078 Label loop_start; |
| 5079 leap(scratch0, |
| 5080 Operand(rbp, JavaScriptFrameConstants::kFeedbackVectorOffset)); |
| 5081 bind(&loop_start); |
| 5082 movp(scratch1, Operand(scratch0, -1 * kPointerSize)); |
| 5083 movp(Operand(scratch0, 0), scratch1); |
| 5084 subp(scratch0, Immediate(kPointerSize)); |
| 5085 cmpp(scratch0, rsp); |
| 5086 j(greater, &loop_start); |
| 5087 } |
| 5088 addp(rsp, Immediate(kPointerSize)); |
| 5089 } |
| 5090 |
| 5091 |
5075 void MacroAssembler::TruncatingDiv(Register dividend, int32_t divisor) { | 5092 void MacroAssembler::TruncatingDiv(Register dividend, int32_t divisor) { |
5076 DCHECK(!dividend.is(rax)); | 5093 DCHECK(!dividend.is(rax)); |
5077 DCHECK(!dividend.is(rdx)); | 5094 DCHECK(!dividend.is(rdx)); |
5078 base::MagicNumbersForDivision<uint32_t> mag = | 5095 base::MagicNumbersForDivision<uint32_t> mag = |
5079 base::SignedDivisionByConstant(static_cast<uint32_t>(divisor)); | 5096 base::SignedDivisionByConstant(static_cast<uint32_t>(divisor)); |
5080 movl(rax, Immediate(mag.multiplier)); | 5097 movl(rax, Immediate(mag.multiplier)); |
5081 imull(dividend); | 5098 imull(dividend); |
5082 bool neg = (mag.multiplier & (static_cast<uint32_t>(1) << 31)) != 0; | 5099 bool neg = (mag.multiplier & (static_cast<uint32_t>(1) << 31)) != 0; |
5083 if (divisor > 0 && neg) addl(rdx, dividend); | 5100 if (divisor > 0 && neg) addl(rdx, dividend); |
5084 if (divisor < 0 && !neg && mag.multiplier > 0) subl(rdx, dividend); | 5101 if (divisor < 0 && !neg && mag.multiplier > 0) subl(rdx, dividend); |
5085 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); | 5102 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); |
5086 movl(rax, dividend); | 5103 movl(rax, dividend); |
5087 shrl(rax, Immediate(31)); | 5104 shrl(rax, Immediate(31)); |
5088 addl(rdx, rax); | 5105 addl(rdx, rax); |
5089 } | 5106 } |
5090 | 5107 |
5091 | 5108 |
5092 } } // namespace v8::internal | 5109 } } // namespace v8::internal |
5093 | 5110 |
5094 #endif // V8_TARGET_ARCH_X64 | 5111 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |