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

Side by Side Diff: src/objects.cc

Issue 11416238: Move CopyElements to the accessor of the target. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed more comments. Created 8 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
« src/elements.cc ('K') | « src/elements.cc ('k') | no next file » | 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 9288 matching lines...) Expand 10 before | Expand all | Expand 10 after
9299 new_elements_kind = FAST_SMI_ELEMENTS; 9299 new_elements_kind = FAST_SMI_ELEMENTS;
9300 } 9300 }
9301 } else { 9301 } else {
9302 if (IsHoleyElementsKind(elements_kind)) { 9302 if (IsHoleyElementsKind(elements_kind)) {
9303 new_elements_kind = FAST_HOLEY_ELEMENTS; 9303 new_elements_kind = FAST_HOLEY_ELEMENTS;
9304 } else { 9304 } else {
9305 new_elements_kind = FAST_ELEMENTS; 9305 new_elements_kind = FAST_ELEMENTS;
9306 } 9306 }
9307 } 9307 }
9308 FixedArrayBase* old_elements = elements(); 9308 FixedArrayBase* old_elements = elements();
9309 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind); 9309 ElementsAccessor* accessor = ElementsAccessor::ForKind(new_elements_kind);
9310 MaybeObject* maybe_obj = 9310 MaybeObject* maybe_obj =
9311 accessor->CopyElements(this, new_elements, new_elements_kind); 9311 accessor->CopyElements(this, new_elements, elements_kind);
9312 if (maybe_obj->IsFailure()) return maybe_obj; 9312 if (maybe_obj->IsFailure()) return maybe_obj;
9313 9313
9314 if (elements_kind != NON_STRICT_ARGUMENTS_ELEMENTS) { 9314 if (elements_kind != NON_STRICT_ARGUMENTS_ELEMENTS) {
9315 Map* new_map = map(); 9315 Map* new_map = map();
9316 if (new_elements_kind != elements_kind) { 9316 if (new_elements_kind != elements_kind) {
9317 MaybeObject* maybe = 9317 MaybeObject* maybe =
9318 GetElementsTransitionMap(GetIsolate(), new_elements_kind); 9318 GetElementsTransitionMap(GetIsolate(), new_elements_kind);
9319 if (!maybe->To(&new_map)) return maybe; 9319 if (!maybe->To(&new_map)) return maybe;
9320 } 9320 }
9321 ValidateElements(); 9321 ValidateElements();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
9358 new_elements_kind = FAST_DOUBLE_ELEMENTS; 9358 new_elements_kind = FAST_DOUBLE_ELEMENTS;
9359 } 9359 }
9360 9360
9361 Map* new_map; 9361 Map* new_map;
9362 { MaybeObject* maybe_obj = 9362 { MaybeObject* maybe_obj =
9363 GetElementsTransitionMap(heap->isolate(), new_elements_kind); 9363 GetElementsTransitionMap(heap->isolate(), new_elements_kind);
9364 if (!maybe_obj->To(&new_map)) return maybe_obj; 9364 if (!maybe_obj->To(&new_map)) return maybe_obj;
9365 } 9365 }
9366 9366
9367 FixedArrayBase* old_elements = elements(); 9367 FixedArrayBase* old_elements = elements();
9368 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind); 9368 ElementsAccessor* accessor = ElementsAccessor::ForKind(FAST_DOUBLE_ELEMENTS);
9369 { MaybeObject* maybe_obj = 9369 { MaybeObject* maybe_obj =
9370 accessor->CopyElements(this, elems, FAST_DOUBLE_ELEMENTS); 9370 accessor->CopyElements(this, elems, elements_kind);
9371 if (maybe_obj->IsFailure()) return maybe_obj; 9371 if (maybe_obj->IsFailure()) return maybe_obj;
9372 } 9372 }
9373 if (elements_kind != NON_STRICT_ARGUMENTS_ELEMENTS) { 9373 if (elements_kind != NON_STRICT_ARGUMENTS_ELEMENTS) {
9374 ValidateElements(); 9374 ValidateElements();
9375 set_map_and_elements(new_map, elems); 9375 set_map_and_elements(new_map, elems);
9376 } else { 9376 } else {
9377 FixedArray* parameter_map = FixedArray::cast(old_elements); 9377 FixedArray* parameter_map = FixedArray::cast(old_elements);
9378 parameter_map->set(1, elems); 9378 parameter_map->set(1, elems);
9379 } 9379 }
9380 9380
(...skipping 4502 matching lines...) Expand 10 before | Expand all | Expand 10 after
13883 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13883 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13884 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13884 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13885 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13885 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13886 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13886 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13887 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13887 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13888 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13888 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13889 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13889 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13890 } 13890 }
13891 13891
13892 } } // namespace v8::internal 13892 } } // namespace v8::internal
OLDNEW
« src/elements.cc ('K') | « src/elements.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698