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-inl.h" | 8 #include "src/isolate-inl.h" |
9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 auto prop_data = handle(GetIntrinsic(isolate, intrinsic), isolate); | 195 auto prop_data = handle(GetIntrinsic(isolate, intrinsic), isolate); |
196 | 196 |
197 RETURN_ON_EXCEPTION(isolate, DefineDataProperty(isolate, obj, name, | 197 RETURN_ON_EXCEPTION(isolate, DefineDataProperty(isolate, obj, name, |
198 prop_data, attributes), | 198 prop_data, attributes), |
199 JSObject); | 199 JSObject); |
200 } | 200 } |
201 } | 201 } |
202 return obj; | 202 return obj; |
203 } | 203 } |
204 | 204 |
205 | |
206 MaybeHandle<JSObject> InstantiateObject(Isolate* isolate, | 205 MaybeHandle<JSObject> InstantiateObject(Isolate* isolate, |
207 Handle<ObjectTemplateInfo> data) { | 206 Handle<ObjectTemplateInfo> info) { |
208 // Enter a new scope. Recursion could otherwise create a lot of handles. | 207 // Enter a new scope. Recursion could otherwise create a lot of handles. |
209 HandleScope scope(isolate); | 208 HandleScope scope(isolate); |
210 // Fast path. | 209 // Fast path. |
211 Handle<JSObject> result; | 210 Handle<JSObject> result; |
212 auto info = Handle<ObjectTemplateInfo>::cast(data); | |
213 auto constructor = handle(info->constructor(), isolate); | 211 auto constructor = handle(info->constructor(), isolate); |
214 Handle<JSFunction> cons; | 212 Handle<JSFunction> cons; |
215 if (constructor->IsUndefined()) { | 213 if (constructor->IsUndefined()) { |
216 cons = isolate->object_function(); | 214 cons = isolate->object_function(); |
217 } else { | 215 } else { |
218 auto cons_templ = Handle<FunctionTemplateInfo>::cast(constructor); | 216 auto cons_templ = Handle<FunctionTemplateInfo>::cast(constructor); |
219 ASSIGN_RETURN_ON_EXCEPTION( | 217 ASSIGN_RETURN_ON_EXCEPTION( |
220 isolate, cons, InstantiateFunction(isolate, cons_templ), JSFunction); | 218 isolate, cons, InstantiateFunction(isolate, cons_templ), JSFunction); |
221 } | 219 } |
222 auto object = isolate->factory()->NewJSObject(cons); | 220 auto object = isolate->factory()->NewJSObject(cons); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); | 614 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); |
617 JSObject::SetAccessor(result, accessor).Assert(); | 615 JSObject::SetAccessor(result, accessor).Assert(); |
618 } | 616 } |
619 | 617 |
620 DCHECK(result->shared()->IsApiFunction()); | 618 DCHECK(result->shared()->IsApiFunction()); |
621 return result; | 619 return result; |
622 } | 620 } |
623 | 621 |
624 } // namespace internal | 622 } // namespace internal |
625 } // namespace v8 | 623 } // namespace v8 |
OLD | NEW |