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

Side by Side Diff: src/objects.cc

Issue 8437094: Fix JSObject::EnsureCanContainElements to correctly iterate over Arguments (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | test/mjsunit/elements-kind.js » ('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 8737 matching lines...) Expand 10 before | Expand all | Expand 10 after
8748 8748
8749 heap->ClearInstanceofCache(); 8749 heap->ClearInstanceofCache();
8750 ASSERT(size == Size()); 8750 ASSERT(size == Size());
8751 return value; 8751 return value;
8752 } 8752 }
8753 8753
8754 8754
8755 MaybeObject* JSObject::EnsureCanContainElements(Arguments* args, 8755 MaybeObject* JSObject::EnsureCanContainElements(Arguments* args,
8756 uint32_t first_arg, 8756 uint32_t first_arg,
8757 uint32_t arg_count) { 8757 uint32_t arg_count) {
8758 return EnsureCanContainElements(args->arguments() - first_arg, arg_count); 8758 // Elements in |Arguments| are ordered backwards (because they're on the
8759 // stack), but the method that's called here iterates over them in forward
8760 // direction.
8761 return EnsureCanContainElements(
8762 args->arguments() - first_arg - (arg_count - 1),
8763 arg_count);
8759 } 8764 }
8760 8765
8761 8766
8762 bool JSObject::HasElementPostInterceptor(JSReceiver* receiver, uint32_t index) { 8767 bool JSObject::HasElementPostInterceptor(JSReceiver* receiver, uint32_t index) {
8763 switch (GetElementsKind()) { 8768 switch (GetElementsKind()) {
8764 case FAST_SMI_ONLY_ELEMENTS: 8769 case FAST_SMI_ONLY_ELEMENTS:
8765 case FAST_ELEMENTS: { 8770 case FAST_ELEMENTS: {
8766 uint32_t length = IsJSArray() ? 8771 uint32_t length = IsJSArray() ?
8767 static_cast<uint32_t> 8772 static_cast<uint32_t>
8768 (Smi::cast(JSArray::cast(this)->length())->value()) : 8773 (Smi::cast(JSArray::cast(this)->length())->value()) :
(...skipping 3983 matching lines...) Expand 10 before | Expand all | Expand 10 after
12752 if (break_point_objects()->IsUndefined()) return 0; 12757 if (break_point_objects()->IsUndefined()) return 0;
12753 // Single break point. 12758 // Single break point.
12754 if (!break_point_objects()->IsFixedArray()) return 1; 12759 if (!break_point_objects()->IsFixedArray()) return 1;
12755 // Multiple break points. 12760 // Multiple break points.
12756 return FixedArray::cast(break_point_objects())->length(); 12761 return FixedArray::cast(break_point_objects())->length();
12757 } 12762 }
12758 #endif // ENABLE_DEBUGGER_SUPPORT 12763 #endif // ENABLE_DEBUGGER_SUPPORT
12759 12764
12760 12765
12761 } } // namespace v8::internal 12766 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/elements-kind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698