| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 5458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5469 if (source->IsUndefined()) hash = String::cast(source)->Hash(); | 5469 if (source->IsUndefined()) hash = String::cast(source)->Hash(); |
| 5470 } | 5470 } |
| 5471 hash ^= ComputeIntegerHash(shared()->start_position_and_type()); | 5471 hash ^= ComputeIntegerHash(shared()->start_position_and_type()); |
| 5472 hash += ComputeIntegerHash(shared()->end_position()); | 5472 hash += ComputeIntegerHash(shared()->end_position()); |
| 5473 return hash; | 5473 return hash; |
| 5474 } | 5474 } |
| 5475 | 5475 |
| 5476 | 5476 |
| 5477 bool JSFunction::IsInlineable() { | 5477 bool JSFunction::IsInlineable() { |
| 5478 if (IsBuiltin()) return false; | 5478 if (IsBuiltin()) return false; |
| 5479 SharedFunctionInfo* shared_info = shared(); |
| 5479 // Check that the function has a script associated with it. | 5480 // Check that the function has a script associated with it. |
| 5480 if (!shared()->script()->IsScript()) return false; | 5481 if (!shared_info->script()->IsScript()) return false; |
| 5481 Code* code = shared()->code(); | 5482 if (shared_info->optimization_disabled()) return false; |
| 5483 Code* code = shared_info->code(); |
| 5482 if (code->kind() == Code::OPTIMIZED_FUNCTION) return true; | 5484 if (code->kind() == Code::OPTIMIZED_FUNCTION) return true; |
| 5483 // If we never ran this (unlikely) then lets try to optimize it. | 5485 // If we never ran this (unlikely) then lets try to optimize it. |
| 5484 if (code->kind() != Code::FUNCTION) return true; | 5486 if (code->kind() != Code::FUNCTION) return true; |
| 5485 return code->optimizable(); | 5487 return code->optimizable(); |
| 5486 } | 5488 } |
| 5487 | 5489 |
| 5488 | 5490 |
| 5489 Object* JSFunction::SetInstancePrototype(Object* value) { | 5491 Object* JSFunction::SetInstancePrototype(Object* value) { |
| 5490 ASSERT(value->IsJSObject()); | 5492 ASSERT(value->IsJSObject()); |
| 5491 | 5493 |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7270 break; | 7272 break; |
| 7271 } | 7273 } |
| 7272 case PIXEL_ELEMENTS: | 7274 case PIXEL_ELEMENTS: |
| 7273 case EXTERNAL_BYTE_ELEMENTS: | 7275 case EXTERNAL_BYTE_ELEMENTS: |
| 7274 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7276 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 7275 case EXTERNAL_SHORT_ELEMENTS: | 7277 case EXTERNAL_SHORT_ELEMENTS: |
| 7276 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7278 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 7277 case EXTERNAL_INT_ELEMENTS: | 7279 case EXTERNAL_INT_ELEMENTS: |
| 7278 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7280 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 7279 case EXTERNAL_FLOAT_ELEMENTS: { | 7281 case EXTERNAL_FLOAT_ELEMENTS: { |
| 7280 MaybeObject* value = GetExternalElement(index); | 7282 MaybeObject* maybe_value = GetExternalElement(index); |
| 7281 if (!value->ToObjectUnchecked()->IsUndefined()) return value; | 7283 Object* value; |
| 7284 if (!maybe_value->ToObject(&value)) return maybe_value; |
| 7285 if (!value->IsUndefined()) return value; |
| 7282 break; | 7286 break; |
| 7283 } | 7287 } |
| 7284 case DICTIONARY_ELEMENTS: { | 7288 case DICTIONARY_ELEMENTS: { |
| 7285 NumberDictionary* dictionary = element_dictionary(); | 7289 NumberDictionary* dictionary = element_dictionary(); |
| 7286 int entry = dictionary->FindEntry(index); | 7290 int entry = dictionary->FindEntry(index); |
| 7287 if (entry != NumberDictionary::kNotFound) { | 7291 if (entry != NumberDictionary::kNotFound) { |
| 7288 Object* element = dictionary->ValueAt(entry); | 7292 Object* element = dictionary->ValueAt(entry); |
| 7289 PropertyDetails details = dictionary->DetailsAt(entry); | 7293 PropertyDetails details = dictionary->DetailsAt(entry); |
| 7290 if (details.type() == CALLBACKS) { | 7294 if (details.type() == CALLBACKS) { |
| 7291 return GetElementWithCallback(receiver, | 7295 return GetElementWithCallback(receiver, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7367 break; | 7371 break; |
| 7368 } | 7372 } |
| 7369 case PIXEL_ELEMENTS: | 7373 case PIXEL_ELEMENTS: |
| 7370 case EXTERNAL_BYTE_ELEMENTS: | 7374 case EXTERNAL_BYTE_ELEMENTS: |
| 7371 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7375 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 7372 case EXTERNAL_SHORT_ELEMENTS: | 7376 case EXTERNAL_SHORT_ELEMENTS: |
| 7373 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7377 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 7374 case EXTERNAL_INT_ELEMENTS: | 7378 case EXTERNAL_INT_ELEMENTS: |
| 7375 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7379 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 7376 case EXTERNAL_FLOAT_ELEMENTS: { | 7380 case EXTERNAL_FLOAT_ELEMENTS: { |
| 7377 MaybeObject* value = GetExternalElement(index); | 7381 MaybeObject* maybe_value = GetExternalElement(index); |
| 7378 if (!value->ToObjectUnchecked()->IsUndefined()) return value; | 7382 Object* value; |
| 7383 if (!maybe_value->ToObject(&value)) return maybe_value; |
| 7384 if (!value->IsUndefined()) return value; |
| 7379 break; | 7385 break; |
| 7380 } | 7386 } |
| 7381 case DICTIONARY_ELEMENTS: { | 7387 case DICTIONARY_ELEMENTS: { |
| 7382 NumberDictionary* dictionary = element_dictionary(); | 7388 NumberDictionary* dictionary = element_dictionary(); |
| 7383 int entry = dictionary->FindEntry(index); | 7389 int entry = dictionary->FindEntry(index); |
| 7384 if (entry != NumberDictionary::kNotFound) { | 7390 if (entry != NumberDictionary::kNotFound) { |
| 7385 Object* element = dictionary->ValueAt(entry); | 7391 Object* element = dictionary->ValueAt(entry); |
| 7386 PropertyDetails details = dictionary->DetailsAt(entry); | 7392 PropertyDetails details = dictionary->DetailsAt(entry); |
| 7387 if (details.type() == CALLBACKS) { | 7393 if (details.type() == CALLBACKS) { |
| 7388 return GetElementWithCallback(receiver, | 7394 return GetElementWithCallback(receiver, |
| (...skipping 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10010 if (break_point_objects()->IsUndefined()) return 0; | 10016 if (break_point_objects()->IsUndefined()) return 0; |
| 10011 // Single beak point. | 10017 // Single beak point. |
| 10012 if (!break_point_objects()->IsFixedArray()) return 1; | 10018 if (!break_point_objects()->IsFixedArray()) return 1; |
| 10013 // Multiple break points. | 10019 // Multiple break points. |
| 10014 return FixedArray::cast(break_point_objects())->length(); | 10020 return FixedArray::cast(break_point_objects())->length(); |
| 10015 } | 10021 } |
| 10016 #endif | 10022 #endif |
| 10017 | 10023 |
| 10018 | 10024 |
| 10019 } } // namespace v8::internal | 10025 } } // namespace v8::internal |
| OLD | NEW |