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 5233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5244 RUNTIME_ASSERT( | 5244 RUNTIME_ASSERT( |
5245 (unchecked_attributes & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 5245 (unchecked_attributes & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
5246 // Compute attributes. | 5246 // Compute attributes. |
5247 PropertyAttributes attributes = | 5247 PropertyAttributes attributes = |
5248 static_cast<PropertyAttributes>(unchecked_attributes); | 5248 static_cast<PropertyAttributes>(unchecked_attributes); |
5249 | 5249 |
5250 #ifdef DEBUG | 5250 #ifdef DEBUG |
5251 uint32_t index = 0; | 5251 uint32_t index = 0; |
5252 ASSERT(!key->ToArrayIndex(&index)); | 5252 ASSERT(!key->ToArrayIndex(&index)); |
5253 LookupIterator it(object, key, LookupIterator::CHECK_OWN_REAL); | 5253 LookupIterator it(object, key, LookupIterator::CHECK_OWN_REAL); |
5254 JSReceiver::GetPropertyAttributes(&it); | 5254 Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); |
| 5255 ASSERT(maybe.has_value); |
5255 RUNTIME_ASSERT(!it.IsFound()); | 5256 RUNTIME_ASSERT(!it.IsFound()); |
5256 #endif | 5257 #endif |
5257 | 5258 |
5258 Handle<Object> result; | 5259 Handle<Object> result; |
5259 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 5260 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
5260 isolate, result, | 5261 isolate, result, |
5261 JSObject::SetOwnPropertyIgnoreAttributes(object, key, value, attributes)); | 5262 JSObject::SetOwnPropertyIgnoreAttributes(object, key, value, attributes)); |
5262 return *result; | 5263 return *result; |
5263 } | 5264 } |
5264 | 5265 |
(...skipping 10 matching lines...) Expand all Loading... |
5275 (unchecked_attributes & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 5276 (unchecked_attributes & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
5276 // Compute attributes. | 5277 // Compute attributes. |
5277 PropertyAttributes attributes = | 5278 PropertyAttributes attributes = |
5278 static_cast<PropertyAttributes>(unchecked_attributes); | 5279 static_cast<PropertyAttributes>(unchecked_attributes); |
5279 | 5280 |
5280 #ifdef DEBUG | 5281 #ifdef DEBUG |
5281 bool duplicate; | 5282 bool duplicate; |
5282 if (key->IsName()) { | 5283 if (key->IsName()) { |
5283 LookupIterator it(object, Handle<Name>::cast(key), | 5284 LookupIterator it(object, Handle<Name>::cast(key), |
5284 LookupIterator::CHECK_OWN_REAL); | 5285 LookupIterator::CHECK_OWN_REAL); |
5285 JSReceiver::GetPropertyAttributes(&it); | 5286 Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); |
| 5287 ASSERT(maybe.has_value); |
5286 duplicate = it.IsFound(); | 5288 duplicate = it.IsFound(); |
5287 } else { | 5289 } else { |
5288 uint32_t index = 0; | 5290 uint32_t index = 0; |
5289 RUNTIME_ASSERT(key->ToArrayIndex(&index)); | 5291 RUNTIME_ASSERT(key->ToArrayIndex(&index)); |
5290 Maybe<bool> maybe = JSReceiver::HasOwnElement(object, index); | 5292 Maybe<bool> maybe = JSReceiver::HasOwnElement(object, index); |
5291 if (!maybe.has_value) return isolate->heap()->exception(); | 5293 if (!maybe.has_value) return isolate->heap()->exception(); |
5292 duplicate = maybe.value; | 5294 duplicate = maybe.value; |
5293 } | 5295 } |
5294 if (duplicate) { | 5296 if (duplicate) { |
5295 Handle<Object> args[1] = { key }; | 5297 Handle<Object> args[1] = { key }; |
(...skipping 9722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15018 } | 15020 } |
15019 return NULL; | 15021 return NULL; |
15020 } | 15022 } |
15021 | 15023 |
15022 | 15024 |
15023 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15025 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15024 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15026 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15025 } | 15027 } |
15026 | 15028 |
15027 } } // namespace v8::internal | 15029 } } // namespace v8::internal |
OLD | NEW |