Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 9231017: Recursion limit for one-char string replace and retire String::kMinNonFlatLength. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 5567 matching lines...) Expand 10 before | Expand all | Expand 10 after
5578 // Pack both characters in ebx. 5578 // Pack both characters in ebx.
5579 __ shl(ecx, kBitsPerByte); 5579 __ shl(ecx, kBitsPerByte);
5580 __ or_(ebx, ecx); 5580 __ or_(ebx, ecx);
5581 // Set the characters in the new string. 5581 // Set the characters in the new string.
5582 __ mov_w(FieldOperand(eax, SeqAsciiString::kHeaderSize), ebx); 5582 __ mov_w(FieldOperand(eax, SeqAsciiString::kHeaderSize), ebx);
5583 __ IncrementCounter(counters->string_add_native(), 1); 5583 __ IncrementCounter(counters->string_add_native(), 1);
5584 __ ret(2 * kPointerSize); 5584 __ ret(2 * kPointerSize);
5585 5585
5586 __ bind(&longer_than_two); 5586 __ bind(&longer_than_two);
5587 // Check if resulting string will be flat. 5587 // Check if resulting string will be flat.
5588 __ cmp(ebx, Immediate(Smi::FromInt(String::kMinNonFlatLength))); 5588 __ cmp(ebx, Immediate(Smi::FromInt(ConsString::kMinLength)));
5589 __ j(below, &string_add_flat_result); 5589 __ j(below, &string_add_flat_result);
5590 5590
5591 // If result is not supposed to be flat allocate a cons string object. If both 5591 // If result is not supposed to be flat allocate a cons string object. If both
5592 // strings are ASCII the result is an ASCII cons string. 5592 // strings are ASCII the result is an ASCII cons string.
5593 Label non_ascii, allocated, ascii_data; 5593 Label non_ascii, allocated, ascii_data;
5594 __ mov(edi, FieldOperand(eax, HeapObject::kMapOffset)); 5594 __ mov(edi, FieldOperand(eax, HeapObject::kMapOffset));
5595 __ movzx_b(ecx, FieldOperand(edi, Map::kInstanceTypeOffset)); 5595 __ movzx_b(ecx, FieldOperand(edi, Map::kInstanceTypeOffset));
5596 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); 5596 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset));
5597 __ movzx_b(edi, FieldOperand(edi, Map::kInstanceTypeOffset)); 5597 __ movzx_b(edi, FieldOperand(edi, Map::kInstanceTypeOffset));
5598 __ and_(ecx, edi); 5598 __ and_(ecx, edi);
(...skipping 27 matching lines...) Expand all
5626 __ xor_(edi, ecx); 5626 __ xor_(edi, ecx);
5627 STATIC_ASSERT(kAsciiStringTag != 0 && kAsciiDataHintTag != 0); 5627 STATIC_ASSERT(kAsciiStringTag != 0 && kAsciiDataHintTag != 0);
5628 __ and_(edi, kAsciiStringTag | kAsciiDataHintTag); 5628 __ and_(edi, kAsciiStringTag | kAsciiDataHintTag);
5629 __ cmp(edi, kAsciiStringTag | kAsciiDataHintTag); 5629 __ cmp(edi, kAsciiStringTag | kAsciiDataHintTag);
5630 __ j(equal, &ascii_data); 5630 __ j(equal, &ascii_data);
5631 // Allocate a two byte cons string. 5631 // Allocate a two byte cons string.
5632 __ AllocateTwoByteConsString(ecx, edi, no_reg, &call_runtime); 5632 __ AllocateTwoByteConsString(ecx, edi, no_reg, &call_runtime);
5633 __ jmp(&allocated); 5633 __ jmp(&allocated);
5634 5634
5635 // We cannot encounter sliced strings or cons strings here since: 5635 // We cannot encounter sliced strings or cons strings here since:
5636 STATIC_ASSERT(SlicedString::kMinLength >= String::kMinNonFlatLength); 5636 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength);
5637 // Handle creating a flat result from either external or sequential strings. 5637 // Handle creating a flat result from either external or sequential strings.
5638 // Locate the first characters' locations. 5638 // Locate the first characters' locations.
5639 // eax: first string 5639 // eax: first string
5640 // ebx: length of resulting flat string as a smi 5640 // ebx: length of resulting flat string as a smi
5641 // edx: second string 5641 // edx: second string
5642 Label first_prepared, second_prepared; 5642 Label first_prepared, second_prepared;
5643 Label first_is_sequential, second_is_sequential; 5643 Label first_is_sequential, second_is_sequential;
5644 __ bind(&string_add_flat_result); 5644 __ bind(&string_add_flat_result);
5645 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); 5645 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset));
5646 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); 5646 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
7345 false); 7345 false);
7346 __ pop(edx); 7346 __ pop(edx);
7347 __ ret(0); 7347 __ ret(0);
7348 } 7348 }
7349 7349
7350 #undef __ 7350 #undef __
7351 7351
7352 } } // namespace v8::internal 7352 } } // namespace v8::internal
7353 7353
7354 #endif // V8_TARGET_ARCH_IA32 7354 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698