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

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

Issue 2468001: Fix generated code for String.charCodeAt. (Closed)
Patch Set: Created 10 years, 6 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 | « include/v8.h ('k') | 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 9265 matching lines...) Expand 10 before | Expand all | Expand 10 after
9276 void StringCharCodeAtGenerator::GenerateSlow( 9276 void StringCharCodeAtGenerator::GenerateSlow(
9277 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { 9277 MacroAssembler* masm, const RuntimeCallHelper& call_helper) {
9278 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); 9278 __ Abort("Unexpected fallthrough to CharCodeAt slow case");
9279 9279
9280 // Index is not a smi. 9280 // Index is not a smi.
9281 __ bind(&index_not_smi_); 9281 __ bind(&index_not_smi_);
9282 // If index is a heap number, try converting it to an integer. 9282 // If index is a heap number, try converting it to an integer.
9283 __ CheckMap(index_, scratch_, 9283 __ CheckMap(index_, scratch_,
9284 Factory::heap_number_map(), index_not_number_, true); 9284 Factory::heap_number_map(), index_not_number_, true);
9285 call_helper.BeforeCall(masm); 9285 call_helper.BeforeCall(masm);
9286 __ Push(object_, index_, result_); 9286 __ Push(object_, index_);
9287 __ push(index_); // Consumed by runtime conversion function. 9287 __ push(index_); // Consumed by runtime conversion function.
9288 if (index_flags_ == STRING_INDEX_IS_NUMBER) { 9288 if (index_flags_ == STRING_INDEX_IS_NUMBER) {
9289 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); 9289 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1);
9290 } else { 9290 } else {
9291 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); 9291 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX);
9292 // NumberToSmi discards numbers that are not exact integers. 9292 // NumberToSmi discards numbers that are not exact integers.
9293 __ CallRuntime(Runtime::kNumberToSmi, 1); 9293 __ CallRuntime(Runtime::kNumberToSmi, 1);
9294 } 9294 }
9295 if (!scratch_.is(r0)) { 9295 if (!scratch_.is(r0)) {
9296 // Save the conversion result before the pop instructions below 9296 // Save the conversion result before the pop instructions below
9297 // have a chance to overwrite it. 9297 // have a chance to overwrite it.
9298 __ mov(scratch_, r0); 9298 __ mov(scratch_, r0);
9299 } 9299 }
9300 __ pop(result_);
9301 __ pop(index_); 9300 __ pop(index_);
9302 __ pop(object_); 9301 __ pop(object_);
9302 // Reload the instance type.
9303 __ ldr(result_, FieldMemOperand(object_, HeapObject::kMapOffset));
9304 __ ldrb(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset));
9303 call_helper.AfterCall(masm); 9305 call_helper.AfterCall(masm);
9304 // If index is still not a smi, it must be out of range. 9306 // If index is still not a smi, it must be out of range.
9305 __ BranchOnNotSmi(scratch_, index_out_of_range_); 9307 __ BranchOnNotSmi(scratch_, index_out_of_range_);
9306 // Otherwise, return to the fast path. 9308 // Otherwise, return to the fast path.
9307 __ jmp(&got_smi_index_); 9309 __ jmp(&got_smi_index_);
9308 9310
9309 // Call runtime. We get here when the receiver is a string and the 9311 // Call runtime. We get here when the receiver is a string and the
9310 // index is a number, but the code of getting the actual character 9312 // index is a number, but the code of getting the actual character
9311 // is too complex (e.g., when the string needs to be flattened). 9313 // is too complex (e.g., when the string needs to be flattened).
9312 __ bind(&call_runtime_); 9314 __ bind(&call_runtime_);
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
10266 __ bind(&string_add_runtime); 10268 __ bind(&string_add_runtime);
10267 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 10269 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
10268 } 10270 }
10269 10271
10270 10272
10271 #undef __ 10273 #undef __
10272 10274
10273 } } // namespace v8::internal 10275 } } // namespace v8::internal
10274 10276
10275 #endif // V8_TARGET_ARCH_ARM 10277 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698