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

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

Issue 6287030: Create specialized code stubs for PixelArray loads. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: cleanup before review Created 9 years, 10 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 4396 matching lines...) Expand 10 before | Expand all | Expand 10 after
4407 // Restore registers. 4407 // Restore registers.
4408 __ pop(rcx); 4408 __ pop(rcx);
4409 __ pop(rax); 4409 __ pop(rax);
4410 __ pop(rdx); 4410 __ pop(rdx);
4411 __ push(rcx); 4411 __ push(rcx);
4412 4412
4413 // Do a tail call to the rewritten stub. 4413 // Do a tail call to the rewritten stub.
4414 __ jmp(rdi); 4414 __ jmp(rdi);
4415 } 4415 }
4416 4416
4417
4418 void GenerateFastPixelArrayLoad(MacroAssembler* masm,
4419 Register receiver,
4420 Register key,
4421 Register elements,
4422 Register untagged_key,
4423 Register result,
4424 Label* not_pixel_array,
4425 Label* key_not_smi,
4426 Label* out_of_range) {
4427 // Register use:
4428 // receiver - holds the receiver and is unchanged.
4429 // key - holds the key and is unchanged (must be a smi).
4430 // elements - is set to the the receiver's element if
4431 // the receiver doesn't have a pixel array or the
4432 // key is not a smi, otherwise it's the elements'
4433 // external pointer.
4434 // untagged_key - is set to the untagged key
4435
4436 // Check that the key is a smi.
4437 if (key_not_smi != NULL) {
Søren Thygesen Gjesse 2011/02/01 12:02:56 See ARM comments.
danno 2011/02/03 12:53:26 Done.
4438 __ JumpIfNotSmi(key, key_not_smi);
4439 }
4440 __ SmiToInteger32(untagged_key, key);
4441
4442 // Verify that the receiver has pixel array elements.
4443 __ movq(elements, FieldOperand(receiver, JSObject::kElementsOffset));
Mads Ager (chromium) 2011/02/01 12:02:12 Same order of checks on all platforms? Use CheckMa
danno 2011/02/03 12:53:26 Done.
4444 __ CompareRoot(FieldOperand(elements, HeapObject::kMapOffset),
4445 Heap::kPixelArrayMapRootIndex);
4446 __ j(not_equal, not_pixel_array);
4447
4448 // Check that the smi is in range.
4449 __ cmpl(untagged_key, FieldOperand(elements, PixelArray::kLengthOffset));
4450 __ j(above_equal, out_of_range);
4451
4452 // Load and tag the element as a smi.
4453 __ movq(elements, FieldOperand(elements, PixelArray::kExternalPointerOffset));
4454 __ movzxbq(result, Operand(elements, untagged_key, times_1, 0));
4455 __ Integer32ToSmi(result, result);
4456 __ ret(0);
4457 }
4458
4459
4417 #undef __ 4460 #undef __
4418 4461
4419 } } // namespace v8::internal 4462 } } // namespace v8::internal
4420 4463
4421 #endif // V8_TARGET_ARCH_X64 4464 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698