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 5714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5725 __ and_(ecx, edi); | 5725 __ and_(ecx, edi); |
5726 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0); | 5726 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0); |
5727 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); | 5727 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); |
5728 __ test(ecx, Immediate(kStringEncodingMask)); | 5728 __ test(ecx, Immediate(kStringEncodingMask)); |
5729 __ j(zero, &non_ascii); | 5729 __ j(zero, &non_ascii); |
5730 __ bind(&ascii_data); | 5730 __ bind(&ascii_data); |
5731 // Allocate an ASCII cons string. | 5731 // Allocate an ASCII cons string. |
5732 __ AllocateAsciiConsString(ecx, edi, no_reg, &call_runtime); | 5732 __ AllocateAsciiConsString(ecx, edi, no_reg, &call_runtime); |
5733 __ bind(&allocated); | 5733 __ bind(&allocated); |
5734 // Fill the fields of the cons string. | 5734 // Fill the fields of the cons string. |
5735 if (FLAG_debug_code) __ AbortIfNotSmi(ebx); | 5735 __ AssertSmi(ebx); |
5736 __ mov(FieldOperand(ecx, ConsString::kLengthOffset), ebx); | 5736 __ mov(FieldOperand(ecx, ConsString::kLengthOffset), ebx); |
5737 __ mov(FieldOperand(ecx, ConsString::kHashFieldOffset), | 5737 __ mov(FieldOperand(ecx, ConsString::kHashFieldOffset), |
5738 Immediate(String::kEmptyHashField)); | 5738 Immediate(String::kEmptyHashField)); |
5739 __ mov(FieldOperand(ecx, ConsString::kFirstOffset), eax); | 5739 __ mov(FieldOperand(ecx, ConsString::kFirstOffset), eax); |
5740 __ mov(FieldOperand(ecx, ConsString::kSecondOffset), edx); | 5740 __ mov(FieldOperand(ecx, ConsString::kSecondOffset), edx); |
5741 __ mov(eax, ecx); | 5741 __ mov(eax, ecx); |
5742 __ IncrementCounter(counters->string_add_native(), 1); | 5742 __ IncrementCounter(counters->string_add_native(), 1); |
5743 __ ret(2 * kPointerSize); | 5743 __ ret(2 * kPointerSize); |
5744 __ bind(&non_ascii); | 5744 __ bind(&non_ascii); |
5745 // At least one of the strings is two-byte. Check whether it happens | 5745 // At least one of the strings is two-byte. Check whether it happens |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6974 Label* done, | 6974 Label* done, |
6975 Register elements, | 6975 Register elements, |
6976 Register name, | 6976 Register name, |
6977 Register r0, | 6977 Register r0, |
6978 Register r1) { | 6978 Register r1) { |
6979 ASSERT(!elements.is(r0)); | 6979 ASSERT(!elements.is(r0)); |
6980 ASSERT(!elements.is(r1)); | 6980 ASSERT(!elements.is(r1)); |
6981 ASSERT(!name.is(r0)); | 6981 ASSERT(!name.is(r0)); |
6982 ASSERT(!name.is(r1)); | 6982 ASSERT(!name.is(r1)); |
6983 | 6983 |
6984 // Assert that name contains a string. | 6984 __ AssertString(name); |
6985 if (FLAG_debug_code) __ AbortIfNotString(name); | |
6986 | 6985 |
6987 __ mov(r1, FieldOperand(elements, kCapacityOffset)); | 6986 __ mov(r1, FieldOperand(elements, kCapacityOffset)); |
6988 __ shr(r1, kSmiTagSize); // convert smi to int | 6987 __ shr(r1, kSmiTagSize); // convert smi to int |
6989 __ dec(r1); | 6988 __ dec(r1); |
6990 | 6989 |
6991 // Generate an unrolled loop that performs a few probes before | 6990 // Generate an unrolled loop that performs a few probes before |
6992 // giving up. Measurements done on Gmail indicate that 2 probes | 6991 // giving up. Measurements done on Gmail indicate that 2 probes |
6993 // cover ~93% of loads from dictionaries. | 6992 // cover ~93% of loads from dictionaries. |
6994 for (int i = 0; i < kInlinedProbes; i++) { | 6993 for (int i = 0; i < kInlinedProbes; i++) { |
6995 // Compute the masked index: (hash + i + i * i) & mask. | 6994 // Compute the masked index: (hash + i + i * i) & mask. |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7528 // Restore ecx. | 7527 // Restore ecx. |
7529 __ pop(ecx); | 7528 __ pop(ecx); |
7530 __ ret(0); | 7529 __ ret(0); |
7531 } | 7530 } |
7532 | 7531 |
7533 #undef __ | 7532 #undef __ |
7534 | 7533 |
7535 } } // namespace v8::internal | 7534 } } // namespace v8::internal |
7536 | 7535 |
7537 #endif // V8_TARGET_ARCH_IA32 | 7536 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |