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

Unified Diff: src/objects-inl.h

Issue 3522008: This is a little experiment to move Failure to a superclass above Object... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | src/property.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
===================================================================
--- src/objects-inl.h (revision 5559)
+++ src/objects-inl.h (working copy)
@@ -1204,9 +1204,11 @@
}
+ Object* obj;
+ { TryAllocation t = map()->GetFastElementsMap();
+ if (!t->ToObject(&obj)) return t;
+ }
Object* JSObject::ResetElements() {
- Object* obj = map()->GetFastElementsMap();
- if (obj->IsFailure()) return obj;
set_map(Map::cast(obj));
initialize_elements();
return this;
@@ -2482,9 +2484,11 @@
Object* Map::GetFastElementsMap() {
+ Object* obj;
+ { TryAllocation t = CopyDropTransitions();
+ if (!t->ToObject(&obj)) return t;
+ }
if (has_fast_elements()) return this;
- Object* obj = CopyDropTransitions();
- if (obj->IsFailure()) return obj;
Map* new_map = Map::cast(obj);
new_map->set_has_fast_elements(true);
Counters::map_slow_to_fast_elements.Increment();
@@ -2493,9 +2497,11 @@
Object* Map::GetSlowElementsMap() {
+ Object* obj;
+ { TryAllocation t = CopyDropTransitions();
+ if (!t->ToObject(&obj)) return t;
+ }
if (!has_fast_elements()) return this;
- Object* obj = CopyDropTransitions();
- if (obj->IsFailure()) return obj;
Map* new_map = Map::cast(obj);
new_map->set_has_fast_elements(false);
Counters::map_fast_to_slow_elements.Increment();
@@ -3199,9 +3205,11 @@
ASSERT(HasFastElements());
FixedArray* elems = FixedArray::cast(elements());
if (elems->map() != Heap::fixed_cow_array_map()) return elems;
- Object* writable_elems = Heap::CopyFixedArrayWithMap(elems,
- Heap::fixed_array_map());
- if (writable_elems->IsFailure()) return writable_elems;
+ Object* writable_elems;
+ { TryAllocation t = Heap::CopyFixedArrayWithMap(elems,
+ Heap::fixed_array_map());
+ if (!t->ToObject(&writable_elems)) return t;
+ }
set_elements(FixedArray::cast(writable_elems));
Counters::cow_arrays_converted.Increment();
return writable_elems;
« no previous file with comments | « src/objects.cc ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698