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

Side by Side Diff: src/elements.cc

Issue 11365175: Minor cleanup and optimisation of element methods. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 | « no previous file | src/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 522
523 virtual void Validate(JSObject* holder) { 523 virtual void Validate(JSObject* holder) {
524 ElementsAccessorSubclass::ValidateImpl(holder); 524 ElementsAccessorSubclass::ValidateImpl(holder);
525 } 525 }
526 526
527 static bool HasElementImpl(Object* receiver, 527 static bool HasElementImpl(Object* receiver,
528 JSObject* holder, 528 JSObject* holder,
529 uint32_t key, 529 uint32_t key,
530 BackingStore* backing_store) { 530 BackingStore* backing_store) {
531 MaybeObject* element = 531 return ElementsAccessorSubclass::GetAttributesImpl(
532 ElementsAccessorSubclass::GetImpl(receiver, holder, key, backing_store); 532 receiver, holder, key, backing_store) != ABSENT;
533 return !element->IsTheHole();
534 } 533 }
535 534
536 virtual bool HasElement(Object* receiver, 535 virtual bool HasElement(Object* receiver,
537 JSObject* holder, 536 JSObject* holder,
538 uint32_t key, 537 uint32_t key,
539 FixedArrayBase* backing_store) { 538 FixedArrayBase* backing_store) {
540 if (backing_store == NULL) { 539 if (backing_store == NULL) {
541 backing_store = holder->elements(); 540 backing_store = holder->elements();
542 } 541 }
543 return ElementsAccessorSubclass::HasElementImpl( 542 return ElementsAccessorSubclass::HasElementImpl(
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 if (!maybe_obj->To(&new_backing_store)) return maybe_obj; 1747 if (!maybe_obj->To(&new_backing_store)) return maybe_obj;
1749 new_backing_store->set(0, length); 1748 new_backing_store->set(0, length);
1750 { MaybeObject* result = array->SetContent(new_backing_store); 1749 { MaybeObject* result = array->SetContent(new_backing_store);
1751 if (result->IsFailure()) return result; 1750 if (result->IsFailure()) return result;
1752 } 1751 }
1753 return array; 1752 return array;
1754 } 1753 }
1755 1754
1756 1755
1757 } } // namespace v8::internal 1756 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698