OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 if (IsJSGlobalProxy()) { | 2675 if (IsJSGlobalProxy()) { |
2676 Object* proto = GetPrototype(); | 2676 Object* proto = GetPrototype(); |
2677 if (proto->IsNull()) return value; | 2677 if (proto->IsNull()) return value; |
2678 ASSERT(proto->IsJSGlobalObject()); | 2678 ASSERT(proto->IsJSGlobalObject()); |
2679 return JSObject::cast(proto)->SetLocalPropertyIgnoreAttributes( | 2679 return JSObject::cast(proto)->SetLocalPropertyIgnoreAttributes( |
2680 name, | 2680 name, |
2681 value, | 2681 value, |
2682 attributes); | 2682 attributes); |
2683 } | 2683 } |
2684 | 2684 |
2685 // Check for accessor in prototype chain removed here in clone. | 2685 // Unlike SetLocalProperty, we ignore the prototype chain and |
| 2686 // any accessors in it. |
2686 if (!result.IsFound()) { | 2687 if (!result.IsFound()) { |
2687 // Neither properties nor transitions found. | 2688 // Neither properties nor transitions found. |
2688 return AddProperty(name, value, attributes, kNonStrictMode); | 2689 return AddProperty(name, value, attributes, kNonStrictMode); |
2689 } | 2690 } |
2690 | 2691 |
2691 PropertyDetails details = PropertyDetails(attributes, NORMAL); | 2692 PropertyDetails details = PropertyDetails(attributes, NORMAL); |
2692 | 2693 |
2693 // Check of IsReadOnly removed from here in clone. | 2694 // Check of IsReadOnly removed from here in clone. |
2694 switch (result.type()) { | 2695 switch (result.type()) { |
2695 case NORMAL: | 2696 case NORMAL: |
(...skipping 7232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9928 public: | 9929 public: |
9929 explicit SubStringAsciiSymbolKey(Handle<SeqAsciiString> string, | 9930 explicit SubStringAsciiSymbolKey(Handle<SeqAsciiString> string, |
9930 int from, | 9931 int from, |
9931 int length) | 9932 int length) |
9932 : string_(string), from_(from), length_(length) { } | 9933 : string_(string), from_(from), length_(length) { } |
9933 | 9934 |
9934 uint32_t Hash() { | 9935 uint32_t Hash() { |
9935 ASSERT(length_ >= 0); | 9936 ASSERT(length_ >= 0); |
9936 ASSERT(from_ + length_ <= string_->length()); | 9937 ASSERT(from_ + length_ <= string_->length()); |
9937 StringHasher hasher(length_); | 9938 StringHasher hasher(length_); |
| 9939 AssertNoAllocation no_alloc; |
| 9940 const char* chars = string_->GetChars() + from_; |
9938 | 9941 |
9939 // Very long strings have a trivial hash that doesn't inspect the | 9942 // Very long strings have a trivial hash that doesn't inspect the |
9940 // string contents. | 9943 // string contents. |
9941 if (hasher.has_trivial_hash()) { | 9944 if (hasher.has_trivial_hash()) { |
9942 hash_field_ = hasher.GetHashField(); | 9945 hash_field_ = hasher.GetHashField(); |
9943 } else { | 9946 } else { |
9944 int i = 0; | 9947 int i = 0; |
9945 // Do the iterative array index computation as long as there is a | 9948 // Do the iterative array index computation as long as there is a |
9946 // chance this is an array index. | 9949 // chance this is an array index. |
9947 while (i < length_ && hasher.is_array_index()) { | 9950 while (i < length_ && hasher.is_array_index()) { |
9948 hasher.AddCharacter(static_cast<uc32>( | 9951 hasher.AddCharacter(static_cast<uc32>(chars[i])); |
9949 string_->SeqAsciiStringGet(i + from_))); | |
9950 i++; | 9952 i++; |
9951 } | 9953 } |
9952 | 9954 |
9953 // Process the remaining characters without updating the array | 9955 // Process the remaining characters without updating the array |
9954 // index. | 9956 // index. |
9955 while (i < length_) { | 9957 while (i < length_) { |
9956 hasher.AddCharacterNoIndex(static_cast<uc32>( | 9958 hasher.AddCharacterNoIndex(static_cast<uc32>(chars[i])); |
9957 string_->SeqAsciiStringGet(i + from_))); | |
9958 i++; | 9959 i++; |
9959 } | 9960 } |
9960 hash_field_ = hasher.GetHashField(); | 9961 hash_field_ = hasher.GetHashField(); |
9961 } | 9962 } |
9962 | 9963 |
9963 uint32_t result = hash_field_ >> String::kHashShift; | 9964 uint32_t result = hash_field_ >> String::kHashShift; |
9964 ASSERT(result != 0); // Ensure that the hash value of 0 is never computed. | 9965 ASSERT(result != 0); // Ensure that the hash value of 0 is never computed. |
9965 return result; | 9966 return result; |
9966 } | 9967 } |
9967 | 9968 |
(...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11884 if (break_point_objects()->IsUndefined()) return 0; | 11885 if (break_point_objects()->IsUndefined()) return 0; |
11885 // Single break point. | 11886 // Single break point. |
11886 if (!break_point_objects()->IsFixedArray()) return 1; | 11887 if (!break_point_objects()->IsFixedArray()) return 1; |
11887 // Multiple break points. | 11888 // Multiple break points. |
11888 return FixedArray::cast(break_point_objects())->length(); | 11889 return FixedArray::cast(break_point_objects())->length(); |
11889 } | 11890 } |
11890 #endif | 11891 #endif |
11891 | 11892 |
11892 | 11893 |
11893 } } // namespace v8::internal | 11894 } } // namespace v8::internal |
OLD | NEW |