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

Side by Side Diff: src/builtins.cc

Issue 9290064: Add undefined check for default Array map in ArrayCodeGenericCommon (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 isolate->counters()->array_function_runtime()->Increment(); 191 isolate->counters()->array_function_runtime()->Increment();
192 192
193 JSArray* array; 193 JSArray* array;
194 if (CalledAsConstructor(isolate)) { 194 if (CalledAsConstructor(isolate)) {
195 array = JSArray::cast((*args)[0]); 195 array = JSArray::cast((*args)[0]);
196 // Initialize elements and length in case later allocations fail so that the 196 // Initialize elements and length in case later allocations fail so that the
197 // array object is initialized in a valid state. 197 // array object is initialized in a valid state.
198 array->set_length(Smi::FromInt(0)); 198 array->set_length(Smi::FromInt(0));
199 array->set_elements(heap->empty_fixed_array()); 199 array->set_elements(heap->empty_fixed_array());
200 if (!FLAG_smi_only_arrays) { 200 if (!FLAG_smi_only_arrays) {
201 if (array->GetElementsKind() == FAST_SMI_ONLY_ELEMENTS) { 201 Context* global_context = isolate->context()->global_context();
202 Context* global_context = isolate->context()->global_context(); 202 if (array->GetElementsKind() == FAST_SMI_ONLY_ELEMENTS &&
203 !global_context->object_js_array_map()->IsUndefined()) {
203 array->set_map(Map::cast(global_context->object_js_array_map())); 204 array->set_map(Map::cast(global_context->object_js_array_map()));
204 } 205 }
205 } 206 }
206 } else { 207 } else {
207 // Allocate the JS Array 208 // Allocate the JS Array
208 MaybeObject* maybe_obj = 209 MaybeObject* maybe_obj =
209 heap->AllocateEmptyJSArray(FAST_SMI_ONLY_ELEMENTS); 210 heap->AllocateEmptyJSArray(FAST_SMI_ONLY_ELEMENTS);
210 if (!maybe_obj->To(&array)) return maybe_obj; 211 if (!maybe_obj->To(&array)) return maybe_obj;
211 } 212 }
212 213
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 return Handle<Code>(code_address); \ 1744 return Handle<Code>(code_address); \
1744 } 1745 }
1745 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1746 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1746 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1747 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1747 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1748 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1748 #undef DEFINE_BUILTIN_ACCESSOR_C 1749 #undef DEFINE_BUILTIN_ACCESSOR_C
1749 #undef DEFINE_BUILTIN_ACCESSOR_A 1750 #undef DEFINE_BUILTIN_ACCESSOR_A
1750 1751
1751 1752
1752 } } // namespace v8::internal 1753 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698