| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "src/api-natives.h" | 5 #include "src/api-natives.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
| 10 #include "src/messages.h" | |
| 11 | 10 |
| 12 namespace v8 { | 11 namespace v8 { |
| 13 namespace internal { | 12 namespace internal { |
| 14 | 13 |
| 15 | 14 |
| 16 namespace { | 15 namespace { |
| 17 | 16 |
| 18 MaybeHandle<JSObject> InstantiateObject(Isolate* isolate, | 17 MaybeHandle<JSObject> InstantiateObject(Isolate* isolate, |
| 19 Handle<ObjectTemplateInfo> data); | 18 Handle<ObjectTemplateInfo> data); |
| 20 | 19 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 DCHECK(maybe.IsJust()); | 88 DCHECK(maybe.IsJust()); |
| 90 duplicate = it.IsFound(); | 89 duplicate = it.IsFound(); |
| 91 } else { | 90 } else { |
| 92 uint32_t index = 0; | 91 uint32_t index = 0; |
| 93 key->ToArrayIndex(&index); | 92 key->ToArrayIndex(&index); |
| 94 Maybe<bool> maybe = JSReceiver::HasOwnElement(object, index); | 93 Maybe<bool> maybe = JSReceiver::HasOwnElement(object, index); |
| 95 if (!maybe.IsJust()) return MaybeHandle<Object>(); | 94 if (!maybe.IsJust()) return MaybeHandle<Object>(); |
| 96 duplicate = maybe.FromJust(); | 95 duplicate = maybe.FromJust(); |
| 97 } | 96 } |
| 98 if (duplicate) { | 97 if (duplicate) { |
| 99 THROW_NEW_ERROR( | 98 Handle<Object> args[1] = {key}; |
| 100 isolate, NewTypeError(MessageTemplate::kDuplicateTemplateProperty, key), | 99 THROW_NEW_ERROR(isolate, NewTypeError("duplicate_template_property", |
| 101 Object); | 100 HandleVector(args, 1)), |
| 101 Object); |
| 102 } | 102 } |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 RETURN_ON_EXCEPTION( | 105 RETURN_ON_EXCEPTION( |
| 106 isolate, Runtime::DefineObjectProperty(object, key, value, attributes), | 106 isolate, Runtime::DefineObjectProperty(object, key, value, attributes), |
| 107 Object); | 107 Object); |
| 108 return object; | 108 return object; |
| 109 } | 109 } |
| 110 | 110 |
| 111 | 111 |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); | 579 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); |
| 580 JSObject::SetAccessor(result, accessor).Assert(); | 580 JSObject::SetAccessor(result, accessor).Assert(); |
| 581 } | 581 } |
| 582 | 582 |
| 583 DCHECK(result->shared()->IsApiFunction()); | 583 DCHECK(result->shared()->IsApiFunction()); |
| 584 return result; | 584 return result; |
| 585 } | 585 } |
| 586 | 586 |
| 587 } // namespace internal | 587 } // namespace internal |
| 588 } // namespace v8 | 588 } // namespace v8 |
| OLD | NEW |