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" |
10 | 11 |
11 namespace v8 { | 12 namespace v8 { |
12 namespace internal { | 13 namespace internal { |
13 | 14 |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 MaybeHandle<JSObject> InstantiateObject(Isolate* isolate, | 18 MaybeHandle<JSObject> InstantiateObject(Isolate* isolate, |
18 Handle<ObjectTemplateInfo> data); | 19 Handle<ObjectTemplateInfo> data); |
19 | 20 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 DCHECK(maybe.IsJust()); | 89 DCHECK(maybe.IsJust()); |
89 duplicate = it.IsFound(); | 90 duplicate = it.IsFound(); |
90 } else { | 91 } else { |
91 uint32_t index = 0; | 92 uint32_t index = 0; |
92 key->ToArrayIndex(&index); | 93 key->ToArrayIndex(&index); |
93 Maybe<bool> maybe = JSReceiver::HasOwnElement(object, index); | 94 Maybe<bool> maybe = JSReceiver::HasOwnElement(object, index); |
94 if (!maybe.IsJust()) return MaybeHandle<Object>(); | 95 if (!maybe.IsJust()) return MaybeHandle<Object>(); |
95 duplicate = maybe.FromJust(); | 96 duplicate = maybe.FromJust(); |
96 } | 97 } |
97 if (duplicate) { | 98 if (duplicate) { |
98 Handle<Object> args[1] = {key}; | 99 THROW_NEW_ERROR( |
99 THROW_NEW_ERROR(isolate, NewTypeError("duplicate_template_property", | 100 isolate, NewTypeError(MessageTemplate::kDuplicateTemplateProperty, key), |
100 HandleVector(args, 1)), | 101 Object); |
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 |