OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "accessors.h" | 10 #include "accessors.h" |
(...skipping 5171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5182 // Avoid redefining callback as data property, just use the stored | 5182 // Avoid redefining callback as data property, just use the stored |
5183 // setter to update the value instead. | 5183 // setter to update the value instead. |
5184 // TODO(mstarzinger): So far this only works if property attributes don't | 5184 // TODO(mstarzinger): So far this only works if property attributes don't |
5185 // change, this should be fixed once we cleanup the underlying code. | 5185 // change, this should be fixed once we cleanup the underlying code. |
5186 ASSERT(!callback->IsForeign()); | 5186 ASSERT(!callback->IsForeign()); |
5187 if (callback->IsAccessorInfo() && | 5187 if (callback->IsAccessorInfo() && |
5188 lookup.GetAttributes() == attr) { | 5188 lookup.GetAttributes() == attr) { |
5189 Handle<Object> result_object; | 5189 Handle<Object> result_object; |
5190 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 5190 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
5191 isolate, result_object, | 5191 isolate, result_object, |
5192 JSObject::SetPropertyWithCallback(js_object, | 5192 JSObject::SetPropertyWithCallback(js_object, name, obj_value, |
5193 callback, | |
5194 name, | |
5195 obj_value, | |
5196 handle(lookup.holder()), | 5193 handle(lookup.holder()), |
5197 STRICT)); | 5194 callback, STRICT)); |
5198 return *result_object; | 5195 return *result_object; |
5199 } | 5196 } |
5200 } | 5197 } |
5201 | 5198 |
5202 // Take special care when attributes are different and there is already | 5199 // Take special care when attributes are different and there is already |
5203 // a property. For simplicity we normalize the property which enables us | 5200 // a property. For simplicity we normalize the property which enables us |
5204 // to not worry about changing the instance_descriptor and creating a new | 5201 // to not worry about changing the instance_descriptor and creating a new |
5205 // map. The current version of SetObjectProperty does not handle attributes | 5202 // map. The current version of SetObjectProperty does not handle attributes |
5206 // correctly in the case where a property is a field and is reset with | 5203 // correctly in the case where a property is a field and is reset with |
5207 // new attributes. | 5204 // new attributes. |
(...skipping 5575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10783 result->representation(), | 10780 result->representation(), |
10784 result->GetFieldIndex().field_index()); | 10781 result->GetFieldIndex().field_index()); |
10785 break; | 10782 break; |
10786 case CONSTANT: | 10783 case CONSTANT: |
10787 return handle(result->GetConstant(), isolate); | 10784 return handle(result->GetConstant(), isolate); |
10788 case CALLBACKS: { | 10785 case CALLBACKS: { |
10789 Handle<Object> structure(result->GetCallbackObject(), isolate); | 10786 Handle<Object> structure(result->GetCallbackObject(), isolate); |
10790 ASSERT(!structure->IsForeign()); | 10787 ASSERT(!structure->IsForeign()); |
10791 if (structure->IsAccessorInfo()) { | 10788 if (structure->IsAccessorInfo()) { |
10792 MaybeHandle<Object> obj = JSObject::GetPropertyWithCallback( | 10789 MaybeHandle<Object> obj = JSObject::GetPropertyWithCallback( |
10793 handle(result->holder(), isolate), receiver, structure, name); | 10790 receiver, name, handle(result->holder(), isolate), structure); |
10794 if (!obj.ToHandle(&value)) { | 10791 if (!obj.ToHandle(&value)) { |
10795 value = handle(isolate->pending_exception(), isolate); | 10792 value = handle(isolate->pending_exception(), isolate); |
10796 isolate->clear_pending_exception(); | 10793 isolate->clear_pending_exception(); |
10797 if (has_caught != NULL) *has_caught = true; | 10794 if (has_caught != NULL) *has_caught = true; |
10798 return value; | 10795 return value; |
10799 } | 10796 } |
10800 } | 10797 } |
10801 break; | 10798 break; |
10802 } | 10799 } |
10803 case INTERCEPTOR: | 10800 case INTERCEPTOR: |
(...skipping 4367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15171 } | 15168 } |
15172 return NULL; | 15169 return NULL; |
15173 } | 15170 } |
15174 | 15171 |
15175 | 15172 |
15176 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15173 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15177 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15174 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15178 } | 15175 } |
15179 | 15176 |
15180 } } // namespace v8::internal | 15177 } } // namespace v8::internal |
OLD | NEW |