| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 sar(dst, Immediate(kSmiShift)); | 1151 sar(dst, Immediate(kSmiShift)); |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 | 1154 |
| 1155 void MacroAssembler::SmiToInteger64(Register dst, const Operand& src) { | 1155 void MacroAssembler::SmiToInteger64(Register dst, const Operand& src) { |
| 1156 movsxlq(dst, Operand(src, kSmiShift / kBitsPerByte)); | 1156 movsxlq(dst, Operand(src, kSmiShift / kBitsPerByte)); |
| 1157 } | 1157 } |
| 1158 | 1158 |
| 1159 | 1159 |
| 1160 void MacroAssembler::SmiTest(Register src) { | 1160 void MacroAssembler::SmiTest(Register src) { |
| 1161 AssertSmi(src); |
| 1161 testq(src, src); | 1162 testq(src, src); |
| 1162 } | 1163 } |
| 1163 | 1164 |
| 1164 | 1165 |
| 1165 void MacroAssembler::SmiCompare(Register smi1, Register smi2) { | 1166 void MacroAssembler::SmiCompare(Register smi1, Register smi2) { |
| 1166 AssertSmi(smi1); | 1167 AssertSmi(smi1); |
| 1167 AssertSmi(smi2); | 1168 AssertSmi(smi2); |
| 1168 cmpq(smi1, smi2); | 1169 cmpq(smi1, smi2); |
| 1169 } | 1170 } |
| 1170 | 1171 |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2245 // Load instance type for both strings. | 2246 // Load instance type for both strings. |
| 2246 movq(scratch1, FieldOperand(first_object, HeapObject::kMapOffset)); | 2247 movq(scratch1, FieldOperand(first_object, HeapObject::kMapOffset)); |
| 2247 movq(scratch2, FieldOperand(second_object, HeapObject::kMapOffset)); | 2248 movq(scratch2, FieldOperand(second_object, HeapObject::kMapOffset)); |
| 2248 movzxbl(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset)); | 2249 movzxbl(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset)); |
| 2249 movzxbl(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset)); | 2250 movzxbl(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset)); |
| 2250 | 2251 |
| 2251 // Check that both are flat ASCII strings. | 2252 // Check that both are flat ASCII strings. |
| 2252 ASSERT(kNotStringTag != 0); | 2253 ASSERT(kNotStringTag != 0); |
| 2253 const int kFlatAsciiStringMask = | 2254 const int kFlatAsciiStringMask = |
| 2254 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; | 2255 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; |
| 2255 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 2256 const int kFlatAsciiStringTag = |
| 2257 kStringTag | kOneByteStringTag | kSeqStringTag; |
| 2256 | 2258 |
| 2257 andl(scratch1, Immediate(kFlatAsciiStringMask)); | 2259 andl(scratch1, Immediate(kFlatAsciiStringMask)); |
| 2258 andl(scratch2, Immediate(kFlatAsciiStringMask)); | 2260 andl(scratch2, Immediate(kFlatAsciiStringMask)); |
| 2259 // Interleave the bits to check both scratch1 and scratch2 in one test. | 2261 // Interleave the bits to check both scratch1 and scratch2 in one test. |
| 2260 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); | 2262 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); |
| 2261 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); | 2263 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); |
| 2262 cmpl(scratch1, | 2264 cmpl(scratch1, |
| 2263 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3))); | 2265 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3))); |
| 2264 j(not_equal, on_fail, near_jump); | 2266 j(not_equal, on_fail, near_jump); |
| 2265 } | 2267 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2291 Label* on_fail, | 2293 Label* on_fail, |
| 2292 Label::Distance near_jump) { | 2294 Label::Distance near_jump) { |
| 2293 // Load instance type for both strings. | 2295 // Load instance type for both strings. |
| 2294 movq(scratch1, first_object_instance_type); | 2296 movq(scratch1, first_object_instance_type); |
| 2295 movq(scratch2, second_object_instance_type); | 2297 movq(scratch2, second_object_instance_type); |
| 2296 | 2298 |
| 2297 // Check that both are flat ASCII strings. | 2299 // Check that both are flat ASCII strings. |
| 2298 ASSERT(kNotStringTag != 0); | 2300 ASSERT(kNotStringTag != 0); |
| 2299 const int kFlatAsciiStringMask = | 2301 const int kFlatAsciiStringMask = |
| 2300 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; | 2302 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; |
| 2301 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 2303 const int kFlatAsciiStringTag = |
| 2304 kStringTag | kOneByteStringTag | kSeqStringTag; |
| 2302 | 2305 |
| 2303 andl(scratch1, Immediate(kFlatAsciiStringMask)); | 2306 andl(scratch1, Immediate(kFlatAsciiStringMask)); |
| 2304 andl(scratch2, Immediate(kFlatAsciiStringMask)); | 2307 andl(scratch2, Immediate(kFlatAsciiStringMask)); |
| 2305 // Interleave the bits to check both scratch1 and scratch2 in one test. | 2308 // Interleave the bits to check both scratch1 and scratch2 in one test. |
| 2306 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); | 2309 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); |
| 2307 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); | 2310 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); |
| 2308 cmpl(scratch1, | 2311 cmpl(scratch1, |
| 2309 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3))); | 2312 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3))); |
| 2310 j(not_equal, on_fail, near_jump); | 2313 j(not_equal, on_fail, near_jump); |
| 2311 } | 2314 } |
| 2312 | 2315 |
| 2313 | 2316 |
| 2314 template<class T> | 2317 template<class T> |
| 2315 static void JumpIfNotUniqueNameHelper(MacroAssembler* masm, | 2318 static void JumpIfNotUniqueNameHelper(MacroAssembler* masm, |
| 2316 T operand_or_register, | 2319 T operand_or_register, |
| 2317 Label* not_unique_name, | 2320 Label* not_unique_name, |
| 2318 Label::Distance distance) { | 2321 Label::Distance distance) { |
| 2319 STATIC_ASSERT(((SYMBOL_TYPE - 1) & kIsInternalizedMask) == kInternalizedTag); | 2322 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
| 2320 masm->cmpb(operand_or_register, Immediate(kInternalizedTag)); | 2323 Label succeed; |
| 2321 masm->j(less, not_unique_name, distance); | 2324 masm->testb(operand_or_register, |
| 2322 masm->cmpb(operand_or_register, Immediate(SYMBOL_TYPE)); | 2325 Immediate(kIsNotStringMask | kIsNotInternalizedMask)); |
| 2323 masm->j(greater, not_unique_name, distance); | 2326 masm->j(zero, &succeed, Label::kNear); |
| 2327 masm->cmpb(operand_or_register, Immediate(static_cast<uint8_t>(SYMBOL_TYPE))); |
| 2328 masm->j(not_equal, not_unique_name, distance); |
| 2329 |
| 2330 masm->bind(&succeed); |
| 2324 } | 2331 } |
| 2325 | 2332 |
| 2326 | 2333 |
| 2327 void MacroAssembler::JumpIfNotUniqueName(Operand operand, | 2334 void MacroAssembler::JumpIfNotUniqueName(Operand operand, |
| 2328 Label* not_unique_name, | 2335 Label* not_unique_name, |
| 2329 Label::Distance distance) { | 2336 Label::Distance distance) { |
| 2330 JumpIfNotUniqueNameHelper<Operand>(this, operand, not_unique_name, distance); | 2337 JumpIfNotUniqueNameHelper<Operand>(this, operand, not_unique_name, distance); |
| 2331 } | 2338 } |
| 2332 | 2339 |
| 2333 | 2340 |
| (...skipping 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4661 // object we've reached through the prototype chain. | 4668 // object we've reached through the prototype chain. |
| 4662 cmpq(empty_fixed_array_value, | 4669 cmpq(empty_fixed_array_value, |
| 4663 FieldOperand(rcx, JSObject::kElementsOffset)); | 4670 FieldOperand(rcx, JSObject::kElementsOffset)); |
| 4664 j(not_equal, call_runtime); | 4671 j(not_equal, call_runtime); |
| 4665 | 4672 |
| 4666 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4673 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
| 4667 cmpq(rcx, null_value); | 4674 cmpq(rcx, null_value); |
| 4668 j(not_equal, &next); | 4675 j(not_equal, &next); |
| 4669 } | 4676 } |
| 4670 | 4677 |
| 4671 void MacroAssembler::TestJSArrayForAllocationSiteInfo( | 4678 void MacroAssembler::TestJSArrayForAllocationMemento( |
| 4672 Register receiver_reg, | 4679 Register receiver_reg, |
| 4673 Register scratch_reg) { | 4680 Register scratch_reg) { |
| 4674 Label no_info_available; | 4681 Label no_memento_available; |
| 4675 ExternalReference new_space_start = | 4682 ExternalReference new_space_start = |
| 4676 ExternalReference::new_space_start(isolate()); | 4683 ExternalReference::new_space_start(isolate()); |
| 4677 ExternalReference new_space_allocation_top = | 4684 ExternalReference new_space_allocation_top = |
| 4678 ExternalReference::new_space_allocation_top_address(isolate()); | 4685 ExternalReference::new_space_allocation_top_address(isolate()); |
| 4679 | 4686 |
| 4680 lea(scratch_reg, Operand(receiver_reg, | 4687 lea(scratch_reg, Operand(receiver_reg, |
| 4681 JSArray::kSize + AllocationSiteInfo::kSize - kHeapObjectTag)); | 4688 JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag)); |
| 4682 movq(kScratchRegister, new_space_start); | 4689 movq(kScratchRegister, new_space_start); |
| 4683 cmpq(scratch_reg, kScratchRegister); | 4690 cmpq(scratch_reg, kScratchRegister); |
| 4684 j(less, &no_info_available); | 4691 j(less, &no_memento_available); |
| 4685 cmpq(scratch_reg, ExternalOperand(new_space_allocation_top)); | 4692 cmpq(scratch_reg, ExternalOperand(new_space_allocation_top)); |
| 4686 j(greater, &no_info_available); | 4693 j(greater, &no_memento_available); |
| 4687 CompareRoot(MemOperand(scratch_reg, -AllocationSiteInfo::kSize), | 4694 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize), |
| 4688 Heap::kAllocationSiteInfoMapRootIndex); | 4695 Heap::kAllocationMementoMapRootIndex); |
| 4689 bind(&no_info_available); | 4696 bind(&no_memento_available); |
| 4690 } | 4697 } |
| 4691 | 4698 |
| 4692 | 4699 |
| 4693 } } // namespace v8::internal | 4700 } } // namespace v8::internal |
| 4694 | 4701 |
| 4695 #endif // V8_TARGET_ARCH_X64 | 4702 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |