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

Side by Side Diff: src/builtins.cc

Issue 1066003003: Make sure builtins preserve guarantees about empty element array prototypes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE, fix nits. Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/hydrogen.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 if (args == NULL || array->HasFastObjectElements()) return elms; 227 if (args == NULL || array->HasFastObjectElements()) return elms;
228 } else if (map == heap->fixed_cow_array_map()) { 228 } else if (map == heap->fixed_cow_array_map()) {
229 elms = JSObject::EnsureWritableFastElements(array); 229 elms = JSObject::EnsureWritableFastElements(array);
230 if (args == NULL || array->HasFastObjectElements()) return elms; 230 if (args == NULL || array->HasFastObjectElements()) return elms;
231 } else if (map == heap->fixed_double_array_map()) { 231 } else if (map == heap->fixed_double_array_map()) {
232 if (args == NULL) return elms; 232 if (args == NULL) return elms;
233 } else { 233 } else {
234 return MaybeHandle<FixedArrayBase>(); 234 return MaybeHandle<FixedArrayBase>();
235 } 235 }
236 236
237 // Adding elements to the array prototype would break code that makes sure
238 // it has no elements. Handle that elsewhere.
239 if (array->GetIsolate()->is_initial_array_prototype(*array)) {
240 return MaybeHandle<FixedArrayBase>();
241 }
242
237 // Need to ensure that the arguments passed in args can be contained in 243 // Need to ensure that the arguments passed in args can be contained in
238 // the array. 244 // the array.
239 int args_length = args->length(); 245 int args_length = args->length();
240 if (first_added_arg >= args_length) return handle(array->elements(), isolate); 246 if (first_added_arg >= args_length) return handle(array->elements(), isolate);
241 247
242 ElementsKind origin_kind = array->map()->elements_kind(); 248 ElementsKind origin_kind = array->map()->elements_kind();
243 DCHECK(!IsFastObjectElementsKind(origin_kind)); 249 DCHECK(!IsFastObjectElementsKind(origin_kind));
244 ElementsKind target_kind = origin_kind; 250 ElementsKind target_kind = origin_kind;
245 { 251 {
246 DisallowHeapAllocation no_gc; 252 DisallowHeapAllocation no_gc;
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 } 1658 }
1653 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1659 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1654 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1660 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1655 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 1661 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
1656 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1662 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1657 #undef DEFINE_BUILTIN_ACCESSOR_C 1663 #undef DEFINE_BUILTIN_ACCESSOR_C
1658 #undef DEFINE_BUILTIN_ACCESSOR_A 1664 #undef DEFINE_BUILTIN_ACCESSOR_A
1659 1665
1660 1666
1661 } } // namespace v8::internal 1667 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698