| 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 3888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3899 int token_offset = | 3899 int token_offset = |
| 3900 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize; | 3900 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize; |
| 3901 movq(scratch, FieldOperand(scratch, token_offset)); | 3901 movq(scratch, FieldOperand(scratch, token_offset)); |
| 3902 cmpq(scratch, FieldOperand(kScratchRegister, token_offset)); | 3902 cmpq(scratch, FieldOperand(kScratchRegister, token_offset)); |
| 3903 j(not_equal, miss); | 3903 j(not_equal, miss); |
| 3904 | 3904 |
| 3905 bind(&same_contexts); | 3905 bind(&same_contexts); |
| 3906 } | 3906 } |
| 3907 | 3907 |
| 3908 | 3908 |
| 3909 // Compute the hash code from the untagged key. This must be kept in sync with |
| 3910 // ComputeIntegerHash in utils.h and KeyedLoadGenericElementStub in |
| 3911 // code-stub-hydrogen.cc |
| 3909 void MacroAssembler::GetNumberHash(Register r0, Register scratch) { | 3912 void MacroAssembler::GetNumberHash(Register r0, Register scratch) { |
| 3910 // First of all we assign the hash seed to scratch. | 3913 // First of all we assign the hash seed to scratch. |
| 3911 LoadRoot(scratch, Heap::kHashSeedRootIndex); | 3914 LoadRoot(scratch, Heap::kHashSeedRootIndex); |
| 3912 SmiToInteger32(scratch, scratch); | 3915 SmiToInteger32(scratch, scratch); |
| 3913 | 3916 |
| 3914 // Xor original key with a seed. | 3917 // Xor original key with a seed. |
| 3915 xorl(r0, scratch); | 3918 xorl(r0, scratch); |
| 3916 | 3919 |
| 3917 // Compute the hash code from the untagged key. This must be kept in sync | 3920 // Compute the hash code from the untagged key. This must be kept in sync |
| 3918 // with ComputeIntegerHash in utils.h. | 3921 // with ComputeIntegerHash in utils.h. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3973 Label done; | 3976 Label done; |
| 3974 | 3977 |
| 3975 GetNumberHash(r0, r1); | 3978 GetNumberHash(r0, r1); |
| 3976 | 3979 |
| 3977 // Compute capacity mask. | 3980 // Compute capacity mask. |
| 3978 SmiToInteger32(r1, FieldOperand(elements, | 3981 SmiToInteger32(r1, FieldOperand(elements, |
| 3979 SeededNumberDictionary::kCapacityOffset)); | 3982 SeededNumberDictionary::kCapacityOffset)); |
| 3980 decl(r1); | 3983 decl(r1); |
| 3981 | 3984 |
| 3982 // Generate an unrolled loop that performs a few probes before giving up. | 3985 // Generate an unrolled loop that performs a few probes before giving up. |
| 3983 const int kProbes = 4; | 3986 for (int i = 0; i < kNumberDictionaryProbes; i++) { |
| 3984 for (int i = 0; i < kProbes; i++) { | |
| 3985 // Use r2 for index calculations and keep the hash intact in r0. | 3987 // Use r2 for index calculations and keep the hash intact in r0. |
| 3986 movq(r2, r0); | 3988 movq(r2, r0); |
| 3987 // Compute the masked index: (hash + i + i * i) & mask. | 3989 // Compute the masked index: (hash + i + i * i) & mask. |
| 3988 if (i > 0) { | 3990 if (i > 0) { |
| 3989 addl(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i))); | 3991 addl(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i))); |
| 3990 } | 3992 } |
| 3991 and_(r2, r1); | 3993 and_(r2, r1); |
| 3992 | 3994 |
| 3993 // Scale the index by multiplying by the entry size. | 3995 // Scale the index by multiplying by the entry size. |
| 3994 ASSERT(SeededNumberDictionary::kEntrySize == 3); | 3996 ASSERT(SeededNumberDictionary::kEntrySize == 3); |
| 3995 lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 | 3997 lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 |
| 3996 | 3998 |
| 3997 // Check if the key matches. | 3999 // Check if the key matches. |
| 3998 cmpq(key, FieldOperand(elements, | 4000 cmpq(key, FieldOperand(elements, |
| 3999 r2, | 4001 r2, |
| 4000 times_pointer_size, | 4002 times_pointer_size, |
| 4001 SeededNumberDictionary::kElementsStartOffset)); | 4003 SeededNumberDictionary::kElementsStartOffset)); |
| 4002 if (i != (kProbes - 1)) { | 4004 if (i != (kNumberDictionaryProbes - 1)) { |
| 4003 j(equal, &done); | 4005 j(equal, &done); |
| 4004 } else { | 4006 } else { |
| 4005 j(not_equal, miss); | 4007 j(not_equal, miss); |
| 4006 } | 4008 } |
| 4007 } | 4009 } |
| 4008 | 4010 |
| 4009 bind(&done); | 4011 bind(&done); |
| 4010 // Check that the value is a normal propety. | 4012 // Check that the value is a normal propety. |
| 4011 const int kDetailsOffset = | 4013 const int kDetailsOffset = |
| 4012 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; | 4014 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4074 | 4076 |
| 4075 | 4077 |
| 4076 void MacroAssembler::Allocate(int object_size, | 4078 void MacroAssembler::Allocate(int object_size, |
| 4077 Register result, | 4079 Register result, |
| 4078 Register result_end, | 4080 Register result_end, |
| 4079 Register scratch, | 4081 Register scratch, |
| 4080 Label* gc_required, | 4082 Label* gc_required, |
| 4081 AllocationFlags flags) { | 4083 AllocationFlags flags) { |
| 4082 ASSERT((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0); | 4084 ASSERT((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0); |
| 4083 ASSERT(object_size <= Page::kMaxNonCodeHeapObjectSize); | 4085 ASSERT(object_size <= Page::kMaxNonCodeHeapObjectSize); |
| 4084 if (!FLAG_inline_new || | 4086 if (!FLAG_inline_new) { |
| 4085 // TODO(mstarzinger): Implement more efficiently by keeping then | |
| 4086 // bump-pointer allocation area empty instead of recompiling code. | |
| 4087 isolate()->heap_profiler()->is_tracking_allocations()) { | |
| 4088 if (emit_debug_code()) { | 4087 if (emit_debug_code()) { |
| 4089 // Trash the registers to simulate an allocation failure. | 4088 // Trash the registers to simulate an allocation failure. |
| 4090 movl(result, Immediate(0x7091)); | 4089 movl(result, Immediate(0x7091)); |
| 4091 if (result_end.is_valid()) { | 4090 if (result_end.is_valid()) { |
| 4092 movl(result_end, Immediate(0x7191)); | 4091 movl(result_end, Immediate(0x7191)); |
| 4093 } | 4092 } |
| 4094 if (scratch.is_valid()) { | 4093 if (scratch.is_valid()) { |
| 4095 movl(scratch, Immediate(0x7291)); | 4094 movl(scratch, Immediate(0x7291)); |
| 4096 } | 4095 } |
| 4097 } | 4096 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4157 } | 4156 } |
| 4158 | 4157 |
| 4159 | 4158 |
| 4160 void MacroAssembler::Allocate(Register object_size, | 4159 void MacroAssembler::Allocate(Register object_size, |
| 4161 Register result, | 4160 Register result, |
| 4162 Register result_end, | 4161 Register result_end, |
| 4163 Register scratch, | 4162 Register scratch, |
| 4164 Label* gc_required, | 4163 Label* gc_required, |
| 4165 AllocationFlags flags) { | 4164 AllocationFlags flags) { |
| 4166 ASSERT((flags & SIZE_IN_WORDS) == 0); | 4165 ASSERT((flags & SIZE_IN_WORDS) == 0); |
| 4167 if (!FLAG_inline_new || | 4166 if (!FLAG_inline_new) { |
| 4168 // TODO(mstarzinger): Implement more efficiently by keeping then | |
| 4169 // bump-pointer allocation area empty instead of recompiling code. | |
| 4170 isolate()->heap_profiler()->is_tracking_allocations()) { | |
| 4171 if (emit_debug_code()) { | 4167 if (emit_debug_code()) { |
| 4172 // Trash the registers to simulate an allocation failure. | 4168 // Trash the registers to simulate an allocation failure. |
| 4173 movl(result, Immediate(0x7091)); | 4169 movl(result, Immediate(0x7091)); |
| 4174 movl(result_end, Immediate(0x7191)); | 4170 movl(result_end, Immediate(0x7191)); |
| 4175 if (scratch.is_valid()) { | 4171 if (scratch.is_valid()) { |
| 4176 movl(scratch, Immediate(0x7291)); | 4172 movl(scratch, Immediate(0x7291)); |
| 4177 } | 4173 } |
| 4178 // object_size is left unchanged by this function. | 4174 // object_size is left unchanged by this function. |
| 4179 } | 4175 } |
| 4180 jmp(gc_required); | 4176 jmp(gc_required); |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4989 j(equal, found); | 4985 j(equal, found); |
| 4990 movq(current, FieldOperand(current, Map::kPrototypeOffset)); | 4986 movq(current, FieldOperand(current, Map::kPrototypeOffset)); |
| 4991 CompareRoot(current, Heap::kNullValueRootIndex); | 4987 CompareRoot(current, Heap::kNullValueRootIndex); |
| 4992 j(not_equal, &loop_again); | 4988 j(not_equal, &loop_again); |
| 4993 } | 4989 } |
| 4994 | 4990 |
| 4995 | 4991 |
| 4996 } } // namespace v8::internal | 4992 } } // namespace v8::internal |
| 4997 | 4993 |
| 4998 #endif // V8_TARGET_ARCH_X64 | 4994 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |