OLD | NEW |
---|---|
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 bool no_caller_args = args.length() == 2; | 202 bool no_caller_args = args.length() == 2; |
203 ASSERT(no_caller_args || args.length() == 3); | 203 ASSERT(no_caller_args || args.length() == 3); |
204 int parameters_start = no_caller_args ? 0 : 1; | 204 int parameters_start = no_caller_args ? 0 : 1; |
205 Arguments* caller_args = no_caller_args | 205 Arguments* caller_args = no_caller_args |
206 ? &empty_args | 206 ? &empty_args |
207 : reinterpret_cast<Arguments*>(args[0]); | 207 : reinterpret_cast<Arguments*>(args[0]); |
208 Handle<JSFunction> constructor = args.at<JSFunction>(parameters_start); | 208 Handle<JSFunction> constructor = args.at<JSFunction>(parameters_start); |
209 Handle<Object> type_info = args.at<Object>(parameters_start + 1); | 209 Handle<Object> type_info = args.at<Object>(parameters_start + 1); |
210 | 210 |
211 bool holey = false; | 211 bool holey = false; |
212 if (caller_args->length() == 1 && (*caller_args)[0]->IsSmi()) { | 212 bool ignore_advice = false; |
danno
2013/06/04 16:29:47
ignore_type_feedback is probably more accurate.
mvstanton
2013/06/05 08:47:07
Done.
| |
213 int value = Smi::cast((*caller_args)[0])->value(); | 213 if (caller_args->length() == 1) { |
214 holey = (value > 0 && value < JSObject::kInitialMaxFastElementArray); | 214 Object* argument_one = (*caller_args)[0]; |
215 if (argument_one->IsSmi()) { | |
216 int value = Smi::cast(argument_one)->value(); | |
217 holey = (value > 0 && value < JSObject::kInitialMaxFastElementArray); | |
danno
2013/06/04 16:29:47
Don't you mean >= 0? Or is the distinction importa
mvstanton
2013/06/05 08:47:07
I think it's important because if someone calls ne
| |
218 } | |
219 | |
220 // If we have a single argument, and we failed to set holey above, | |
221 // then we'll be forced down the dictionary path. In this case it's | |
222 // useless to consume allocation site info advice, even if we have it. | |
223 ignore_advice = !holey; | |
215 } | 224 } |
216 | 225 |
217 JSArray* array; | 226 JSArray* array; |
218 MaybeObject* maybe_array; | 227 MaybeObject* maybe_array; |
219 if (*type_info != isolate->heap()->undefined_value() && | 228 if (*type_info != isolate->heap()->undefined_value() && |
220 JSGlobalPropertyCell::cast(*type_info)->value()->IsSmi()) { | 229 JSGlobalPropertyCell::cast(*type_info)->value()->IsSmi() && |
230 !ignore_advice) { | |
221 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(*type_info); | 231 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(*type_info); |
222 Smi* smi = Smi::cast(cell->value()); | 232 Smi* smi = Smi::cast(cell->value()); |
223 ElementsKind to_kind = static_cast<ElementsKind>(smi->value()); | 233 ElementsKind to_kind = static_cast<ElementsKind>(smi->value()); |
224 if (holey && !IsFastHoleyElementsKind(to_kind)) { | 234 if (holey && !IsFastHoleyElementsKind(to_kind)) { |
225 to_kind = GetHoleyElementsKind(to_kind); | 235 to_kind = GetHoleyElementsKind(to_kind); |
226 // Update the allocation site info to reflect the advice alteration. | 236 // Update the allocation site info to reflect the advice alteration. |
227 cell->set_value(Smi::FromInt(to_kind)); | 237 cell->set_value(Smi::FromInt(to_kind)); |
228 } | 238 } |
229 | 239 |
230 maybe_array = isolate->heap()->AllocateJSObjectWithAllocationSite( | 240 maybe_array = isolate->heap()->AllocateJSObjectWithAllocationSite( |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1883 return Handle<Code>(code_address); \ | 1893 return Handle<Code>(code_address); \ |
1884 } | 1894 } |
1885 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1895 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1886 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1896 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1887 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1897 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1888 #undef DEFINE_BUILTIN_ACCESSOR_C | 1898 #undef DEFINE_BUILTIN_ACCESSOR_C |
1889 #undef DEFINE_BUILTIN_ACCESSOR_A | 1899 #undef DEFINE_BUILTIN_ACCESSOR_A |
1890 | 1900 |
1891 | 1901 |
1892 } } // namespace v8::internal | 1902 } } // namespace v8::internal |
OLD | NEW |