| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 return FastPropertyAtPut(index, value); | 1223 return FastPropertyAtPut(index, value); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 | 1226 |
| 1227 Object* JSObject::AddFastProperty(String* name, | 1227 Object* JSObject::AddFastProperty(String* name, |
| 1228 Object* value, | 1228 Object* value, |
| 1229 PropertyAttributes attributes) { | 1229 PropertyAttributes attributes) { |
| 1230 // Normalize the object if the name is an actual string (not the | 1230 // Normalize the object if the name is an actual string (not the |
| 1231 // hidden symbols) and is not a real identifier. | 1231 // hidden symbols) and is not a real identifier. |
| 1232 StringInputBuffer buffer(name); | 1232 StringInputBuffer buffer(name); |
| 1233 if (!Scanner::IsIdentifier(&buffer) && name != HEAP->hidden_symbol()) { | 1233 Isolate* isolate = Isolate::Current(); |
| 1234 if (!isolate->scanner_character_classes()->IsIdentifier(&buffer) && |
| 1235 name != isolate->heap()->hidden_symbol()) { |
| 1234 Object* obj = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); | 1236 Object* obj = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); |
| 1235 if (obj->IsFailure()) return obj; | 1237 if (obj->IsFailure()) return obj; |
| 1236 return AddSlowProperty(name, value, attributes); | 1238 return AddSlowProperty(name, value, attributes); |
| 1237 } | 1239 } |
| 1238 | 1240 |
| 1239 DescriptorArray* old_descriptors = map()->instance_descriptors(); | 1241 DescriptorArray* old_descriptors = map()->instance_descriptors(); |
| 1240 // Compute the new index for new field. | 1242 // Compute the new index for new field. |
| 1241 int index = map()->NextFreePropertyIndex(); | 1243 int index = map()->NextFreePropertyIndex(); |
| 1242 | 1244 |
| 1243 // Allocate new instance descriptors with (name, index) added | 1245 // Allocate new instance descriptors with (name, index) added |
| (...skipping 3506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4750 this->set_map(HEAP->undetectable_ascii_string_map()); | 4752 this->set_map(HEAP->undetectable_ascii_string_map()); |
| 4751 return true; | 4753 return true; |
| 4752 } | 4754 } |
| 4753 // Rest cannot be marked as undetectable | 4755 // Rest cannot be marked as undetectable |
| 4754 return false; | 4756 return false; |
| 4755 } | 4757 } |
| 4756 | 4758 |
| 4757 | 4759 |
| 4758 bool String::IsEqualTo(Vector<const char> str) { | 4760 bool String::IsEqualTo(Vector<const char> str) { |
| 4759 int slen = length(); | 4761 int slen = length(); |
| 4760 Access<Scanner::Utf8Decoder> decoder(Scanner::utf8_decoder()); | 4762 Access<Scanner::Utf8Decoder> decoder(Isolate::Current()-> |
| 4763 scanner_character_classes()->utf8_decoder()); |
| 4761 decoder->Reset(str.start(), str.length()); | 4764 decoder->Reset(str.start(), str.length()); |
| 4762 int i; | 4765 int i; |
| 4763 for (i = 0; i < slen && decoder->has_more(); i++) { | 4766 for (i = 0; i < slen && decoder->has_more(); i++) { |
| 4764 uc32 r = decoder->GetNext(); | 4767 uc32 r = decoder->GetNext(); |
| 4765 if (Get(i) != r) return false; | 4768 if (Get(i) != r) return false; |
| 4766 } | 4769 } |
| 4767 return i == slen && !decoder->has_more(); | 4770 return i == slen && !decoder->has_more(); |
| 4768 } | 4771 } |
| 4769 | 4772 |
| 4770 | 4773 |
| (...skipping 3947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8718 if (break_point_objects()->IsUndefined()) return 0; | 8721 if (break_point_objects()->IsUndefined()) return 0; |
| 8719 // Single beak point. | 8722 // Single beak point. |
| 8720 if (!break_point_objects()->IsFixedArray()) return 1; | 8723 if (!break_point_objects()->IsFixedArray()) return 1; |
| 8721 // Multiple break points. | 8724 // Multiple break points. |
| 8722 return FixedArray::cast(break_point_objects())->length(); | 8725 return FixedArray::cast(break_point_objects())->length(); |
| 8723 } | 8726 } |
| 8724 #endif | 8727 #endif |
| 8725 | 8728 |
| 8726 | 8729 |
| 8727 } } // namespace v8::internal | 8730 } } // namespace v8::internal |
| OLD | NEW |