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

Side by Side Diff: src/arm/codegen-arm.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 | « no previous file | src/ia32/codegen-ia32.cc » ('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 9266 matching lines...) Expand 10 before | Expand all | Expand 10 after
9277 9277
9278 // Index is not a smi. 9278 // Index is not a smi.
9279 __ bind(&index_not_smi_); 9279 __ bind(&index_not_smi_);
9280 // If index is a heap number, try converting it to an integer. 9280 // If index is a heap number, try converting it to an integer.
9281 __ CheckMap(index_, scratch_, 9281 __ CheckMap(index_, scratch_,
9282 Factory::heap_number_map(), index_not_number_, true); 9282 Factory::heap_number_map(), index_not_number_, true);
9283 call_helper.BeforeCall(masm); 9283 call_helper.BeforeCall(masm);
9284 __ Push(object_, index_, result_); 9284 __ Push(object_, index_, result_);
9285 __ push(index_); // Consumed by runtime conversion function. 9285 __ push(index_); // Consumed by runtime conversion function.
9286 if (index_flags_ == STRING_INDEX_IS_NUMBER) { 9286 if (index_flags_ == STRING_INDEX_IS_NUMBER) {
9287 // Strictly speaking, NumberToInteger should be called here, but 9287 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1);
9288 // our string lengths don't exceed 32 bits and using ToUint32 maps
9289 // -0 to 0, which is what is required by the spec when accessing
9290 // strings.
9291 __ CallRuntime(Runtime::kNumberToJSUint32, 1);
9292 } else { 9288 } else {
9293 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); 9289 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX);
9294 // NumberToSmi discards numbers that are not exact integers. 9290 // NumberToSmi discards numbers that are not exact integers.
9295 __ CallRuntime(Runtime::kNumberToSmi, 1); 9291 __ CallRuntime(Runtime::kNumberToSmi, 1);
9296 } 9292 }
9297 if (!scratch_.is(r0)) { 9293 if (!scratch_.is(r0)) {
9298 // Save the conversion result before the pop instructions below 9294 // Save the conversion result before the pop instructions below
9299 // have a chance to overwrite it. 9295 // have a chance to overwrite it.
9300 __ mov(scratch_, r0); 9296 __ mov(scratch_, r0);
9301 } 9297 }
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
10268 __ bind(&string_add_runtime); 10264 __ bind(&string_add_runtime);
10269 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 10265 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
10270 } 10266 }
10271 10267
10272 10268
10273 #undef __ 10269 #undef __
10274 10270
10275 } } // namespace v8::internal 10271 } } // namespace v8::internal
10276 10272
10277 #endif // V8_TARGET_ARCH_ARM 10273 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698