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 "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 5023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5034 // to not worry about changing the instance_descriptor and creating a new | 5034 // to not worry about changing the instance_descriptor and creating a new |
5035 // map. | 5035 // map. |
5036 if (lookup.IsFound() && | 5036 if (lookup.IsFound() && |
5037 (attr != lookup.GetAttributes() || lookup.IsPropertyCallbacks())) { | 5037 (attr != lookup.GetAttributes() || lookup.IsPropertyCallbacks())) { |
5038 // Use IgnoreAttributes version since a readonly property may be | 5038 // Use IgnoreAttributes version since a readonly property may be |
5039 // overridden and SetProperty does not allow this. | 5039 // overridden and SetProperty does not allow this. |
5040 Handle<Object> result; | 5040 Handle<Object> result; |
5041 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 5041 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
5042 isolate, result, | 5042 isolate, result, |
5043 JSObject::SetOwnPropertyIgnoreAttributes( | 5043 JSObject::SetOwnPropertyIgnoreAttributes( |
5044 js_object, name, obj_value, attr, PERFORM_EXTENSIBILITY_CHECK, | 5044 js_object, name, obj_value, attr, |
5045 JSReceiver::MAY_BE_STORE_FROM_KEYED, JSObject::DONT_FORCE_FIELD)); | 5045 JSReceiver::MAY_BE_STORE_FROM_KEYED, JSObject::DONT_FORCE_FIELD)); |
5046 return *result; | 5046 return *result; |
5047 } | 5047 } |
5048 | 5048 |
5049 Handle<Object> result; | 5049 Handle<Object> result; |
5050 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 5050 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
5051 isolate, result, | 5051 isolate, result, |
5052 Runtime::DefineObjectProperty( | 5052 Runtime::DefineObjectProperty( |
5053 js_object, name, obj_value, attr, | 5053 js_object, name, obj_value, attr, |
5054 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED)); | 5054 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED)); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5188 SLOPPY, false, DEFINE_PROPERTY); | 5188 SLOPPY, false, DEFINE_PROPERTY); |
5189 } | 5189 } |
5190 | 5190 |
5191 if (key->IsName()) { | 5191 if (key->IsName()) { |
5192 Handle<Name> name = Handle<Name>::cast(key); | 5192 Handle<Name> name = Handle<Name>::cast(key); |
5193 if (name->AsArrayIndex(&index)) { | 5193 if (name->AsArrayIndex(&index)) { |
5194 return JSObject::SetElement(js_object, index, value, attr, | 5194 return JSObject::SetElement(js_object, index, value, attr, |
5195 SLOPPY, false, DEFINE_PROPERTY); | 5195 SLOPPY, false, DEFINE_PROPERTY); |
5196 } else { | 5196 } else { |
5197 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name)); | 5197 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name)); |
5198 return JSObject::SetOwnPropertyIgnoreAttributes( | 5198 return JSObject::SetOwnPropertyIgnoreAttributes(js_object, name, value, |
5199 js_object, name, value, attr, PERFORM_EXTENSIBILITY_CHECK, | 5199 attr, store_from_keyed); |
5200 store_from_keyed); | |
5201 } | 5200 } |
5202 } | 5201 } |
5203 | 5202 |
5204 // Call-back into JavaScript to convert the key to a string. | 5203 // Call-back into JavaScript to convert the key to a string. |
5205 Handle<Object> converted; | 5204 Handle<Object> converted; |
5206 ASSIGN_RETURN_ON_EXCEPTION( | 5205 ASSIGN_RETURN_ON_EXCEPTION( |
5207 isolate, converted, Execution::ToString(isolate, key), Object); | 5206 isolate, converted, Execution::ToString(isolate, key), Object); |
5208 Handle<String> name = Handle<String>::cast(converted); | 5207 Handle<String> name = Handle<String>::cast(converted); |
5209 | 5208 |
5210 if (name->AsArrayIndex(&index)) { | 5209 if (name->AsArrayIndex(&index)) { |
5211 return JSObject::SetElement(js_object, index, value, attr, | 5210 return JSObject::SetElement(js_object, index, value, attr, |
5212 SLOPPY, false, DEFINE_PROPERTY); | 5211 SLOPPY, false, DEFINE_PROPERTY); |
5213 } else { | 5212 } else { |
5214 return JSObject::SetOwnPropertyIgnoreAttributes( | 5213 return JSObject::SetOwnPropertyIgnoreAttributes(js_object, name, value, |
5215 js_object, name, value, attr, PERFORM_EXTENSIBILITY_CHECK, | 5214 attr, store_from_keyed); |
5216 store_from_keyed); | |
5217 } | 5215 } |
5218 } | 5216 } |
5219 | 5217 |
5220 | 5218 |
5221 MaybeHandle<Object> Runtime::DeleteObjectProperty(Isolate* isolate, | 5219 MaybeHandle<Object> Runtime::DeleteObjectProperty(Isolate* isolate, |
5222 Handle<JSReceiver> receiver, | 5220 Handle<JSReceiver> receiver, |
5223 Handle<Object> key, | 5221 Handle<Object> key, |
5224 JSReceiver::DeleteMode mode) { | 5222 JSReceiver::DeleteMode mode) { |
5225 // Check if the given key is an array index. | 5223 // Check if the given key is an array index. |
5226 uint32_t index; | 5224 uint32_t index; |
(...skipping 10401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15628 } | 15626 } |
15629 return NULL; | 15627 return NULL; |
15630 } | 15628 } |
15631 | 15629 |
15632 | 15630 |
15633 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15631 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15634 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15632 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15635 } | 15633 } |
15636 | 15634 |
15637 } } // namespace v8::internal | 15635 } } // namespace v8::internal |
OLD | NEW |