| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 8288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8299 __ j(above, &string_add_runtime); | 8299 __ j(above, &string_add_runtime); |
| 8300 | 8300 |
| 8301 // If result is not supposed to be flat allocate a cons string object. If both | 8301 // If result is not supposed to be flat allocate a cons string object. If both |
| 8302 // strings are ascii the result is an ascii cons string. | 8302 // strings are ascii the result is an ascii cons string. |
| 8303 Label non_ascii, allocated; | 8303 Label non_ascii, allocated; |
| 8304 __ mov(edi, FieldOperand(eax, HeapObject::kMapOffset)); | 8304 __ mov(edi, FieldOperand(eax, HeapObject::kMapOffset)); |
| 8305 __ movzx_b(ecx, FieldOperand(edi, Map::kInstanceTypeOffset)); | 8305 __ movzx_b(ecx, FieldOperand(edi, Map::kInstanceTypeOffset)); |
| 8306 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); | 8306 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); |
| 8307 __ movzx_b(edi, FieldOperand(edi, Map::kInstanceTypeOffset)); | 8307 __ movzx_b(edi, FieldOperand(edi, Map::kInstanceTypeOffset)); |
| 8308 __ and_(ecx, Operand(edi)); | 8308 __ and_(ecx, Operand(edi)); |
| 8309 ASSERT(kStringEncodingMask == kAsciiStringTag); |
| 8309 __ test(ecx, Immediate(kAsciiStringTag)); | 8310 __ test(ecx, Immediate(kAsciiStringTag)); |
| 8310 __ j(zero, &non_ascii); | 8311 __ j(zero, &non_ascii); |
| 8311 // Allocate an acsii cons string. | 8312 // Allocate an acsii cons string. |
| 8312 __ AllocateAsciiConsString(ecx, edi, no_reg, &string_add_runtime); | 8313 __ AllocateAsciiConsString(ecx, edi, no_reg, &string_add_runtime); |
| 8313 __ bind(&allocated); | 8314 __ bind(&allocated); |
| 8314 // Fill the fields of the cons string. | 8315 // Fill the fields of the cons string. |
| 8315 __ mov(FieldOperand(ecx, ConsString::kLengthOffset), ebx); | 8316 __ mov(FieldOperand(ecx, ConsString::kLengthOffset), ebx); |
| 8316 __ mov(FieldOperand(ecx, ConsString::kHashFieldOffset), | 8317 __ mov(FieldOperand(ecx, ConsString::kHashFieldOffset), |
| 8317 Immediate(String::kEmptyHashField)); | 8318 Immediate(String::kEmptyHashField)); |
| 8318 __ mov(FieldOperand(ecx, ConsString::kFirstOffset), eax); | 8319 __ mov(FieldOperand(ecx, ConsString::kFirstOffset), eax); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 8341 __ and_(ecx, kStringRepresentationMask); | 8342 __ and_(ecx, kStringRepresentationMask); |
| 8342 __ cmp(ecx, kExternalStringTag); | 8343 __ cmp(ecx, kExternalStringTag); |
| 8343 __ j(equal, &string_add_runtime); | 8344 __ j(equal, &string_add_runtime); |
| 8344 // Now check if both strings are ascii strings. | 8345 // Now check if both strings are ascii strings. |
| 8345 // eax: first string | 8346 // eax: first string |
| 8346 // ebx: length of resulting flat string | 8347 // ebx: length of resulting flat string |
| 8347 // edx: second string | 8348 // edx: second string |
| 8348 Label non_ascii_string_add_flat_result; | 8349 Label non_ascii_string_add_flat_result; |
| 8349 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); | 8350 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); |
| 8350 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); | 8351 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); |
| 8351 ASSERT(kAsciiStringTag != 0); | 8352 ASSERT(kStringEncodingMask == kAsciiStringTag); |
| 8352 __ test(ecx, Immediate(kAsciiStringTag)); | 8353 __ test(ecx, Immediate(kAsciiStringTag)); |
| 8353 __ j(zero, &non_ascii_string_add_flat_result); | 8354 __ j(zero, &non_ascii_string_add_flat_result); |
| 8354 __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset)); | 8355 __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset)); |
| 8355 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); | 8356 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); |
| 8356 __ test(ecx, Immediate(kAsciiStringTag)); | 8357 __ test(ecx, Immediate(kAsciiStringTag)); |
| 8357 __ j(zero, &string_add_runtime); | 8358 __ j(zero, &string_add_runtime); |
| 8358 // Both strings are ascii strings. As they are short they are both flat. | 8359 // Both strings are ascii strings. As they are short they are both flat. |
| 8359 __ AllocateAsciiString(eax, ebx, ecx, edx, edi, &string_add_runtime); | 8360 __ AllocateAsciiString(eax, ebx, ecx, edx, edi, &string_add_runtime); |
| 8360 // eax: result string | 8361 // eax: result string |
| 8361 __ mov(ecx, eax); | 8362 __ mov(ecx, eax); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8449 __ add(Operand(dest), Immediate(2)); | 8450 __ add(Operand(dest), Immediate(2)); |
| 8450 } | 8451 } |
| 8451 __ sub(Operand(count), Immediate(1)); | 8452 __ sub(Operand(count), Immediate(1)); |
| 8452 __ j(not_zero, &loop); | 8453 __ j(not_zero, &loop); |
| 8453 } | 8454 } |
| 8454 | 8455 |
| 8455 | 8456 |
| 8456 #undef __ | 8457 #undef __ |
| 8457 | 8458 |
| 8458 } } // namespace v8::internal | 8459 } } // namespace v8::internal |
| OLD | NEW |