OLD | NEW |
1 | |
2 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
3 // 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 |
4 // found in the LICENSE file. | 3 // found in the LICENSE file. |
5 | 4 |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 6 |
8 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
9 | 8 |
10 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
11 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 6038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6050 li(result_reg, Operand(255)); | 6049 li(result_reg, Operand(255)); |
6051 Branch(&done); | 6050 Branch(&done); |
6052 | 6051 |
6053 // In 0-255 range, round and truncate. | 6052 // In 0-255 range, round and truncate. |
6054 bind(&in_bounds); | 6053 bind(&in_bounds); |
6055 cvt_w_d(temp_double_reg, input_reg); | 6054 cvt_w_d(temp_double_reg, input_reg); |
6056 mfc1(result_reg, temp_double_reg); | 6055 mfc1(result_reg, temp_double_reg); |
6057 bind(&done); | 6056 bind(&done); |
6058 } | 6057 } |
6059 | 6058 |
6060 | 6059 void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg, |
6061 void MacroAssembler::TestJSArrayForAllocationMemento( | 6060 Register scratch_reg, |
6062 Register receiver_reg, | 6061 Label* no_memento_found) { |
6063 Register scratch_reg, | 6062 Label map_check; |
6064 Label* no_memento_found, | 6063 Label top_check; |
6065 Condition cond, | |
6066 Label* allocation_memento_present) { | |
6067 ExternalReference new_space_start = | |
6068 ExternalReference::new_space_start(isolate()); | |
6069 ExternalReference new_space_allocation_top = | 6064 ExternalReference new_space_allocation_top = |
6070 ExternalReference::new_space_allocation_top_address(isolate()); | 6065 ExternalReference::new_space_allocation_top_address(isolate()); |
6071 Addu(scratch_reg, receiver_reg, | 6066 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; |
6072 Operand(JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag)); | 6067 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; |
6073 Branch(no_memento_found, lt, scratch_reg, Operand(new_space_start)); | 6068 |
| 6069 // Bail out if the object is not in new space. |
| 6070 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found); |
| 6071 // If the object is in new space, we need to check whether it is on the same |
| 6072 // page as the current top. |
| 6073 Addu(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
| 6074 Xor(scratch_reg, scratch_reg, Operand(new_space_allocation_top)); |
| 6075 And(scratch_reg, scratch_reg, Operand(~Page::kPageAlignmentMask)); |
| 6076 Branch(&top_check, eq, scratch_reg, Operand(zero_reg)); |
| 6077 // The object is on a different page than allocation top. Bail out if the |
| 6078 // object sits on the page boundary as no memento can follow and we cannot |
| 6079 // touch the memory following it. |
| 6080 Addu(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
| 6081 Xor(scratch_reg, scratch_reg, Operand(receiver_reg)); |
| 6082 And(scratch_reg, scratch_reg, Operand(~Page::kPageAlignmentMask)); |
| 6083 Branch(no_memento_found, ne, scratch_reg, Operand(zero_reg)); |
| 6084 // Continue with the actual map check. |
| 6085 jmp(&map_check); |
| 6086 // If top is on the same page as the current object, we need to check whether |
| 6087 // we are below top. |
| 6088 bind(&top_check); |
| 6089 Addu(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
6074 li(at, Operand(new_space_allocation_top)); | 6090 li(at, Operand(new_space_allocation_top)); |
6075 lw(at, MemOperand(at)); | 6091 lw(at, MemOperand(at)); |
6076 Branch(no_memento_found, gt, scratch_reg, Operand(at)); | 6092 Branch(no_memento_found, gt, scratch_reg, Operand(at)); |
6077 lw(scratch_reg, MemOperand(scratch_reg, -AllocationMemento::kSize)); | 6093 // Memento map check. |
6078 if (allocation_memento_present) { | 6094 bind(&map_check); |
6079 Branch(allocation_memento_present, cond, scratch_reg, | 6095 lw(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset)); |
6080 Operand(isolate()->factory()->allocation_memento_map())); | 6096 Branch(no_memento_found, ne, scratch_reg, |
6081 } | 6097 Operand(isolate()->factory()->allocation_memento_map())); |
6082 } | 6098 } |
6083 | 6099 |
6084 | 6100 |
6085 Register GetRegisterThatIsNotOneOf(Register reg1, | 6101 Register GetRegisterThatIsNotOneOf(Register reg1, |
6086 Register reg2, | 6102 Register reg2, |
6087 Register reg3, | 6103 Register reg3, |
6088 Register reg4, | 6104 Register reg4, |
6089 Register reg5, | 6105 Register reg5, |
6090 Register reg6) { | 6106 Register reg6) { |
6091 RegList regs = 0; | 6107 RegList regs = 0; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6229 if (mag.shift > 0) sra(result, result, mag.shift); | 6245 if (mag.shift > 0) sra(result, result, mag.shift); |
6230 srl(at, dividend, 31); | 6246 srl(at, dividend, 31); |
6231 Addu(result, result, Operand(at)); | 6247 Addu(result, result, Operand(at)); |
6232 } | 6248 } |
6233 | 6249 |
6234 | 6250 |
6235 } // namespace internal | 6251 } // namespace internal |
6236 } // namespace v8 | 6252 } // namespace v8 |
6237 | 6253 |
6238 #endif // V8_TARGET_ARCH_MIPS | 6254 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |