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

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 2223003: Fix: make string indexing work with Infinity. (Closed)
Patch Set: Created 10 years, 7 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
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 12637 matching lines...) Expand 10 before | Expand all | Expand 10 after
12648 // Index is not a smi. 12648 // Index is not a smi.
12649 __ bind(&index_not_smi_); 12649 __ bind(&index_not_smi_);
12650 // If index is a heap number, try converting it to an integer. 12650 // If index is a heap number, try converting it to an integer.
12651 __ CheckMap(index_, Factory::heap_number_map(), index_not_number_, true); 12651 __ CheckMap(index_, Factory::heap_number_map(), index_not_number_, true);
12652 call_helper.BeforeCall(masm); 12652 call_helper.BeforeCall(masm);
12653 __ push(object_); 12653 __ push(object_);
12654 __ push(index_); 12654 __ push(index_);
12655 __ push(result_); 12655 __ push(result_);
12656 __ push(index_); // Consumed by runtime conversion function. 12656 __ push(index_); // Consumed by runtime conversion function.
12657 if (index_flags_ == STRING_INDEX_IS_NUMBER) { 12657 if (index_flags_ == STRING_INDEX_IS_NUMBER) {
12658 // Strictly speaking, NumberToInteger should be called here, but 12658 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1);
12659 // our string lengths don't exceed 32 bits and using ToUint32 maps
12660 // -0 to 0, which is what is required by the spec when accessing
12661 // strings.
12662 __ CallRuntime(Runtime::kNumberToJSUint32, 1);
12663 } else { 12659 } else {
12664 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); 12660 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX);
12665 // NumberToSmi discards numbers that are not exact integers. 12661 // NumberToSmi discards numbers that are not exact integers.
12666 __ CallRuntime(Runtime::kNumberToSmi, 1); 12662 __ CallRuntime(Runtime::kNumberToSmi, 1);
12667 } 12663 }
12668 if (!scratch_.is(eax)) { 12664 if (!scratch_.is(eax)) {
12669 // Save the conversion result before the pop instructions below 12665 // Save the conversion result before the pop instructions below
12670 // have a chance to overwrite it. 12666 // have a chance to overwrite it.
12671 __ mov(scratch_, eax); 12667 __ mov(scratch_, eax);
12672 } 12668 }
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
13506 // tagged as a small integer. 13502 // tagged as a small integer.
13507 __ bind(&runtime); 13503 __ bind(&runtime);
13508 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 13504 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
13509 } 13505 }
13510 13506
13511 #undef __ 13507 #undef __
13512 13508
13513 } } // namespace v8::internal 13509 } } // namespace v8::internal
13514 13510
13515 #endif // V8_TARGET_ARCH_IA32 13511 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698