OLD | NEW |
---|---|
1 | 1 |
2 // Copyright 2012 the V8 project authors. All rights reserved. | 2 // 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 | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 7 |
8 #if V8_TARGET_ARCH_MIPS | 8 #if V8_TARGET_ARCH_MIPS |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 6039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6050 li(result_reg, Operand(255)); | 6050 li(result_reg, Operand(255)); |
6051 Branch(&done); | 6051 Branch(&done); |
6052 | 6052 |
6053 // In 0-255 range, round and truncate. | 6053 // In 0-255 range, round and truncate. |
6054 bind(&in_bounds); | 6054 bind(&in_bounds); |
6055 cvt_w_d(temp_double_reg, input_reg); | 6055 cvt_w_d(temp_double_reg, input_reg); |
6056 mfc1(result_reg, temp_double_reg); | 6056 mfc1(result_reg, temp_double_reg); |
6057 bind(&done); | 6057 bind(&done); |
6058 } | 6058 } |
6059 | 6059 |
6060 | 6060 void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg, |
6061 void MacroAssembler::TestJSArrayForAllocationMemento( | 6061 Register scratch_reg, |
6062 Register receiver_reg, | 6062 Label* no_memento_found) { |
6063 Register scratch_reg, | 6063 Label map_check; |
6064 Label* no_memento_found, | |
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 sits on the page boundary as no memento can follow | |
6070 // and we cannot touch the memory following it. | |
6071 Addu(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); | |
6072 Xor(scratch_reg, scratch_reg, Operand(receiver_reg)); | |
6073 Branch(no_memento_found, gt, scratch_reg, Operand(Page::kPageSize)); | |
6074 // Bail out if the object is not in new space. | |
6075 Addu(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); | |
6076 JumpIfNotInNewSpace(scratch_reg, scratch_reg, no_memento_found); | |
6077 // If the object is in new space, we need to check whether it is on the same | |
6078 // page as the current top. | |
6079 Addu(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); | |
6080 Xor(scratch_reg, scratch_reg, Operand(new_space_allocation_top)); | |
6081 And(scratch_reg, scratch_reg, Operand(~Page::kPageAlignmentMask)); | |
6082 Branch(&map_check, ne, scratch_reg, Operand(zero_reg)); | |
6083 // Otherwise, we have to check whether we are still below top, to ensure that | |
6084 // we are not checking against a stale memento. | |
6085 Addu(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); | |
6074 li(at, Operand(new_space_allocation_top)); | 6086 li(at, Operand(new_space_allocation_top)); |
6075 lw(at, MemOperand(at)); | 6087 lw(at, MemOperand(at)); |
6076 Branch(no_memento_found, gt, scratch_reg, Operand(at)); | 6088 Branch(no_memento_found, gt, scratch_reg, Operand(at)); |
6077 lw(scratch_reg, MemOperand(scratch_reg, -AllocationMemento::kSize)); | 6089 bind(&map_check); |
6078 if (allocation_memento_present) { | 6090 lw(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset)); |
Michael Lippautz
2016/03/30 15:22:22
The way this was implemented was slightly better (
| |
6079 Branch(allocation_memento_present, cond, scratch_reg, | 6091 Branch(no_memento_found, ne, scratch_reg, |
6080 Operand(isolate()->factory()->allocation_memento_map())); | 6092 Operand(isolate()->factory()->allocation_memento_map())); |
6081 } | |
6082 } | 6093 } |
6083 | 6094 |
6084 | 6095 |
6085 Register GetRegisterThatIsNotOneOf(Register reg1, | 6096 Register GetRegisterThatIsNotOneOf(Register reg1, |
6086 Register reg2, | 6097 Register reg2, |
6087 Register reg3, | 6098 Register reg3, |
6088 Register reg4, | 6099 Register reg4, |
6089 Register reg5, | 6100 Register reg5, |
6090 Register reg6) { | 6101 Register reg6) { |
6091 RegList regs = 0; | 6102 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); | 6240 if (mag.shift > 0) sra(result, result, mag.shift); |
6230 srl(at, dividend, 31); | 6241 srl(at, dividend, 31); |
6231 Addu(result, result, Operand(at)); | 6242 Addu(result, result, Operand(at)); |
6232 } | 6243 } |
6233 | 6244 |
6234 | 6245 |
6235 } // namespace internal | 6246 } // namespace internal |
6236 } // namespace v8 | 6247 } // namespace v8 |
6237 | 6248 |
6238 #endif // V8_TARGET_ARCH_MIPS | 6249 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |