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

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

Issue 6287030: Create specialized code stubs for PixelArray loads. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: review feedback 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
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/ia32/ic-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 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 6489 matching lines...) Expand 10 before | Expand all | Expand 10 after
6500 __ pop(ecx); 6500 __ pop(ecx);
6501 __ pop(eax); 6501 __ pop(eax);
6502 __ pop(edx); 6502 __ pop(edx);
6503 __ push(ecx); 6503 __ push(ecx);
6504 6504
6505 // Do a tail call to the rewritten stub. 6505 // Do a tail call to the rewritten stub.
6506 __ jmp(Operand(edi)); 6506 __ jmp(Operand(edi));
6507 } 6507 }
6508 6508
6509 6509
6510 // Loads a indexed element from a pixel array.
6511 void GenerateFastPixelArrayLoad(MacroAssembler* masm,
6512 Register receiver,
6513 Register key,
6514 Register elements,
6515 Register untagged_key,
6516 Register result,
6517 Label* not_pixel_array,
6518 Label* key_not_smi,
6519 Label* out_of_range) {
6520 // Register use:
6521 // receiver - holds the receiver and is unchanged.
6522 // key - holds the key and is unchanged (must be a smi).
6523 // elements - is set to the the receiver's element if
6524 // the receiver doesn't have a pixel array or the
6525 // key is not a smi, otherwise it's the elements'
6526 // external pointer.
6527 // untagged_key - is set to the untagged key
6528
6529 // Some callers already have verified that the key is a smi. key_not_smi is
6530 // set to NULL as a sentinel for that case. Otherwise, add an explicit check
6531 // to ensure the key is a smi must be added.
6532 if (key_not_smi != NULL) {
6533 __ JumpIfNotSmi(key, key_not_smi);
6534 } else {
6535 if (FLAG_debug_code) {
6536 __ AbortIfNotSmi(key);
6537 }
6538 }
6539 __ mov(untagged_key, key);
6540 __ SmiUntag(untagged_key);
6541
6542 // Verify that the receiver has pixel array elements.
6543 __ mov(elements, FieldOperand(receiver, JSObject::kElementsOffset));
6544 __ CheckMap(elements, Factory::pixel_array_map(), not_pixel_array, true);
6545
6546 // Key must be in range.
6547 __ cmp(untagged_key, FieldOperand(elements, PixelArray::kLengthOffset));
6548 __ j(above_equal, out_of_range); // unsigned check handles negative keys.
6549
6550 // Perform the indexed load and tag the result as a smi.
6551 __ mov(elements, FieldOperand(elements, PixelArray::kExternalPointerOffset));
6552 __ movzx_b(result, Operand(elements, untagged_key, times_1, 0));
6553 __ SmiTag(result);
6554 __ ret(0);
6555 }
6556
6557
6510 #undef __ 6558 #undef __
6511 6559
6512 } } // namespace v8::internal 6560 } } // namespace v8::internal
6513 6561
6514 #endif // V8_TARGET_ARCH_IA32 6562 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698