OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } else if (IsBoolean()) { | 76 } else if (IsBoolean()) { |
77 return CreateJSValue(native_context->boolean_function(), this); | 77 return CreateJSValue(native_context->boolean_function(), this); |
78 } else if (IsString()) { | 78 } else if (IsString()) { |
79 return CreateJSValue(native_context->string_function(), this); | 79 return CreateJSValue(native_context->string_function(), this); |
80 } | 80 } |
81 ASSERT(IsJSObject()); | 81 ASSERT(IsJSObject()); |
82 return this; | 82 return this; |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 MaybeObject* Object::ToObject() { | 86 MaybeObject* Object::ToObject(Isolate* isolate) { |
87 if (IsJSReceiver()) { | 87 if (IsJSReceiver()) { |
88 return this; | 88 return this; |
89 } else if (IsNumber()) { | 89 } else if (IsNumber()) { |
90 Isolate* isolate = Isolate::Current(); | |
91 Context* native_context = isolate->context()->native_context(); | 90 Context* native_context = isolate->context()->native_context(); |
92 return CreateJSValue(native_context->number_function(), this); | 91 return CreateJSValue(native_context->number_function(), this); |
93 } else if (IsBoolean()) { | 92 } else if (IsBoolean()) { |
94 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); | |
95 Context* native_context = isolate->context()->native_context(); | 93 Context* native_context = isolate->context()->native_context(); |
96 return CreateJSValue(native_context->boolean_function(), this); | 94 return CreateJSValue(native_context->boolean_function(), this); |
97 } else if (IsString()) { | 95 } else if (IsString()) { |
98 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); | |
99 Context* native_context = isolate->context()->native_context(); | 96 Context* native_context = isolate->context()->native_context(); |
100 return CreateJSValue(native_context->string_function(), this); | 97 return CreateJSValue(native_context->string_function(), this); |
101 } else if (IsSymbol()) { | 98 } else if (IsSymbol()) { |
102 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); | |
103 Context* native_context = isolate->context()->native_context(); | 99 Context* native_context = isolate->context()->native_context(); |
104 return CreateJSValue(native_context->symbol_function(), this); | 100 return CreateJSValue(native_context->symbol_function(), this); |
105 } | 101 } |
106 | 102 |
107 // Throw a type error. | 103 // Throw a type error. |
108 return Failure::InternalError(); | 104 return Failure::InternalError(); |
109 } | 105 } |
110 | 106 |
111 | 107 |
112 bool Object::BooleanValue() { | 108 bool Object::BooleanValue() { |
(...skipping 15 matching lines...) Expand all Loading... |
128 Context* native_context = result->isolate()->context()->native_context(); | 124 Context* native_context = result->isolate()->context()->native_context(); |
129 if (IsNumber()) { | 125 if (IsNumber()) { |
130 holder = native_context->number_function()->instance_prototype(); | 126 holder = native_context->number_function()->instance_prototype(); |
131 } else if (IsString()) { | 127 } else if (IsString()) { |
132 holder = native_context->string_function()->instance_prototype(); | 128 holder = native_context->string_function()->instance_prototype(); |
133 } else if (IsSymbol()) { | 129 } else if (IsSymbol()) { |
134 holder = native_context->symbol_function()->instance_prototype(); | 130 holder = native_context->symbol_function()->instance_prototype(); |
135 } else if (IsBoolean()) { | 131 } else if (IsBoolean()) { |
136 holder = native_context->boolean_function()->instance_prototype(); | 132 holder = native_context->boolean_function()->instance_prototype(); |
137 } else { | 133 } else { |
138 Isolate::Current()->PushStackTraceAndDie( | 134 result->isolate()->PushStackTraceAndDie( |
139 0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001); | 135 0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001); |
140 } | 136 } |
141 } | 137 } |
142 ASSERT(holder != NULL); // Cannot handle null or undefined. | 138 ASSERT(holder != NULL); // Cannot handle null or undefined. |
143 JSReceiver::cast(holder)->Lookup(name, result); | 139 JSReceiver::cast(holder)->Lookup(name, result); |
144 } | 140 } |
145 | 141 |
146 | 142 |
147 MaybeObject* Object::GetPropertyWithReceiver(Object* receiver, | 143 MaybeObject* Object::GetPropertyWithReceiver(Object* receiver, |
148 Name* name, | 144 Name* name, |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 | 411 |
416 Handle<Object> args[] = { receiver, name }; | 412 Handle<Object> args[] = { receiver, name }; |
417 Handle<Object> result = CallTrap( | 413 Handle<Object> result = CallTrap( |
418 "get", isolate->derived_get_trap(), ARRAY_SIZE(args), args); | 414 "get", isolate->derived_get_trap(), ARRAY_SIZE(args), args); |
419 if (isolate->has_pending_exception()) return Failure::Exception(); | 415 if (isolate->has_pending_exception()) return Failure::Exception(); |
420 | 416 |
421 return *result; | 417 return *result; |
422 } | 418 } |
423 | 419 |
424 | 420 |
425 Handle<Object> Object::GetProperty(Handle<Object> object, Handle<Name> name) { | 421 Handle<Object> Object::GetProperty(Handle<Object> object, |
| 422 Handle<Name> name) { |
426 // TODO(rossberg): The index test should not be here but in the GetProperty | 423 // TODO(rossberg): The index test should not be here but in the GetProperty |
427 // method (or somewhere else entirely). Needs more global clean-up. | 424 // method (or somewhere else entirely). Needs more global clean-up. |
428 uint32_t index; | 425 uint32_t index; |
| 426 Isolate* isolate = name->GetIsolate(); |
429 if (name->AsArrayIndex(&index)) | 427 if (name->AsArrayIndex(&index)) |
430 return GetElement(object, index); | 428 return GetElement(isolate, object, index); |
431 Isolate* isolate = object->IsHeapObject() | |
432 ? Handle<HeapObject>::cast(object)->GetIsolate() | |
433 : Isolate::Current(); | |
434 CALL_HEAP_FUNCTION(isolate, object->GetProperty(*name), Object); | 429 CALL_HEAP_FUNCTION(isolate, object->GetProperty(*name), Object); |
435 } | 430 } |
436 | 431 |
437 | 432 |
438 Handle<Object> Object::GetElement(Handle<Object> object, uint32_t index) { | 433 Handle<Object> Object::GetElement(Isolate* isolate, |
439 Isolate* isolate = object->IsHeapObject() | 434 Handle<Object> object, |
440 ? Handle<HeapObject>::cast(object)->GetIsolate() | 435 uint32_t index) { |
441 : Isolate::Current(); | 436 CALL_HEAP_FUNCTION(isolate, object->GetElement(isolate, index), Object); |
442 CALL_HEAP_FUNCTION(isolate, object->GetElement(index), Object); | |
443 } | 437 } |
444 | 438 |
445 | 439 |
446 MaybeObject* JSProxy::GetElementWithHandler(Object* receiver, | 440 MaybeObject* JSProxy::GetElementWithHandler(Object* receiver, |
447 uint32_t index) { | 441 uint32_t index) { |
448 String* name; | 442 String* name; |
449 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | 443 MaybeObject* maybe = GetHeap()->Uint32ToString(index); |
450 if (!maybe->To<String>(&name)) return maybe; | 444 if (!maybe->To<String>(&name)) return maybe; |
451 return GetPropertyWithHandler(receiver, name); | 445 return GetPropertyWithHandler(receiver, name); |
452 } | 446 } |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 || !HasFastObjectElements() | 788 || !HasFastObjectElements() |
795 || !HasFastProperties(); | 789 || !HasFastProperties(); |
796 } | 790 } |
797 | 791 |
798 | 792 |
799 Handle<Object> Object::GetProperty(Handle<Object> object, | 793 Handle<Object> Object::GetProperty(Handle<Object> object, |
800 Handle<Object> receiver, | 794 Handle<Object> receiver, |
801 LookupResult* result, | 795 LookupResult* result, |
802 Handle<Name> key, | 796 Handle<Name> key, |
803 PropertyAttributes* attributes) { | 797 PropertyAttributes* attributes) { |
804 Isolate* isolate = object->IsHeapObject() | 798 Isolate* isolate = result->isolate(); |
805 ? Handle<HeapObject>::cast(object)->GetIsolate() | |
806 : Isolate::Current(); | |
807 CALL_HEAP_FUNCTION( | 799 CALL_HEAP_FUNCTION( |
808 isolate, | 800 isolate, |
809 object->GetProperty(*receiver, result, *key, attributes), | 801 object->GetProperty(*receiver, result, *key, attributes), |
810 Object); | 802 Object); |
811 } | 803 } |
812 | 804 |
813 | 805 |
814 MaybeObject* Object::GetPropertyOrFail(Handle<Object> object, | 806 MaybeObject* Object::GetPropertyOrFail(Handle<Object> object, |
815 Handle<Object> receiver, | 807 Handle<Object> receiver, |
816 LookupResult* result, | 808 LookupResult* result, |
817 Handle<Name> key, | 809 Handle<Name> key, |
818 PropertyAttributes* attributes) { | 810 PropertyAttributes* attributes) { |
819 Isolate* isolate = object->IsHeapObject() | 811 Isolate* isolate = result->isolate(); |
820 ? Handle<HeapObject>::cast(object)->GetIsolate() | |
821 : Isolate::Current(); | |
822 CALL_HEAP_FUNCTION_PASS_EXCEPTION( | 812 CALL_HEAP_FUNCTION_PASS_EXCEPTION( |
823 isolate, | 813 isolate, |
824 object->GetProperty(*receiver, result, *key, attributes)); | 814 object->GetProperty(*receiver, result, *key, attributes)); |
825 } | 815 } |
826 | 816 |
827 | 817 |
828 MaybeObject* Object::GetProperty(Object* receiver, | 818 MaybeObject* Object::GetProperty(Object* receiver, |
829 LookupResult* result, | 819 LookupResult* result, |
830 Name* name, | 820 Name* name, |
831 PropertyAttributes* attributes) { | 821 PropertyAttributes* attributes) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 case TRANSITION: | 893 case TRANSITION: |
904 case NONEXISTENT: | 894 case NONEXISTENT: |
905 UNREACHABLE(); | 895 UNREACHABLE(); |
906 break; | 896 break; |
907 } | 897 } |
908 UNREACHABLE(); | 898 UNREACHABLE(); |
909 return NULL; | 899 return NULL; |
910 } | 900 } |
911 | 901 |
912 | 902 |
913 MaybeObject* Object::GetElementWithReceiver(Object* receiver, uint32_t index) { | 903 MaybeObject* Object::GetElementWithReceiver(Isolate* isolate, |
914 Isolate* isolate = IsSmi() | 904 Object* receiver, |
915 ? Isolate::Current() | 905 uint32_t index) { |
916 : HeapObject::cast(this)->GetIsolate(); | |
917 Heap* heap = isolate->heap(); | 906 Heap* heap = isolate->heap(); |
918 Object* holder = this; | 907 Object* holder = this; |
919 | 908 |
920 // Iterate up the prototype chain until an element is found or the null | 909 // Iterate up the prototype chain until an element is found or the null |
921 // prototype is encountered. | 910 // prototype is encountered. |
922 for (holder = this; | 911 for (holder = this; |
923 holder != heap->null_value(); | 912 holder != heap->null_value(); |
924 holder = holder->GetPrototype(isolate)) { | 913 holder = holder->GetPrototype(isolate)) { |
925 if (!holder->IsJSObject()) { | 914 if (!holder->IsJSObject()) { |
926 Context* native_context = isolate->context()->native_context(); | 915 Context* native_context = isolate->context()->native_context(); |
(...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4060 // From this point on everything needs to be handlified. | 4049 // From this point on everything needs to be handlified. |
4061 HandleScope scope(isolate); | 4050 HandleScope scope(isolate); |
4062 Handle<JSObject> self(this); | 4051 Handle<JSObject> self(this); |
4063 Handle<Name> name(name_raw); | 4052 Handle<Name> name(name_raw); |
4064 Handle<Object> value(value_raw, isolate); | 4053 Handle<Object> value(value_raw, isolate); |
4065 | 4054 |
4066 Handle<Object> old_value(isolate->heap()->the_hole_value(), isolate); | 4055 Handle<Object> old_value(isolate->heap()->the_hole_value(), isolate); |
4067 PropertyAttributes old_attributes = ABSENT; | 4056 PropertyAttributes old_attributes = ABSENT; |
4068 bool is_observed = FLAG_harmony_observation && self->map()->is_observed(); | 4057 bool is_observed = FLAG_harmony_observation && self->map()->is_observed(); |
4069 if (is_observed && lookup.IsProperty()) { | 4058 if (is_observed && lookup.IsProperty()) { |
4070 if (lookup.IsDataProperty()) old_value = Object::GetProperty(self, name); | 4059 if (lookup.IsDataProperty()) old_value = |
| 4060 Object::GetProperty(self, name); |
4071 old_attributes = lookup.GetAttributes(); | 4061 old_attributes = lookup.GetAttributes(); |
4072 } | 4062 } |
4073 | 4063 |
4074 // Check of IsReadOnly removed from here in clone. | 4064 // Check of IsReadOnly removed from here in clone. |
4075 MaybeObject* result = *value; | 4065 MaybeObject* result = *value; |
4076 switch (lookup.type()) { | 4066 switch (lookup.type()) { |
4077 case NORMAL: | 4067 case NORMAL: |
4078 result = self->ReplaceSlowProperty(*name, *value, attributes); | 4068 result = self->ReplaceSlowProperty(*name, *value, attributes); |
4079 break; | 4069 break; |
4080 case FIELD: | 4070 case FIELD: |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5086 return DeleteElement(Handle<JSObject>::cast(proto), index, mode); | 5076 return DeleteElement(Handle<JSObject>::cast(proto), index, mode); |
5087 } | 5077 } |
5088 | 5078 |
5089 Handle<Object> old_value; | 5079 Handle<Object> old_value; |
5090 bool should_enqueue_change_record = false; | 5080 bool should_enqueue_change_record = false; |
5091 if (FLAG_harmony_observation && object->map()->is_observed()) { | 5081 if (FLAG_harmony_observation && object->map()->is_observed()) { |
5092 should_enqueue_change_record = object->HasLocalElement(index); | 5082 should_enqueue_change_record = object->HasLocalElement(index); |
5093 if (should_enqueue_change_record) { | 5083 if (should_enqueue_change_record) { |
5094 old_value = object->GetLocalElementAccessorPair(index) != NULL | 5084 old_value = object->GetLocalElementAccessorPair(index) != NULL |
5095 ? Handle<Object>::cast(factory->the_hole_value()) | 5085 ? Handle<Object>::cast(factory->the_hole_value()) |
5096 : Object::GetElement(object, index); | 5086 : Object::GetElement(isolate, object, index); |
5097 } | 5087 } |
5098 } | 5088 } |
5099 | 5089 |
5100 // Skip interceptor if forcing deletion. | 5090 // Skip interceptor if forcing deletion. |
5101 Handle<Object> result; | 5091 Handle<Object> result; |
5102 if (object->HasIndexedInterceptor() && mode != FORCE_DELETION) { | 5092 if (object->HasIndexedInterceptor() && mode != FORCE_DELETION) { |
5103 result = DeleteElementWithInterceptor(object, index); | 5093 result = DeleteElementWithInterceptor(object, index); |
5104 } else { | 5094 } else { |
5105 result = AccessorDelete(object, index, mode); | 5095 result = AccessorDelete(object, index, mode); |
5106 } | 5096 } |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6122 uint32_t index = 0; | 6112 uint32_t index = 0; |
6123 bool is_element = name->AsArrayIndex(&index); | 6113 bool is_element = name->AsArrayIndex(&index); |
6124 | 6114 |
6125 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 6115 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
6126 bool is_observed = FLAG_harmony_observation && object->map()->is_observed(); | 6116 bool is_observed = FLAG_harmony_observation && object->map()->is_observed(); |
6127 bool preexists = false; | 6117 bool preexists = false; |
6128 if (is_observed) { | 6118 if (is_observed) { |
6129 if (is_element) { | 6119 if (is_element) { |
6130 preexists = object->HasLocalElement(index); | 6120 preexists = object->HasLocalElement(index); |
6131 if (preexists && object->GetLocalElementAccessorPair(index) == NULL) { | 6121 if (preexists && object->GetLocalElementAccessorPair(index) == NULL) { |
6132 old_value = Object::GetElement(object, index); | 6122 old_value = Object::GetElement(isolate, object, index); |
6133 } | 6123 } |
6134 } else { | 6124 } else { |
6135 LookupResult lookup(isolate); | 6125 LookupResult lookup(isolate); |
6136 object->LocalLookup(*name, &lookup, true); | 6126 object->LocalLookup(*name, &lookup, true); |
6137 preexists = lookup.IsProperty(); | 6127 preexists = lookup.IsProperty(); |
6138 if (preexists && lookup.IsDataProperty()) { | 6128 if (preexists && lookup.IsDataProperty()) { |
6139 old_value = Object::GetProperty(object, name); | 6129 old_value = Object::GetProperty(object, name); |
6140 } | 6130 } |
6141 } | 6131 } |
6142 } | 6132 } |
(...skipping 4815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10958 // no further old values need be collected. | 10948 // no further old values need be collected. |
10959 static bool GetOldValue(Isolate* isolate, | 10949 static bool GetOldValue(Isolate* isolate, |
10960 Handle<JSObject> object, | 10950 Handle<JSObject> object, |
10961 uint32_t index, | 10951 uint32_t index, |
10962 List<Handle<Object> >* old_values, | 10952 List<Handle<Object> >* old_values, |
10963 List<uint32_t>* indices) { | 10953 List<uint32_t>* indices) { |
10964 PropertyAttributes attributes = object->GetLocalElementAttribute(index); | 10954 PropertyAttributes attributes = object->GetLocalElementAttribute(index); |
10965 ASSERT(attributes != ABSENT); | 10955 ASSERT(attributes != ABSENT); |
10966 if (attributes == DONT_DELETE) return false; | 10956 if (attributes == DONT_DELETE) return false; |
10967 old_values->Add(object->GetLocalElementAccessorPair(index) == NULL | 10957 old_values->Add(object->GetLocalElementAccessorPair(index) == NULL |
10968 ? Object::GetElement(object, index) | 10958 ? Object::GetElement(isolate, object, index) |
10969 : Handle<Object>::cast(isolate->factory()->the_hole_value())); | 10959 : Handle<Object>::cast(isolate->factory()->the_hole_value())); |
10970 indices->Add(index); | 10960 indices->Add(index); |
10971 return true; | 10961 return true; |
10972 } | 10962 } |
10973 | 10963 |
10974 static void EnqueueSpliceRecord(Handle<JSArray> object, | 10964 static void EnqueueSpliceRecord(Handle<JSArray> object, |
10975 uint32_t index, | 10965 uint32_t index, |
10976 Handle<JSArray> deleted, | 10966 Handle<JSArray> deleted, |
10977 uint32_t add_count) { | 10967 uint32_t add_count) { |
10978 Isolate* isolate = object->GetIsolate(); | 10968 Isolate* isolate = object->GetIsolate(); |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12198 // From here on, everything has to be handlified. | 12188 // From here on, everything has to be handlified. |
12199 Handle<JSObject> self(this); | 12189 Handle<JSObject> self(this); |
12200 Handle<Object> value(value_raw, isolate); | 12190 Handle<Object> value(value_raw, isolate); |
12201 PropertyAttributes old_attributes = self->GetLocalElementAttribute(index); | 12191 PropertyAttributes old_attributes = self->GetLocalElementAttribute(index); |
12202 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 12192 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
12203 Handle<Object> old_length_handle; | 12193 Handle<Object> old_length_handle; |
12204 Handle<Object> new_length_handle; | 12194 Handle<Object> new_length_handle; |
12205 | 12195 |
12206 if (old_attributes != ABSENT) { | 12196 if (old_attributes != ABSENT) { |
12207 if (self->GetLocalElementAccessorPair(index) == NULL) | 12197 if (self->GetLocalElementAccessorPair(index) == NULL) |
12208 old_value = Object::GetElement(self, index); | 12198 old_value = Object::GetElement(isolate, self, index); |
12209 } else if (self->IsJSArray()) { | 12199 } else if (self->IsJSArray()) { |
12210 // Store old array length in case adding an element grows the array. | 12200 // Store old array length in case adding an element grows the array. |
12211 old_length_handle = handle(Handle<JSArray>::cast(self)->length(), isolate); | 12201 old_length_handle = handle(Handle<JSArray>::cast(self)->length(), isolate); |
12212 } | 12202 } |
12213 | 12203 |
12214 // Check for lookup interceptor | 12204 // Check for lookup interceptor |
12215 MaybeObject* result = self->HasIndexedInterceptor() | 12205 MaybeObject* result = self->HasIndexedInterceptor() |
12216 ? self->SetElementWithInterceptor( | 12206 ? self->SetElementWithInterceptor( |
12217 index, *value, attributes, strict_mode, check_prototype, set_mode) | 12207 index, *value, attributes, strict_mode, check_prototype, set_mode) |
12218 : self->SetElementWithoutInterceptor( | 12208 : self->SetElementWithoutInterceptor( |
(...skipping 21 matching lines...) Expand all Loading... |
12240 EndPerformSplice(Handle<JSArray>::cast(self)); | 12230 EndPerformSplice(Handle<JSArray>::cast(self)); |
12241 Handle<JSArray> deleted = isolate->factory()->NewJSArray(0); | 12231 Handle<JSArray> deleted = isolate->factory()->NewJSArray(0); |
12242 EnqueueSpliceRecord(Handle<JSArray>::cast(self), old_length, deleted, | 12232 EnqueueSpliceRecord(Handle<JSArray>::cast(self), old_length, deleted, |
12243 new_length - old_length); | 12233 new_length - old_length); |
12244 } else { | 12234 } else { |
12245 EnqueueChangeRecord(self, "new", name, old_value); | 12235 EnqueueChangeRecord(self, "new", name, old_value); |
12246 } | 12236 } |
12247 } else if (old_value->IsTheHole()) { | 12237 } else if (old_value->IsTheHole()) { |
12248 EnqueueChangeRecord(self, "reconfigured", name, old_value); | 12238 EnqueueChangeRecord(self, "reconfigured", name, old_value); |
12249 } else { | 12239 } else { |
12250 Handle<Object> new_value = Object::GetElement(self, index); | 12240 Handle<Object> new_value = Object::GetElement(isolate, self, index); |
12251 bool value_changed = !old_value->SameValue(*new_value); | 12241 bool value_changed = !old_value->SameValue(*new_value); |
12252 if (old_attributes != new_attributes) { | 12242 if (old_attributes != new_attributes) { |
12253 if (!value_changed) old_value = isolate->factory()->the_hole_value(); | 12243 if (!value_changed) old_value = isolate->factory()->the_hole_value(); |
12254 EnqueueChangeRecord(self, "reconfigured", name, old_value); | 12244 EnqueueChangeRecord(self, "reconfigured", name, old_value); |
12255 } else if (value_changed) { | 12245 } else if (value_changed) { |
12256 EnqueueChangeRecord(self, "updated", name, old_value); | 12246 EnqueueChangeRecord(self, "updated", name, old_value); |
12257 } | 12247 } |
12258 } | 12248 } |
12259 | 12249 |
12260 return *hresult; | 12250 return *hresult; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12568 ElementsAccessor* handler = holder_handle->GetElementsAccessor(); | 12558 ElementsAccessor* handler = holder_handle->GetElementsAccessor(); |
12569 MaybeObject* raw_result = handler->Get(*this_handle, | 12559 MaybeObject* raw_result = handler->Get(*this_handle, |
12570 *holder_handle, | 12560 *holder_handle, |
12571 index); | 12561 index); |
12572 if (raw_result != heap->the_hole_value()) return raw_result; | 12562 if (raw_result != heap->the_hole_value()) return raw_result; |
12573 | 12563 |
12574 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 12564 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
12575 | 12565 |
12576 Object* pt = holder_handle->GetPrototype(); | 12566 Object* pt = holder_handle->GetPrototype(); |
12577 if (pt == heap->null_value()) return heap->undefined_value(); | 12567 if (pt == heap->null_value()) return heap->undefined_value(); |
12578 return pt->GetElementWithReceiver(*this_handle, index); | 12568 return pt->GetElementWithReceiver(isolate, *this_handle, index); |
12579 } | 12569 } |
12580 | 12570 |
12581 | 12571 |
12582 bool JSObject::HasDenseElements() { | 12572 bool JSObject::HasDenseElements() { |
12583 int capacity = 0; | 12573 int capacity = 0; |
12584 int used = 0; | 12574 int used = 0; |
12585 GetElementsCapacityAndUsage(&capacity, &used); | 12575 GetElementsCapacityAndUsage(&capacity, &used); |
12586 return (capacity == 0) || (used > (capacity / 2)); | 12576 return (capacity == 0) || (used > (capacity / 2)); |
12587 } | 12577 } |
12588 | 12578 |
(...skipping 3384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15973 #define ERROR_MESSAGES_TEXTS(C, T) T, | 15963 #define ERROR_MESSAGES_TEXTS(C, T) T, |
15974 static const char* error_messages_[] = { | 15964 static const char* error_messages_[] = { |
15975 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 15965 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
15976 }; | 15966 }; |
15977 #undef ERROR_MESSAGES_TEXTS | 15967 #undef ERROR_MESSAGES_TEXTS |
15978 return error_messages_[reason]; | 15968 return error_messages_[reason]; |
15979 } | 15969 } |
15980 | 15970 |
15981 | 15971 |
15982 } } // namespace v8::internal | 15972 } } // namespace v8::internal |
OLD | NEW |