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

Side by Side Diff: src/objects-inl.h

Issue 8895025: Fix invalid usage of StoreIC_ArrayLength optimization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Sven Panne. Created 9 years 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/objects.cc ('k') | src/x64/ic-x64.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 4238 matching lines...) Expand 10 before | Expand all | Expand 10 after
4249 bool JSObject::HasNamedInterceptor() { 4249 bool JSObject::HasNamedInterceptor() {
4250 return map()->has_named_interceptor(); 4250 return map()->has_named_interceptor();
4251 } 4251 }
4252 4252
4253 4253
4254 bool JSObject::HasIndexedInterceptor() { 4254 bool JSObject::HasIndexedInterceptor() {
4255 return map()->has_indexed_interceptor(); 4255 return map()->has_indexed_interceptor();
4256 } 4256 }
4257 4257
4258 4258
4259 bool JSObject::AllowsSetElementsLength() {
4260 bool result = elements()->IsFixedArray() ||
4261 elements()->IsFixedDoubleArray();
4262 ASSERT(result == !HasExternalArrayElements());
4263 return result;
4264 }
4265
4266
4267 MaybeObject* JSObject::EnsureWritableFastElements() { 4259 MaybeObject* JSObject::EnsureWritableFastElements() {
4268 ASSERT(HasFastTypeElements()); 4260 ASSERT(HasFastTypeElements());
4269 FixedArray* elems = FixedArray::cast(elements()); 4261 FixedArray* elems = FixedArray::cast(elements());
4270 Isolate* isolate = GetIsolate(); 4262 Isolate* isolate = GetIsolate();
4271 if (elems->map() != isolate->heap()->fixed_cow_array_map()) return elems; 4263 if (elems->map() != isolate->heap()->fixed_cow_array_map()) return elems;
4272 Object* writable_elems; 4264 Object* writable_elems;
4273 { MaybeObject* maybe_writable_elems = isolate->heap()->CopyFixedArrayWithMap( 4265 { MaybeObject* maybe_writable_elems = isolate->heap()->CopyFixedArrayWithMap(
4274 elems, isolate->heap()->fixed_array_map()); 4266 elems, isolate->heap()->fixed_array_map());
4275 if (!maybe_writable_elems->ToObject(&writable_elems)) { 4267 if (!maybe_writable_elems->ToObject(&writable_elems)) {
4276 return maybe_writable_elems; 4268 return maybe_writable_elems;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
4617 } 4609 }
4618 } 4610 }
4619 4611
4620 4612
4621 void JSArray::set_length(Smi* length) { 4613 void JSArray::set_length(Smi* length) {
4622 // Don't need a write barrier for a Smi. 4614 // Don't need a write barrier for a Smi.
4623 set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER); 4615 set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER);
4624 } 4616 }
4625 4617
4626 4618
4619 bool JSArray::AllowsSetElementsLength() {
4620 bool result = elements()->IsFixedArray() || elements()->IsFixedDoubleArray();
4621 ASSERT(result == !HasExternalArrayElements());
4622 return result;
4623 }
4624
4625
4627 MaybeObject* JSArray::SetContent(FixedArrayBase* storage) { 4626 MaybeObject* JSArray::SetContent(FixedArrayBase* storage) {
4628 MaybeObject* maybe_result = EnsureCanContainElements( 4627 MaybeObject* maybe_result = EnsureCanContainElements(
4629 storage, ALLOW_COPIED_DOUBLE_ELEMENTS); 4628 storage, ALLOW_COPIED_DOUBLE_ELEMENTS);
4630 if (maybe_result->IsFailure()) return maybe_result; 4629 if (maybe_result->IsFailure()) return maybe_result;
4631 ASSERT((storage->map() == GetHeap()->fixed_double_array_map() && 4630 ASSERT((storage->map() == GetHeap()->fixed_double_array_map() &&
4632 GetElementsKind() == FAST_DOUBLE_ELEMENTS) || 4631 GetElementsKind() == FAST_DOUBLE_ELEMENTS) ||
4633 ((storage->map() != GetHeap()->fixed_double_array_map()) && 4632 ((storage->map() != GetHeap()->fixed_double_array_map()) &&
4634 ((GetElementsKind() == FAST_ELEMENTS) || 4633 ((GetElementsKind() == FAST_ELEMENTS) ||
4635 (GetElementsKind() == FAST_SMI_ONLY_ELEMENTS && 4634 (GetElementsKind() == FAST_SMI_ONLY_ELEMENTS &&
4636 FixedArray::cast(storage)->ContainsOnlySmisOrHoles())))); 4635 FixedArray::cast(storage)->ContainsOnlySmisOrHoles()))));
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
4752 #undef WRITE_INT_FIELD 4751 #undef WRITE_INT_FIELD
4753 #undef READ_SHORT_FIELD 4752 #undef READ_SHORT_FIELD
4754 #undef WRITE_SHORT_FIELD 4753 #undef WRITE_SHORT_FIELD
4755 #undef READ_BYTE_FIELD 4754 #undef READ_BYTE_FIELD
4756 #undef WRITE_BYTE_FIELD 4755 #undef WRITE_BYTE_FIELD
4757 4756
4758 4757
4759 } } // namespace v8::internal 4758 } } // namespace v8::internal
4760 4759
4761 #endif // V8_OBJECTS_INL_H_ 4760 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698