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, | 5044 js_object, name, obj_value, attr, PERFORM_EXTENSIBILITY_CHECK, |
5045 JSReceiver::PERFORM_EXTENSIBILITY_CHECK, | 5045 JSReceiver::MAY_BE_STORE_FROM_KEYED, JSObject::DONT_FORCE_FIELD)); |
5046 JSReceiver::MAY_BE_STORE_FROM_KEYED, | |
5047 JSObject::DONT_FORCE_FIELD)); | |
5048 return *result; | 5046 return *result; |
5049 } | 5047 } |
5050 | 5048 |
5051 Handle<Object> result; | 5049 Handle<Object> result; |
5052 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 5050 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
5053 isolate, result, | 5051 isolate, result, |
5054 Runtime::DefineObjectProperty( | 5052 Runtime::DefineObjectProperty( |
5055 js_object, name, obj_value, attr, | 5053 js_object, name, obj_value, attr, |
5056 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED)); | 5054 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED)); |
5057 return *result; | 5055 return *result; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5191 } | 5189 } |
5192 | 5190 |
5193 if (key->IsName()) { | 5191 if (key->IsName()) { |
5194 Handle<Name> name = Handle<Name>::cast(key); | 5192 Handle<Name> name = Handle<Name>::cast(key); |
5195 if (name->AsArrayIndex(&index)) { | 5193 if (name->AsArrayIndex(&index)) { |
5196 return JSObject::SetElement(js_object, index, value, attr, | 5194 return JSObject::SetElement(js_object, index, value, attr, |
5197 SLOPPY, false, DEFINE_PROPERTY); | 5195 SLOPPY, false, DEFINE_PROPERTY); |
5198 } else { | 5196 } else { |
5199 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name)); | 5197 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name)); |
5200 return JSObject::SetOwnPropertyIgnoreAttributes( | 5198 return JSObject::SetOwnPropertyIgnoreAttributes( |
5201 js_object, name, value, attr, JSReceiver::PERFORM_EXTENSIBILITY_CHECK, | 5199 js_object, name, value, attr, PERFORM_EXTENSIBILITY_CHECK, |
5202 store_from_keyed); | 5200 store_from_keyed); |
5203 } | 5201 } |
5204 } | 5202 } |
5205 | 5203 |
5206 // Call-back into JavaScript to convert the key to a string. | 5204 // Call-back into JavaScript to convert the key to a string. |
5207 Handle<Object> converted; | 5205 Handle<Object> converted; |
5208 ASSIGN_RETURN_ON_EXCEPTION( | 5206 ASSIGN_RETURN_ON_EXCEPTION( |
5209 isolate, converted, Execution::ToString(isolate, key), Object); | 5207 isolate, converted, Execution::ToString(isolate, key), Object); |
5210 Handle<String> name = Handle<String>::cast(converted); | 5208 Handle<String> name = Handle<String>::cast(converted); |
5211 | 5209 |
5212 if (name->AsArrayIndex(&index)) { | 5210 if (name->AsArrayIndex(&index)) { |
5213 return JSObject::SetElement(js_object, index, value, attr, | 5211 return JSObject::SetElement(js_object, index, value, attr, |
5214 SLOPPY, false, DEFINE_PROPERTY); | 5212 SLOPPY, false, DEFINE_PROPERTY); |
5215 } else { | 5213 } else { |
5216 return JSObject::SetOwnPropertyIgnoreAttributes( | 5214 return JSObject::SetOwnPropertyIgnoreAttributes( |
5217 js_object, name, value, attr, JSReceiver::PERFORM_EXTENSIBILITY_CHECK, | 5215 js_object, name, value, attr, PERFORM_EXTENSIBILITY_CHECK, |
5218 store_from_keyed); | 5216 store_from_keyed); |
5219 } | 5217 } |
5220 } | 5218 } |
5221 | 5219 |
5222 | 5220 |
5223 MaybeHandle<Object> Runtime::DeleteObjectProperty(Isolate* isolate, | 5221 MaybeHandle<Object> Runtime::DeleteObjectProperty(Isolate* isolate, |
5224 Handle<JSReceiver> receiver, | 5222 Handle<JSReceiver> receiver, |
5225 Handle<Object> key, | 5223 Handle<Object> key, |
5226 JSReceiver::DeleteMode mode) { | 5224 JSReceiver::DeleteMode mode) { |
5227 // Check if the given key is an array index. | 5225 // Check if the given key is an array index. |
(...skipping 10402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15630 } | 15628 } |
15631 return NULL; | 15629 return NULL; |
15632 } | 15630 } |
15633 | 15631 |
15634 | 15632 |
15635 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15633 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15636 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15634 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15637 } | 15635 } |
15638 | 15636 |
15639 } } // namespace v8::internal | 15637 } } // namespace v8::internal |
OLD | NEW |