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

Side by Side Diff: src/mips/code-stubs-mips.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 6473 matching lines...) Expand 10 before | Expand all | Expand 10 after
6484 // in a little endian mode). 6484 // in a little endian mode).
6485 __ li(t2, Operand(2)); 6485 __ li(t2, Operand(2));
6486 __ AllocateAsciiString(v0, t2, t0, t1, t5, &call_runtime); 6486 __ AllocateAsciiString(v0, t2, t0, t1, t5, &call_runtime);
6487 __ sh(a2, FieldMemOperand(v0, SeqAsciiString::kHeaderSize)); 6487 __ sh(a2, FieldMemOperand(v0, SeqAsciiString::kHeaderSize));
6488 __ IncrementCounter(counters->string_add_native(), 1, a2, a3); 6488 __ IncrementCounter(counters->string_add_native(), 1, a2, a3);
6489 __ DropAndRet(2); 6489 __ DropAndRet(2);
6490 6490
6491 __ bind(&longer_than_two); 6491 __ bind(&longer_than_two);
6492 // Check if resulting string will be flat. 6492 // Check if resulting string will be flat.
6493 __ Branch(&string_add_flat_result, lt, t2, 6493 __ Branch(&string_add_flat_result, lt, t2,
6494 Operand(String::kMinNonFlatLength)); 6494 Operand(ConsString::kMinLength));
6495 // Handle exceptionally long strings in the runtime system. 6495 // Handle exceptionally long strings in the runtime system.
6496 STATIC_ASSERT((String::kMaxLength & 0x80000000) == 0); 6496 STATIC_ASSERT((String::kMaxLength & 0x80000000) == 0);
6497 ASSERT(IsPowerOf2(String::kMaxLength + 1)); 6497 ASSERT(IsPowerOf2(String::kMaxLength + 1));
6498 // kMaxLength + 1 is representable as shifted literal, kMaxLength is not. 6498 // kMaxLength + 1 is representable as shifted literal, kMaxLength is not.
6499 __ Branch(&call_runtime, hs, t2, Operand(String::kMaxLength + 1)); 6499 __ Branch(&call_runtime, hs, t2, Operand(String::kMaxLength + 1));
6500 6500
6501 // If result is not supposed to be flat, allocate a cons string object. 6501 // If result is not supposed to be flat, allocate a cons string object.
6502 // If both strings are ASCII the result is an ASCII cons string. 6502 // If both strings are ASCII the result is an ASCII cons string.
6503 if (flags_ != NO_STRING_ADD_FLAGS) { 6503 if (flags_ != NO_STRING_ADD_FLAGS) {
6504 __ lw(t0, FieldMemOperand(a0, HeapObject::kMapOffset)); 6504 __ lw(t0, FieldMemOperand(a0, HeapObject::kMapOffset));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
6536 __ xor_(t0, t0, t1); 6536 __ xor_(t0, t0, t1);
6537 STATIC_ASSERT(kAsciiStringTag != 0 && kAsciiDataHintTag != 0); 6537 STATIC_ASSERT(kAsciiStringTag != 0 && kAsciiDataHintTag != 0);
6538 __ And(t0, t0, Operand(kAsciiStringTag | kAsciiDataHintTag)); 6538 __ And(t0, t0, Operand(kAsciiStringTag | kAsciiDataHintTag));
6539 __ Branch(&ascii_data, eq, t0, Operand(kAsciiStringTag | kAsciiDataHintTag)); 6539 __ Branch(&ascii_data, eq, t0, Operand(kAsciiStringTag | kAsciiDataHintTag));
6540 6540
6541 // Allocate a two byte cons string. 6541 // Allocate a two byte cons string.
6542 __ AllocateTwoByteConsString(v0, t2, t0, t1, &call_runtime); 6542 __ AllocateTwoByteConsString(v0, t2, t0, t1, &call_runtime);
6543 __ Branch(&allocated); 6543 __ Branch(&allocated);
6544 6544
6545 // We cannot encounter sliced strings or cons strings here since: 6545 // We cannot encounter sliced strings or cons strings here since:
6546 STATIC_ASSERT(SlicedString::kMinLength >= String::kMinNonFlatLength); 6546 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength);
6547 // Handle creating a flat result from either external or sequential strings. 6547 // Handle creating a flat result from either external or sequential strings.
6548 // Locate the first characters' locations. 6548 // Locate the first characters' locations.
6549 // a0: first string 6549 // a0: first string
6550 // a1: second string 6550 // a1: second string
6551 // a2: length of first string 6551 // a2: length of first string
6552 // a3: length of second string 6552 // a3: length of second string
6553 // t0: first string instance type (if flags_ == NO_STRING_ADD_FLAGS) 6553 // t0: first string instance type (if flags_ == NO_STRING_ADD_FLAGS)
6554 // t1: second string instance type (if flags_ == NO_STRING_ADD_FLAGS) 6554 // t1: second string instance type (if flags_ == NO_STRING_ADD_FLAGS)
6555 // t2: sum of lengths. 6555 // t2: sum of lengths.
6556 Label first_prepared, second_prepared; 6556 Label first_prepared, second_prepared;
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
7581 __ Ret(USE_DELAY_SLOT); 7581 __ Ret(USE_DELAY_SLOT);
7582 __ mov(v0, a0); 7582 __ mov(v0, a0);
7583 } 7583 }
7584 7584
7585 7585
7586 #undef __ 7586 #undef __
7587 7587
7588 } } // namespace v8::internal 7588 } } // namespace v8::internal
7589 7589
7590 #endif // V8_TARGET_ARCH_MIPS 7590 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/objects.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698